Explicit locations allow the user to directly specify the source location's parameters using option-value pairs.
Explicit locations are useful when several functions, labels, or file names have the same name (base name for files) in the program's sources. In these cases, explicit locations point to the source line you meant more accurately and unambiguously. Also, using explicit locations might be faster in large programs.
For example, the linespec ‘foo:bar’ may refer to a function bar
defined in the file named foo or the label bar
in a function
named foo
. gdb must search either the file system or
the symbol table to know.
The list of valid explicit location options is summarized in the following table:
-source
filename-function
or -line
.
-function
function-label
or -line
) refer to the line that begins the body of the function.
In C, for example, this is the line with the open brace.
-label
label-line
number-line 3
) or relative (-line +3
), depending on
the command. When specified without any other options, the line offset is
relative to the current line.
Explicit location options may be abbreviated by omitting any non-unique
trailing characters from the option name, e.g., break -s main.c -li 3
.