2 Getting In and Out of GDB
This chapter discusses how to start GDB, and exit out of it. The essentials are:
•type '(gdb)' to start GDB.
•type quit or
2.1Invoking GDB
Invoke GDB by running the program (gdb). Once started, GDB reads commands from the terminal until you tell it to exit.
You can also run (gdb) with a variety of arguments and options, to specify more of your debugging environment at the outset.
The
The most usual way to start GDB is with one argument, specifying an executable program:
(gdb) program
You can also start with both an executable program and a core file specified:
(gdb) program core
You can, instead, specify a process ID as a second argument, if you want to debug a running process:
(gdb) program 1234
would attach GDB to process 1234 (unless you also have a file named '1234'; GDB does check for a core file first).
Taking advantage of the second
You can run (gdb) without printing the front material, which describes GDB's
gdb
You can further control how GDB starts up by using
Type
(gdb)
to display all available options and briefly describe their use
2.1 Invoking GDB 25