Specifying Source Directories - Red Hat ENTERPRISE LINUX 3 - DEBUGGING WITH GDB Manual

Debugging with gdb
Hide thumbs Also See for ENTERPRISE LINUX 3 - DEBUGGING WITH GDB:
Table of Contents

Advertisement

62
forward-search
regexp
search
regexp
The command
forward-search
last line listed, for a match for
search
regexp
reverse-search
regexp
The command
reverse-search
line listed and going backward, for a match for
abbreviate this command as

9.4. Specifying source directories

Executable programs sometimes do not record the directories of the source files from which they were
compiled, just the names. Even when they do, the directories could 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 wants 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 source files are found and where each line is in the file.
When you start gdb, its source path includes only
use the
command.
directory
directory
dirname
dir
...
dirname
Add directory
dirname
this command, separated by
of absolute file names) or whitespace. You may specify a directory that is already in the source
path; this moves it forward, so gdb searches it sooner.
You can use the string
to refer to the current working directory.
working directory as it changes during your gdb session, while the latter is immediately expanded
to the current directory at the time you add an entry to the source path.
directory
Reset the source path to empty again. This requires confirmation.
show directories
Print the source path: show which directories it contains.
If your source path is cluttered with directories that are no longer of interest, gdb may sometimes
cause confusion by finding the wrong versions of source. You can correct the situation as follows:
1. Use
directory
2. Use
directory
You can add all the directories in one command.
regexp
regexp
or abbreviate the command name as
regexp
.
rev
...
to the front of the source path. Several directory names may be given to
(
on MS-DOS and MS-Windows, where
:
;
to refer to the compilation directory (if one is recorded), and
$cdir
with no argument to reset the source path to empty.
with suitable arguments to reinstall the directories you want in the source path.
Chapter 9. Examining Source Files
checks each line, starting with the one following the
. It lists the line that is found. You can use the synonym
.
fo
checks each line, starting with the one before the last
. It lists the line that is found. You can
regexp
and
, in that order. To add other directories,
cdir
cwd
is not the same as
$cwd
usually appears as part
:
--the former tracks the current
.
$cwd

Advertisement

Table of Contents
loading

Table of Contents