NOTES
Run GDB in a loop until hitting an error
So you have a bug that only happens sometimes and you need to inspect it in GDB? One way to do it would be to start the program then manually do run
each time it ends until you hit the error.
Better yet, have run executed each time for you on exit until you hit the error.
Here’s how:
- Start your program in GDB as you normally would
Enter the following “magic incantation”:
set pagination off b _exit commands run end
Type
run
and enter to start the first run