使用vscode调试rust程序时出错(仅限windows)

qpgpyjmq  于 2023-02-19  发布在  Vscode
关注(0)|答案(1)|浏览(261)

我尝试使用vscode调试下面的代码,但是出现了错误。
开发环境

  • 微软 windows 10家庭版10.0.19042内部版本19042
  • 不 rust 钢1.49.0(e1884a8e3 2020年12月29日)
  • 验证码1.54.3
  • 代码LLDB版本1.6.1
// Cargo.toml
//[dependencies]
//datafusion = "3.0.0"
//arrow = "3.0.0"
//tokio = { version = "0.2", features = ["macros", "blocking", "rt-core", "rt-threaded", "sync"] }

use std::time::{Duration, Instant};
use arrow::util::pretty;
use datafusion::error::Result;
use datafusion::prelude::*;

/// This example demonstrates executing a simple query against an Arrow data source (CSV) and
/// fetching results

#[tokio::main]
async fn main() -> Result<()> {
    println!("======== Start Program ========");
    let start = Instant::now();

    // let res_path = r"/root/workspace/project/hello_arrow/res/sample_01.csv";

    // http://insideairbnb.com/get-the-data.html
    // listing_id,id,date,reviewer_id,reviewer_name,comments
    // Boston, Massachusetts, United States
    let res_path = r"D:\workspace\vscode\arrow_rust\res\review.01.csv";

    // create local execution context
    let mut ctx = ExecutionContext::new();
    // register csv file with the execution context
    ctx.register_csv("datatable_01", res_path, CsvReadOptions::new())?;

    // execute the query
    let sql = "SELECT count(id) from datatable_01";
    let df = ctx.sql(sql)?;
    let results = df.collect().await?;

    // print the results
    pretty::print_batches(&results)?;

    let duration = start.elapsed();

    println!("Time elapsed in expensive_function() is: {:?}", duration);
    println!("======== End Program ========");
    Ok(())
}

错误代码

configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug Window',
  program: '${workspaceRoot}/target/debug/arrow_rust.exe',
  args: [],
  cwd: '${workspaceRoot}',
  sourceLanguages: [ 'rust' ],
  __configurationTarget: 5,
  relativePathBase: 'd:\\workspace\\vscode\\arrow_rust'
}
Listening on port 8541
error: arrow_rust.exe :: Class 'arrow::datatypes::DataType' has a member '__0' of type 'alloc::vec::Vec<arrow::datatypes::Field>' which does not have a complete definition.
Debug adapter exit code=3221225620, signal=null.

程序运行正常,同样的代码在Linux上调试良好.
有没有其他方法可以在Windows上进行调试?

ux6nzvsh

ux6nzvsh1#

我也有同样的问题。
受到下面链接的启发,我已经解决了这个问题。
https://github.com/vadimcn/vscode-lldb/issues/410#issuecomment-786791796
原因是我安装了NVIDIA Nsight
如下所示,codelldb已加载Nsightmsdia140.dll。

以管理员身份运行PowerShell。执行下面的命令注册组件。然后codelldb工作。

regsvr32.exe C:\Users\【user name】\.vscode\extensions\vadimcn.vscode-lldb-1.6.8\lldb\bin\msdia140.dll

    • 更新**

对于较新版本,DLL已移至另一个文件夹:

regsvr32.exe C:\Users\[user name]\.vscode\extensions\vadimcn.vscode-lldb-1.8.1\adapter\msdia140.dll

相关问题