
Examining Source Files
Motorola
GNU Debugger (GDB)
For More Information On This Product,
Go to: www.freescale.com
D-31
Table D-12 shows the forms of the ‘list’ command most commonly used:
Table D-13 shows the ways of specifying a single source line--all the kinds of linespec.
Table D-12. List Commands
Command
Description
list linenum
Print ten lines centered around line number linenum in the current source file.
list function
Print ten lines centered around the beginning of function function.
list
Print ten more lines. If the last lines printed were printed with a ‘list’ command, this prints
ten lines following the last lines printed; however, if the last line printed was a solitary line
printed as part of displaying a stack frame (see section Stack), this prints ten lines
centered around that line.
list -
Print ten lines just before the lines last printed.Repeating a ‘list’ command with RET
discards the argument, so it is equivalent to typing just ‘list’. This is more useful than
listing the same lines again. An exception is made for an argument of ‘-’; that argument is
preserved in repetition so that each repetition moves up in the file.In general, the ‘list’
command expects you to supply zero, one or two linespecs. Linespecs specify source
lines; there are several ways of writing them but the effect is always to specify some
source line. Here is a complete description of the possible arguments for ‘list’:
list linespec
Print ten lines centered around the line specified by linespec.
list first,last
Print lines from first to last. Both arguments are linespecs.
list ,last
Print ten lines ending with last.
list first,
Print ten lines starting with first.
list +
Print ten lines just after the lines last printed.
list -
Print ten lines just before the lines last printed.
list
As described in the preceding table.
Table D-13. Single Source Line Commands
Command
Description
linenum
Specifies line linenum of the current source file. When a ‘list’ command has two
linespecs, this refers to the same source file as the first linespec.
+offset
Specifies the line offset lines after the last line printed. When used as the second
linespec in a ‘list’ command that has two, this specifies the line offset lines down
from the first linespec.
-offset
Specifies the line offsetlines before the last line printed.
filename:linenum
Specifies line linenum in the source file filename
function
Specifies the line of the open-brace that begins the body of the function function.
F
Freescale Semiconductor, Inc.
n
.