Several gdb commands accept arguments that specify a location of your program's code. Since gdb is a source-level debugger, a location usually specifies some line in the source code; for that reason, locations are also known as linespecs.
Here are all the different ways of specifying a code location that gdb understands:
-
offset+
offsetlist
command, the current line is the last one
printed; for the breakpoint commands, this is the line at which
execution stopped in the currently selected stack frame
(see Frames, for a description of stack frames.) When
used as the second of the two linespecs in a list
command,
this specifies the line offset lines up or down from the first
linespec.
:
linenum:
label:
function*
addresslist
and edit
, this specifies a source
line that contains address. For break
and other
breakpoint oriented commands, this can be used to set breakpoints in
parts of your program which do not have debugging information or
source files.
Here address may be any expression valid in the current working language (see working language) that specifies a code address. In addition, as a convenience, gdb extends the semantics of expressions used in locations to cover the situations that frequently happen during debugging. Here are the various forms of address:
&
function. In Ada, this is function'Address
(although the Pascal form also works).
This form specifies the address of the function's first instruction,
before the stack frame and arguments have been set up.
'
filename':
funcaddr-pstap|-probe-stap
[objfile:
[provider:
]]nameSystemTap
provides a way for
applications to embed static probes. See Static Probe Points, for more
information on finding and using static probes. This form of linespec
specifies the location of such a static probe.
If objfile is given, only probes coming from that shared library or executable matching objfile as a regular expression are considered. If provider is given, then only probes from that provider are considered. If several probes match the spec, gdb will insert a breakpoint at each one of those probes.