1

I have a C++ program that segfaults occasionally. The answer to this SO question provides a way to make GDB run my program over and over until it catches the segfault.

However, navigating my program via GDB has been a pain and I would like to do this using the Eclipse debugger. I have successfully created a debug configuration that runs my program.

Is there a way to make Eclipse keep running this debug configuration until a segfault (or other error) occurs?

I thought I may be able to do it by providing a GDB command file in the debug configuration that would set a break point at the program's exit and then command GDB to rerun the program.

Attempted GDB command file:

break exit
run
end

But using this GDB command file results in the following error when I attempt to start a debugging session:

Error in final launch sequence
Failed to execute MI command:
source /home/matt/gdb-loop
Error message from debugger back end:
/home/matt/gdb-loop:2: Error in sourced command file:\nNo executable file specified.\nUse the "file" or "exec-file" command.
/home/matt/gdb-loop:2: Error in sourced command file:\nNo executable file specified.\nUse the "file" or "exec-file" command.

So it seems like the command for the program I am debugging gets overridden when I modify the GDB command file being used.

FYI: Running Eclipse Neon (4.6.0 build 20160613-1800) on Ubuntu 14.04.

Armali
  • 18,255
  • 14
  • 57
  • 171
McManip
  • 155
  • 1
  • 9

0 Answers0