您现在的位置是:首页 > 文章详情

Windows上用VS Code调试Rust程序

日期:2018-09-02点击:508

以前看Parity源代码的时候,一直用GDB调试跟踪。幸亏以前有Unix/Linux编程的底子,否则用GDB想死的心都有。最近发现Microsoft的VS Code,非常不错。把过程记下来,备查

首先下载VSCode    

如果没有visual Studio的话,要下载Visual Studio Build Tool 2015  

其次,启动VS Code,安装Extension

  1. ext install C++  -- 安装C++(Windows)
  2. ext install Debug  -- 安装GDB,llDB
  3. ext install vscode-rust

然后,安装ToolChain

安装RLS参考:

 

rustup self update rustup update nightly rustup component add rls --toolchain nightly rustup component add rust-analysis --toolchain nightly rustup component add rust-src --toolchain nightly rustup component add rust-src --toolchain stable 添加环境变量 set RUST_SRC_PATH=%USERPROFILE%.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\src\rust\src 使用Cargo包管理器安装 cargo install racer cargo install rustfmt cargo install rustsym WASM编译: 安装 rustup target add wasm32-unknown-emscripten stable

在VS Code中点击选择“Add Configuration", 这回自动在 .vscode目录下生成一个Launch.json。进行相应的修改,于本地环境相配。

这是我的Launch.json

{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(Windows) Launch", "type": "cppvsdbg", "request": "launch", "program": "C:/dev/Coins/parity-master/target/debug/parity.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true } ] }

然后,编译RUST程序

     Cargo Build

114034_tOJa_2981977.png

 

点击绿色的"play"按钮,Hola...

112108_X9oy_2981977.png

 

原文链接:https://yq.aliyun.com/articles/632899
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章