Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
$ gdb | tee log1
Quitting GDB
quit [expression],
q
To exit GDB, use the quit command (abbreviated q), or type an
end-of-file character (usually C-d). If you do not supply expression,
GDB will terminate normally; otherwise it will terminate using the result
of expression as the error code.
An interrupt (often C-c) does not exit from GDB, but rather terminates the action of any GDB
command that is in progress and returns to GDB command level. It is safe to type the interrupt
character at any time because GDB does not allow it to take effect until a time when it is safe.
You can use the detach command to release an attached process or device.
Shell commands
If you need to execute occasional shell commands during your debugging session, there is no need
to leave or suspend GDB; you can just use the shell command.
shell command string Invoke a standard shell to execute command string. If it exists, the
environment variable SHELL determines which shell to run.
Otherwise GDB uses the default shell ('/bin/sh' on UNIX systems,
'COMMAND.COM' on MS-DOS, and so on.).
The utility make is often needed in development environments. You do not have to use the shell
command for this purpose in GDB:
make make-args Execute the make program with the specified arguments. This is equivalent
to 'shell make make-args'.
Quitting GDB 23