6

Is there a way to exit from gdb connnection without stopping / exiting running program ? I need that running program continues after gdb connection closed.

RedArrow
  • 588
  • 8
  • 18

2 Answers2

6

Is there a way to exit from gdb connnection without stopping / exiting running program ?

(gdb) help detach
Detach a process or file previously attached.
If a process, it is no longer traced, and it continues its execution.  If
you were debugging a file, the file is closed and gdb no longer accesses it.

List of detach subcommands:

detach checkpoint -- Detach from a checkpoint (experimental)
detach inferiors -- Detach from inferior ID (or list of IDS)

Type "help detach" followed by detach subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
0

Since the accepted (only other) answer does not specifically address how to shut down gdb without stopping the program under test, I'm throwing my hat into the ring.

Option 1

Kill the server from the terminal in which it's running by holding Ctrl+c.

Option 2

Kill the gdb server and/or client from another terminal session.

$ ps -u username | grep gdb
 667511 pts/6    00:00:00 gdbserver
 667587 pts/7    00:00:00 gdbclient
$ kill 667587
$ kill 667511

These options are for a Linux environment. A similar approach (killing the process) would probably also work in Windows.

Jim Fell
  • 13,750
  • 36
  • 127
  • 202