How can I break if gdb is attached, but continue if it is not?
- by Michael Anderson
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_berak_here();
do_some_stuff();
throw MyException();
}
}
catch( const MyException & e )
{
handle_exception_and_continue();
}
What should gdb_should_break_here be?