[英]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.