• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Windows上用VS Code调试Rust 程序 : Parity源代码

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

https://blog.csdn.net/weixin_33709219/article/details/92672559

 

以前看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参考:

 

 
  1. rustup self update

  2.  
  3. rustup update nightly

  4.  
  5. rustup component add rls --toolchain nightly

  6.  
  7. rustup component add rust-analysis --toolchain nightly

  8.  
  9. rustup component add rust-src --toolchain nightly

  10.  
  11. rustup component add rust-src --toolchain stable

  12.  
  13. 添加环境变量

  14.  
  15. set RUST_SRC_PATH=%USERPROFILE%.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\src\rust\src

  16.  
  17. 使用Cargo包管理器安装

  18.  
  19. cargo install racer

  20.  
  21. cargo install rustfmt

  22.  
  23. cargo install rustsym

  24.  
  25. WASM编译: 安装

  26.  
  27. rustup target add wasm32-unknown-emscripten stable

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

这是我的Launch.json

 
  1. {

  2. // 使用 IntelliSense 了解相关属性。

  3. // 悬停以查看现有属性的描述。

  4. // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

  5. "version": "0.2.0",

  6. "configurations": [

  7. {

  8. "name": "(Windows) Launch",

  9. "type": "cppvsdbg",

  10. "request": "launch",

  11. "program": "C:/dev/Coins/parity-master/target/debug/parity.exe",

  12. "args": [],

  13. "stopAtEntry": false,

  14. "cwd": "${workspaceFolder}",

  15. "environment": [],

  16. "externalConsole": true

  17. }

  18. ]

  19. }

然后,编译RUST程序

     Cargo Build

 

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

 

转载于:https://my.oschina.net/gavinzheng731/blog/1580801


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap