结果导致vscode设置的断点不能被命中。 最终查明原因是rustc默认不生成debug symbol,需要用rustc -g xxx.rs才能生成。-g = -C debuginfo=2, rust codegen参数参考如下: Codegen Options - The rustc book 测试了下,cargo build默认是带debug symbol的,可以使用cargo build --release去掉。 debug symbol确认方法...
记录一下在Visual Studio Code中配置Rust debug模式。 Rust 版本 安装Rust,具体到官网下载https://www.rust-lang.org/, 由于我在windows环境上,因此安装了msvc版本 Default host:x86_64-pc-windows-msvcrustup home:D:\Users\xxx\.rustupstable-x86_64-pc-windows-msvc(default)rustc1.46.0(04488afe32020-08...
* so we can invoke itfromthe debug launcher.*/"label":"Cargo Build (debug)","type":"process","command":"cargo","args": ["build"],"problemMatcher": ["$rustc"],"group": {"kind":"build","isDefault": true
{ "version": "0.2.0", "configurations": [ { "name": "(Windows) Launch", "type": "cppvsdbg", "request": "launch", "program": "${workspaceRoot}/target/debug/foo.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": tru...
1. world_hello是rust项目的文件夹,如果vscode打开的文件夹就是world_hello这个文件夹,则上面的配置可以改为下面代码块的内容 "program": "${workspaceFolder}/target/debug/world_hello" 1. 总之需要配置文件里面标明world_hello这个可执行文件的路径
这将生成一个名为.vscode/launch.json的文件,其中包含用于调试Rust程序的配置信息。设置断点:在你的Rust源代码文件中,单击行号旁边的空白区域以设置断点。你可以在多个地方设置断点。启动调试器:在"运行和调试"侧边栏选项卡中,从下拉菜单中选择你刚刚创建的Rust调试配置(通常名为"Launch"或"Debug"),然后点击绿色的"...
rust-analyzer C/C++ Native Debug Step1 点击"运行和调试", 选择C++(Windows) Step 2 在创建的配置文件, 修改program, 修改为项目编译后的exe路径 Step3 删除掉"console": "externalTerminal",(如果有的话) Step4 在上述文件中添加一行"preLaunchTask": "${defaultBuildTask}" ...
在VSCode的扩展,搜索Rust。找到点击install。 或者Command + P,输入:ext install rust-lang.rust,回车。 通过cargo新建一个demo项目 # 新建项目 ➜ ~cargo new HelloWorld # 打开vscode ➜ ~code . 可以看到目录结构: . ├── Cargo.lock ├── Cargo.toml ...
如何在VSCode中调试Rust代码? 首先,打开VSCode并创建或打开一个Rust项目。 在项目文件夹中找到.vscode文件夹,里面有一个launch.json文件。如果文件不存在,可以通过点击Debug面板上的"创建launch.json文件"按钮来生成。 在launch.json文件中,配置你的调试选项。你可以指定要调试的可执行文件,设置断点等。
为了调试Rust应用程序,我们需要创建一个`.vscode`文件夹,并在其中添加一个`launch.json`文件。在该文件中,我们可以定义不同的调试配置,并选择要调试的Rust应用程序。 以下是一个示例的`launch.json`文件内容,供参考: ```json { "version": "0.2.0", "configurations": [ { "name": "Debug Rust", "type...