Table of Contents1. Debugging with gdb ........................................................................................................................ 12. Summary of gdb.............................................................................................................................. 32.1. Free software...................................................................................................................... 32.2. Free Software Needs Free Documentation ........................................................................ 32.3. Contributors to gdb ............................................................................................................ 43. A Sample gdb Session ..................................................................................................................... 74. Getting In and Out of gdb ............................................................................................................ 114.1. Invoking gdb .................................................................................................................... 114.1.1. Choosing files ................................................................................................... 124.1.2. Choosing modes................................................................................................ 134.2. Quitting gdb ..................................................................................................................... 164.3. Shell commands ............................................................................................................... 164.4. Logging output................................................................................................................. 165. gdb Commands ............................................................................................................................. 195.1. Command syntax ............................................................................................................. 195.2. Command completion...................................................................................................... 195.3. Getting help...................................................................................................................... 216. Running Programs Under gdb .................................................................................................... 256.1. Compiling for debugging ................................................................................................. 256.2. Starting your program ...................................................................................................... 256.3. Your program’s arguments ............................................................................................... 266.4. Your program’s environment ........................................................................................... 276.5. Your program’s working directory................................................................................... 286.6. Your program’s input and output ..................................................................................... 286.7. Debugging an already-running process ........................................................................... 296.8. Killing the child process .................................................................................................. 296.9. Debugging programs with multiple threads..................................................................... 306.10. Debugging programs with multiple processes ............................................................... 327. Stopping and Continuing ............................................................................................................. 357.1. Breakpoints, watchpoints, and catchpoints...................................................................... 357.1.1. Setting breakpoints............................................................................................ 357.1.2. Setting watchpoints........................................................................................... 387.1.3. Setting catchpoints ............................................................................................ 407.1.4. Deleting breakpoints ......................................................................................... 417.1.5. Disabling breakpoints ....................................................................................... 427.1.6. Break conditions ............................................................................................... 437.1.7. Breakpoint command lists................................................................................. 447.1.8. Breakpoint menus ............................................................................................. 457.1.9. "Cannot insert breakpoints" .............................................................................. 467.2. Continuing and stepping .................................................................................................. 467.3. Signals.............................................................................................................................. 497.4. Stopping and starting multi-thread programs .................................................................. 518. Examining the Stack ..................................................................................................................... 538.1. Stack frames..................................................................................................................... 538.2. Backtraces ........................................................................................................................ 548.3. Selecting a frame.............................................................................................................. 558.4. Information about a frame ............................................................................................... 56