I have some debugging code that if executed while running with GBD attached should break the execution of the application, but if GDB is not running it should continue.
The code I’m working with looks something like this in structure:
try
{
if( some_complex_expression )
{
gdb_should_break_here();
do_some_stuff();
throw MyException();
}
}
catch( const MyException & e )
{
handle_exception_and_continue();
}
What should gdb_should_break_here be?
Actually it looks like just making sure there is an empty gdb_should_break_here() function everywhere I need to break will work. (So long as I’m not optimising the code).
Then all I need to do is a
and gdb will stop in all the right places.
Guess I overlooked it as my code wasn’t really that nicely organised, and contained in a few debugging macros.