Datasheet

Book VIII
Chapter 1
Programming
in Linux
545
Exploring the Software-Development Tools in Linux
To quit gdb, type q and then press Enter.
gdb has a large number of commands, but you need only a few to find the
cause of an error quickly. Table 1-4 lists the commonly used gdb commands.
Table 1-4 Common gdb Commands
This Command Does the Following
break NUM
Sets a breakpoint at the specified line
number, NUM. (The debugger stops at
breakpoints.)
bt
Displays a trace of all stack frames. (This
command shows you the sequence of func-
tion calls so far.)
clear FILENAME: NUM
Deletes the breakpoint at a specific
line number, NUM, in the source file
FILENAME. For example, clear
xdraw.c:8 clears the breakpoint at line 8
of file xdraw.c.
continue
Continues running the program being
debugged. (Use this command after the pro-
gram stops due to a signal or breakpoint.)
display EXPR Displays the value of an expression, EXPR
(consisting of variables defined in the pro-
gram) each time the program stops.
file FILE Loads the specified executable file, FILE,
for debugging.
help NAME
Displays help on the command named
NAME.
info break
Displays a list of current breakpoints,
including information on how many times
each breakpoint is reached.
info files
Displays detailed information about the file
being debugged.
info func
Displays all function names.
info local
Displays information about local variables
of the current function.
info prog
Displays the execution status of the pro-
gram being debugged.
(continued)
42_770191-bk08ch01.indd 54542_770191-bk08ch01.indd 545 8/6/10 9:51 AM8/6/10 9:51 AM