User`s guide

Changing Source Files
15
If you use the use command instead, the current directory is no longer
contained in the source directory list:
(dbx) use /usr/local/src
(dbx) use
/usr/local/src
Using Path Remapping
Files compiled with g have full pathnames to source files. If you’re
debugging a program that was compiled somewhere else and you want to
specify a new path to the sources, use path remapping. Just substitute one
pattern for another pattern to remap the path so dbx can find the source file.
dir pattern1:pattern2
The dir (or use) command allows you to remap directories
and specify a new path to the source. dbx substitutes
pattern2 for pattern1.
For example, a compiled program’s source is /x/y/z/kk.c. The source was
moved to /x/y/zzz/kk/kk.c. Specify the dir (or use) command to remap the path:
(dbx) dir /z/:/zzz/kk/
The new path is /x/y/zzz/kk/kk.c where /z/ is replaced by the path specified
after the colon.
Changing Source Files
The file command changes the current source file to a file that you specify.
The new file becomes the current source file, on which you can search, list,
and perform other operations. For example, to set the current source file to
“Examining the Stack” on page 54procedure.c, enter:
(dbx) file procedure.c
Note: If your program is large, typically you store the source code in
multiple files. dbx automatically selects the proper source file for the section
of code that you are examining. Thus, manydbx commands reset the current
source file as a side effect. For example, when you move up and down
activation levels in the stack using the up and down commands, dbx changes