Windows上用VS Code调试Rust程序

简介:

以前看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

 

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

 

相关文章
|
2天前
|
安全 JavaScript Java
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
20 12
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
|
4月前
|
安全 API C#
C# 如何让程序后台进程不被Windows任务管理器强制结束
C# 如何让程序后台进程不被Windows任务管理器强制结束
112 0
|
5月前
|
安全 网络安全 API
基于WMI更新Windows系统信息采集程序sysInfo的一些收获
基于WMI更新Windows系统信息采集程序sysInfo的一些收获
|
5月前
|
Windows Python
python获取windows机子上运行的程序名称
python获取windows机子上运行的程序名称
|
5月前
|
小程序 Windows
MASM32编写的程序在Windows 7,10下运行正常,但在Win XP下运行时只闻其声不见其形的故障
MASM32编写的程序在Windows 7,10下运行正常,但在Win XP下运行时只闻其声不见其形的故障
|
6月前
|
Linux Windows Python
最新 Windows\Linux 后台运行程序注解
本文介绍了在Windows和Linux系统后台运行程序的方法,包括Linux系统中使用nohup命令和ps命令查看进程,以及Windows系统中通过编写bat文件和使用PowerShell启动隐藏窗口的程序,确保即使退出命令行界面程序也继续在后台运行。
|
6月前
|
JavaScript Windows
electron程序运行在某些 windows 上白屏
electron程序运行在某些 windows 上白屏
|
8月前
|
C++ UED 开发者
逆向学习 MFC 篇:视图分割和在 C++ 的 Windows 窗口程序中添加图标的方法
逆向学习 MFC 篇:视图分割和在 C++ 的 Windows 窗口程序中添加图标的方法
110 0
|
8月前
|
Windows
windows系统bat批处理 开机一键多个程序
windows系统bat批处理 开机一键多个程序
123 1
|
9月前
|
Windows
LabVIEW启用/禁用Windows屏幕保护程序
LabVIEW启用/禁用Windows屏幕保护程序
104 4
LabVIEW启用/禁用Windows屏幕保护程序