开发者

VS2008 attaching a debugger (C++) to handle assert(...)

There are two scenarios that I'm interested to improve in my assert. 1) a debug build app is started regularly, if there is an assertion I'm getting "Debug assertion failed" dialog box with "Abort", "Retry", "Ignore". Abort and Ignore answers are working fine. The problem with Retry. If I hit retry I'm getting that开发者_如何学Go useless "Application error, breakpoint has been reached" "OK" - to terminate, "Cancel" - to debug the program.

Is it possible to avoid this dialog and go directly to the "Just in time debugger" dialog that shows choices for debuggers? I understand that the "Application error" dialog box is triggered by __debugbreak() or _asm int 3 on intel, so after "Retry" was pressed I need to attach debugger without using _asm int 3. Is this possible? I couldn't find any WinAPI that does this

2) A debug build app is started in VS debugger (using F5). If an assert is triggered I don't want to see any dialog, I want it to stop right on the assert. I managed to install crt debug runtime hooks and if IsDebuggerPresent then I __debugbreak() and it stops on the line of the assert. It works perfectly when I'm debugging windows mobile builds, but I'm still getting a dialog box for Win32 builds: "APP.exe has triggered a breakpoint", "Break", "Continue", and greyed out "Ignore". Any way to completely disable it?


Take a look at the registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug.

I think that if you set Auto to 1, that the debugger is automatically started.

And of course changing the assert implementation can also help you (take a look at the SuperAssert of John Robbins from his famous Debugging Windows Applications book).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜