简体   繁体   English

使用VS Code和MSVC工具链调试Rust程序时,如何在“ panic”处设置断点?

[英]How can I set a breakpoint at a `panic` when debugging a Rust program with VS Code and the MSVC toolchain?

I can set a breakpoint manualy, and run with debugger, but I can't set a breakpoint at a panic of a Rust program. 我可以手动设置一个断点,并使用调试器运行,但是我无法在Rust程序出现紧急情况时设置断点。 How can I set a breakpoint at a panic like I would an exception in C++? 如何像在C ++中发生异常那样在紧急情况下设置断点?

I'm using Rust 1.29.0-nightly, VS Code 1.25.1 and the MSVC 2017 toolchain. 我每晚使用Rust 1.29.0,VS Code 1.25.1和MSVC 2017工具链。

With the MSVC toolchain, you could use the Visual Studio debugger. 使用MSVC工具链,您可以使用Visual Studio调试器。 In VSCode, you could install the "C/C++" extension to access it. 在VSCode中,您可以安装“ C / C ++”扩展名来访问它。 Despite the name, the debugger supports Rust just fine. 尽管名称,调试器也支持Rust。

Panics uses the same strategy as C++ exceptions when set to unwinding, so you could catch panics using the same exception breakpoints for C++. 设置为展开时,Panics使用与C ++异常相同的策略,因此您可以使用相同的C ++异常断点来捕获Panics。

(screenshot provided by OP) (OP提供的屏幕截图)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用vs代码调试文件时,如何将文件传递到我的程序中 - How can I pass a file into my program, when debugging it with vs code 在调试MSVC ABI Rust程序时如何检查变量值? - How can I inspect variable values while debugging MSVC ABI Rust programs? 如何在 VS Code 的断点处启动交互式 session? - How can I start an interactive session at breakpoint in VS Code? 如何在 Visual Studio 中的引用代码中设置断点? - How can I set a breakpoint in referenced code in Visual Studio? 在 clion 中使用 MSVC 工具链时无法调试“iostream”相关代码 - Cant debug `iostream` related code when using MSVC toolchain in clion Visual Studio Code,调试节点 - 我怎样才能达到这个“未验证的断点”? - Visual Studio Code, Debugging Node - How can I hit this 'Unverified Breakpoint'? 在 VS Code 中调试时如何跳过外部代码 - How do I skip external code when debugging in VS Code 如何在Eclipse中变量更改时设置断点? - How can I set a breakpoint for when variable changes in Eclipse? VS 代码调试中的条件断点(或编辑断点)不起作用 - Conditional breakpoint ( or edit breakpoint) in VS code debugging is not working 在Chrome Devtools中调试Javascript时,遇到DOM断点后如何继续? - When debugging Javascript in Chrome Devtools, how can I continue after hitting a DOM breakpoint?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM