gdb, the Debugging Tool

Red Hat Enterprise Linux 3: Developer Tools Guide
Prev | Chapter 2. Basic Principles of the Tools | Next

# 2.9. gdb, the Debugging Tool

GDB, the GNU debugger, has the principal purpose of allowing you to stop your program before it terminates. If your program terminates, the debugger helps you determine where it failed. To debug a file named ``file`.c`, first compile the file using `gcc -g `file`.c` as a command, where `-g` produces the debugging information. You then run the debugger. Refer to Section 3.4 Debug the Executable, for the steps involved in debugging.

Set breakpoints with the `breakpoint` command.

Navigate through the program with the `step` command or the `next` command.

The debugger debugs threads, signals, trace information, and other data in a program. Each time your program performs a function call, a block of data (the stack frame), which shows the location of the call, the arguments, and the local variables of the function is generated. The debugger allows you to examine the stack frame to get your program to work.

For more information, refer to Debugging with GDB.

Prev | Home | Next
`gcov`, the Test Coverage Tool | Up | make, the GNU Recompiling Tool