Search code examples
cwindowsgdbcygwin

gdb: exit program without exiting gdb


I am debugging a program using gdb. First I load my executable, then I continue to run the program. I sometimes want to interrupt execution of my program, so I do Ctrl + C.

My problem is that this closes both my program and gdb. How can I exit my program without exiting gdb?


Solution

  • Looks like under Windows, you have to use Ctrl-Break not Ctrl-C. See this page.

    Excerpt:

    MS-Windows programs that call SetConsoleMode to switch off the special meaning of the `Ctrl-C' keystroke cannot be interrupted by typing C-c. For this reason, gdb on MS-Windows supports C- as an alternative interrupt key sequence, which can be used to interrupt the debuggee even if it ignores C-c.