gdb: Linespec Locations
9.2.1 Linespec Locations
------------------------
A "linespec" is a colon-separated list of source location parameters
such as file name, function name, etc. Here are all the different ways
of specifying a linespec:
'LINENUM'
Specifies the line number LINENUM of the current source file.
'-OFFSET'
'+OFFSET'
Specifies the line OFFSET lines before or after the "current line".
For the 'list' 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" (Frames
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.
'FILENAME:LINENUM'
Specifies the line LINENUM in the source file FILENAME. If
FILENAME is a relative file name, then it will match any source
file name with the same trailing components. For example, if
FILENAME is 'gcc/expr.c', then it will match source file name of
'/build/trunk/gcc/expr.c', but not '/build/trunk/libcpp/expr.c' or
'/build/trunk/gcc/x-expr.c'.
'FUNCTION'
Specifies the line that begins the body of the function FUNCTION.
For example, in C, this is the line with the open brace.
By default, in C++ and Ada, FUNCTION is interpreted as specifying
all functions named FUNCTION in all scopes. For C++, this means in
all namespaces and classes. For Ada, this means in all packages.
For example, assuming a program with C++ symbols named 'A::B::func'
and 'B::func', both commands 'break func' and 'break B::func' set a
breakpoint on both symbols.
Commands that accept a linespec let you override this with the
'-qualified' option. For example, 'break -qualified func' sets a
breakpoint on a free-function named 'func' ignoring any C++ class
methods and namespace functions called 'func'.
Explicit Locations.
'FUNCTION:LABEL'
Specifies the line where LABEL appears in FUNCTION.
'FILENAME:FUNCTION'
Specifies the line that begins the body of the function FUNCTION in
the file FILENAME. You only need the file name with a function
name to avoid ambiguity when there are identically named functions
in different source files.
'LABEL'
Specifies the line at which the label named LABEL appears in the
function corresponding to the currently selected stack frame. If
there is no current selected stack frame (for instance, if the
inferior is not running), then GDB will not search for a label.
'-pstap|-probe-stap [OBJFILE:[PROVIDER:]]NAME'
The GNU/Linux tool 'SystemTap' provides a way for applications to
embed static probes. 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.