Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)

+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 offset lines before the last line printed.
filename:number Specifies line number in the source file filename.
function Specifies the line that begins the body of the function function. For
example: in C, this is the line with the open brace.
filename:function Specifies the line of the open-brace 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.
*address Specifies the line containing the program address address. address
may be any expression.
7.2 Searching source files
There are two commands for searching through the current source file for a regular expression.
forward-search regexp,
search regexp
The command 'forward-search regexp' checks each line,
starting with one of the following in the last line listed, for a
match of the regexp. It lists the line that is found. You can use
the synonym 'search regexp' or abbreviate the command
name as fo.
reverse-search regexp The command 'reverse-search regexp' checks each line,
starting with the one before the last line listed and going
backward, for a match for the regexp. It lists the line(s) that is
found. You can abbreviate this command as rev.
7.3 Specifying source directories
Executable programs sometimes do not record the directories of the source files from which they
were compiled. Even when they do, the directories can be moved between the compilation and
your debugging session. GDB has a list of directories to search for source files; this is called the
source path. Each time GDB looks for a source file, it tries all the directories in the list, in the order
they are present in the list, until it finds a file with the desired name. Note that the executable
search path is not used for this purpose. Neither is the current working directory, unless it happens
to be in the source path.
If GDB cannot find a source file in the source path, and the object program records a directory,
GDB tries that directory too. If the source path is empty, and there is no record of the compilation
directory, GDB looks in the current directory as a last resort.
Whenever you reset or rearrange the source path, GDB clears out any information it has cached
about where the source files are located and where each line is in the respective file.
When you start GDB, its source path includes only 'cdir' and 'cwd', in that order.
To add other directories, you can use the directory command.
directory dirname ...,
dir dirname ...
Add directory dirname to the front of the source path. Several
directory names may be given to this command, separated by
':' (';' on MS-DOS and MS-Windows, where ':' usually appears
as part of absolute file names) or a whitespace. You can specify
a directory that is already in the source path; this moves it
forward, so GDB searches it sooner.
You can use the string '$cdir' to refer to the compilation
directory (if one is recorded), and '$cwd' to refer to the current
60 Examining Source Files