Original Post
🔒 Locked
Custom Debugging
Advertisement
To hard code a breakpoint in C code on x86 with MSVC use
Will catch the breakpoint when run outside the debugger but when run inside the debugger it seems the debugger catches it first. I don't know how to get around that, maybe a bit of Googling will help.
__asm int 3As for catching exceptions, you'll want to look into Win32 Structured Exception Handling but I'm not sure how you can catch a breakpoint exception before the debugger gets a hold of it. This test program:#include <iostream>#include <windows.h>int main(int argc, char* argv[]){ __try { __asm int 3 } __except(GetExceptionCode() == EXCEPTION_BREAKPOINT ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { std::cout << "Hit a breakpoint!\n"; } return 0;}Will catch the breakpoint when run outside the debugger but when run inside the debugger it seems the debugger catches it first. I don't know how to get around that, maybe a bit of Googling will help.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement