Cir*_*i94 30
launch.json将打开一个文件,如果没有,打开它,它在.vscode文件夹下你launch.json应该看起来像这样:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceRoot}/target/debug/hello_world",
"args": [],
"cwd": "${workspaceRoot}/target/debug/",
"sourceLanguages": ["rust"]
}
]
}
Run Code Online (Sandbox Code Playgroud)这里有一些关于Rust和VS Code的博客文章:
cyn*_*nic 21
Rust编译器生成具有本机调试信息(符号)信息的本机二进制文件,因此任何本机调试器都可以.这意味着gdb和lldb,或者如果你正在使用生锈的MSVC ABI版本的Windows调试器(WinDBG的或只是Visual Studio中).如果你想要一个集成的体验,RustDT是可行的方法(在Windows 上设置:如何设置GDB以在Windows中调试Rust程序?).请注意,您可能会遇到如何在调试MSVC ABI Rust程序时检查变量值?在Windows上和Mac上的https://github.com/rust-lang/rust/issues/33062.
小智 6
一个以以下内容开头的答案:
……根本无法解决。
转到您的项目文件夹并开始,rust-gdb target/debug/your_executable
然后选择您想要中断的一些行。点击“运行”...
当你没有 IDE 时(否则你不会问,我猜)它是终端/VIM 用户世界中最好的。
这里有一些如何使用的提示:
与 gdb 本机相比,我的gdb 7.11命令似乎提供了更多与 Rust 相关的信息。rust-gdb例如,rust-gdb正确显示 rust 对象的全名,而 gdb 根本不显示它们。
在下面的示例中,gdb 现在将显示所有粗体部分。
$1 = Args = {
inner = **ArgsOs** = {
inner = **Args** = {
iter = **IntoIter<std::ffi::os_str::OsString>** = {
buf = **NonNull<std::ffi::os_str::OsString>** = {
pointer = **NonZero<*const std::ffi::os_str::OsString>** = {
0x7ffff6c20060
}
},
phantom = **PhantomData<std::ffi::os_str::OsString>**,
cap = 1,
ptr = 0x7ffff6c20060, end = 0x7ffff6c20078},
_dont_send_or_sync_me = **PhantomData<*mut ()>**
}
}
}
Run Code Online (Sandbox Code Playgroud)