如何将Visual Studio设置为默认的事后调试器?

时间:2022-04-01 00:23:03

Not too long ago, I had a problem which required me to set WinDbg.exe as the default post-mortem debugger. Now that I've fixed that and am back doing normal work, it would be really nice if I could set VS to be my default post-mortem debugger. How does one go about doing this?

不久前,我遇到了一个问题,要求我将WinDbg.exe设置为默认的事后调试器。现在我已经解决了这个问题并且恢复正常工作,如果我能将VS设置为默认的事后调试器,那将是非常好的。怎么去做这个?

Also, how do I make VS attach to an already existing session? That is, I've got my VS project open in one window, and a command line open where I'm launching my program from. If the program crashes, how do I get VS to figure out to attach the debugger to the active line in the project that's already open?

另外,如何将VS附加到现有会话?也就是说,我已经在一个窗口中打开了我的VS项目,并且在我启动程序的地方打开了一个命令行。如果程序崩溃,我如何让VS找出将调试器附加到已经打开的项目中的活动行?

2 个解决方案

#1


7  

from the Microsoft support page:

从Microsoft支持页面:

1.  Start Registry Editor and locate the following Registry subkey in the HKEY_LOCAL_MACHINE subtree:

\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AEDEBUG
2.  Select the Debugger value.
3.  On the Edit menu, click String.

•   To use the Windows debugger, type windbg -p %ld -e %ld.
•   To use Visual C++ 4.2 or earlier, type msvc -p %ld -e %ld.
•   To use Visual C++ 5.0 or later, type msdev.exe -p %ld -e %ld.
•   To use Dr. Watson, type drwtsn32.exe -p %ld -e %ld. You can also make Dr. Watson the default debugger by running this command:drwtsn32.exe -i.
4.  Choose OK and exit Registry Editor. 

#2


20  

You can re-enable Visual Studio for Just-In-Time debugging from within Visual Studio:

您可以从Visual Studio中重新启用Visual Studio以进行实时调试:

Go to the Tools | Options | Debugging | Just-In-Time dialog. Then make sure all Native and Managed (if you're debugging a .NET application) are checked. Next time you get a crash, the Visual Studio Just-In-Time debugger will come up.

转到工具|选项|调试|即时对话框。然后确保选中所有Native和Managed(如果您正在调试.NET应用程序)。下次出现崩溃时,Visual Studio即时调试程序将出现。

The Visual Studio Just-In-Time debugger let's you choose whether you want to open a new instance of Visual Studio or start debugging with a currently open solution.

Visual Studio实时调试程序允许您选择是要打开Visual Studio的新实例还是使用当前打开的解决方案开始调试。

#1


7  

from the Microsoft support page:

从Microsoft支持页面:

1.  Start Registry Editor and locate the following Registry subkey in the HKEY_LOCAL_MACHINE subtree:

\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\AEDEBUG
2.  Select the Debugger value.
3.  On the Edit menu, click String.

•   To use the Windows debugger, type windbg -p %ld -e %ld.
•   To use Visual C++ 4.2 or earlier, type msvc -p %ld -e %ld.
•   To use Visual C++ 5.0 or later, type msdev.exe -p %ld -e %ld.
•   To use Dr. Watson, type drwtsn32.exe -p %ld -e %ld. You can also make Dr. Watson the default debugger by running this command:drwtsn32.exe -i.
4.  Choose OK and exit Registry Editor. 

#2


20  

You can re-enable Visual Studio for Just-In-Time debugging from within Visual Studio:

您可以从Visual Studio中重新启用Visual Studio以进行实时调试:

Go to the Tools | Options | Debugging | Just-In-Time dialog. Then make sure all Native and Managed (if you're debugging a .NET application) are checked. Next time you get a crash, the Visual Studio Just-In-Time debugger will come up.

转到工具|选项|调试|即时对话框。然后确保选中所有Native和Managed(如果您正在调试.NET应用程序)。下次出现崩溃时,Visual Studio即时调试程序将出现。

The Visual Studio Just-In-Time debugger let's you choose whether you want to open a new instance of Visual Studio or start debugging with a currently open solution.

Visual Studio实时调试程序允许您选择是要打开Visual Studio的新实例还是使用当前打开的解决方案开始调试。