DebugBreak not breaking

人走茶凉 提交于 2019-12-20 10:12:08

问题


I'm writing a class in C++ that I cannot debug by using F5. The code will run from another "service" that will invoke it. In the past I've used __debugbreak() and when I got a window telling me that an exception was thrown selected to debug it.

Recently I've updated to windows 7 and it kept working for a while.

Today when I've tried to debug a piece of my code instead of shown the regular dialog that tells me that VSTestHost has stopped working and enable me to to debug the application I got a different dialog suggesting I send the data to microsoft for analysis.

Does anyone knows how can I fix this issue so I'll be able to debug my code?


回答1:


Finally I found the cause of the issue. It's a Vista/Win7 cause:

  1. Open The Action center control
  2. Goto Action Center settings
  3. Goto Problem Reporting Settings
  4. Choose "Each time a problem occurs, ask me before checking for solution"

Although this is more of IT solution/question I've been plagued with this problem all day and wanted to share the solution with other developers who encounter this problem.




回答2:


I finally found the solution for Windows 10 here: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/enabling-postmortem-debugging

And also: https://docs.microsoft.com/en-us/windows/desktop/Debug/configuring-automatic-debugging

To enable automatic debugger launch, you should add a registry value:

  • key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug, value Auto = 1 (of type REG_DWORD)

The configured debugger is set the by the value Debugger (type REG_SZ); a Visual Studio installation sets this to:

"C:\WINDOWS\system32\vsjitdebugger.exe" -p %ld -e %ld

Note that on 64 bit OS this only works for 64 bit executables. To enable the same behaviour in 32 bit executables set the same values in this key:

  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug



回答3:


In that case...

http://community.codesmithtools.com/blogs/blake/archive/2009/06/03/tips-amp-tricks-debugging-codesmith-on-microsoft-windows-7.aspx

Here is the quick overview of what you need to-do to enable debugging on a Microsoft Windows 7 machine:

Update the Just-In-Time debugger setting DbgJITDebugLaunchSetting. The setting is found in the registry at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework].
Set the value of DbgJITDebugLaunchSetting to 2. If you are using a 64bit operating system then you must also set the same key (DbgJITDebugLaunchSetting) in this folder [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework] to 2. If you run into any issues try running CodeSmith Studio and Visual Studio as an administrator. Now when CodeSmith enters a break point you will see something like this:




回答4:


You could try debug > attach to process.



来源:https://stackoverflow.com/questions/1044103/debugbreak-not-breaking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!