In Visual Studio 2008 MFC application is there a way to stop the debugging without a breakpoint, when I press a button? The problem is, it’s a pretty big and shared project, so my code is called by another “module”, but I don’t know which of my functions are called, so I don’t know where to put a breakpoint. My goal would be to break the process, if any of my functions are called.
Share
You could write a Visual Studio macro that puts a breakpoint on every line in your source code. You could make it a bit smarter and only put breakpoints on each function start, but that would require some parsing. Bind that macro to a key. Run the MFC application and when you want to start breaking on your own code, switch to Visual Studio, press the key and presto, you will break on the first use of your code.
The other option is to make a C++ macro that checks if a global boolean has been set and executes asm { int 3 } when it has. Use this macro at the start of every (high level) function of your code. Add code that sets the global boolean when a certain button is pressed in the MFC application. This will only work in a 32-bit executable, you’ll need some intrinsic in a 64-bit executable, which I don’t know by head.
Hope this helps.
Cheers,
Sebastiaan