* gdb.texinfo (directory command): Doc new dir command.
This commit is contained in:
parent
ab7d02afaa
commit
845dbc2a16
@ -1996,57 +1996,59 @@ this command with as little as @samp{rev}.
|
|||||||
|
|
||||||
@cindex source path
|
@cindex source path
|
||||||
@cindex directories for source files
|
@cindex directories for source files
|
||||||
Executable programs do not record the directories of the source files
|
Executable programs sometimes do not record the directories of the source files
|
||||||
from which they were compiled, just the names. GDB remembers a list of
|
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 remembers a list of
|
||||||
directories to search for source files; this is called the @dfn{source
|
directories to search for source files; this is called the @dfn{source
|
||||||
path}. Each time GDB wants a source file, it tries all the directories
|
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
|
in the list, in the order they are present in the list, until it finds a
|
||||||
file with the desired name. @b{Note that the executable search path is
|
file with the desired name. @b{Note that the executable search path is
|
||||||
@i{not} used for this purpose. Neither is the current working
|
@i{not} used for this purpose. Neither is the current working
|
||||||
directory, unless it happens to be in the source path.}
|
directory, unless it happens to be in the source path.}
|
||||||
|
|
||||||
|
If it can't find a source file in the source path, and the object program
|
||||||
|
records what directory it was compiled in, GDB tries that directory too.
|
||||||
|
If the source path is empty, and there is no record of the compilation
|
||||||
|
directory, GDB will, as a last resort, look in the current directory.
|
||||||
|
|
||||||
|
Whenever you reset or rearrange the source path, GDB will clear out
|
||||||
|
any information it has cached about where source files are found, where
|
||||||
|
each line is in the file, etc.
|
||||||
|
|
||||||
@kindex directory
|
@kindex directory
|
||||||
When you start GDB, its source path contains just the current working
|
When you start GDB, its source path is empty.
|
||||||
directory. To add other directories, use the @samp{directory} command.
|
To add other directories, use the @samp{directory} command.
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item directory @var{dirnames...}
|
@item directory @var{dirnames...}
|
||||||
Add directory @var{dirname} to the end of the source path. Several
|
Add directory @var{dirname} to the front of the source path. Several
|
||||||
directory names may be given to this command, separated by whitespace or
|
directory names may be given to this command, separated by whitespace or
|
||||||
@samp{:}.
|
@samp{:}. If a name is already in the source path, it is moved to the
|
||||||
|
front of the path, so it will be searched sooner.
|
||||||
|
|
||||||
@item directory
|
@item directory
|
||||||
Reset the source path to just the current working directory of GDB.
|
Reset the source path to empty again. This requires confirmation.
|
||||||
This requires confirmation.
|
|
||||||
|
|
||||||
Since this command deletes directories from the search path, it may
|
|
||||||
change the directory in which a previously read source file will be
|
|
||||||
discovered. To make this work correctly, this command also clears out
|
|
||||||
the tables GDB maintains about the source files it has already found.
|
|
||||||
|
|
||||||
@item info directories
|
@item info directories
|
||||||
@kindex info directories
|
@kindex info directories
|
||||||
Print the source path: show which directories it contains.
|
Print the source path: show which directories it contains.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Because the @samp{directory} command adds to the end of the source path,
|
Because the @samp{directory} command adds to the front of the source path,
|
||||||
it does not affect any file that GDB has already found. If the source
|
it can affect files that GDB has already found. If the source
|
||||||
path contains directories that you do not want, and these directories
|
path contains directories that you do not want, and these directories
|
||||||
contain misleading files with names matching your source files, the
|
contain misleading files with names matching your source files, the
|
||||||
way to correct the situation is as follows:
|
way to correct the situation is as follows:
|
||||||
|
|
||||||
@enumerate
|
@enumerate
|
||||||
@item
|
@item
|
||||||
Choose the directory you want at the beginning of the source path.
|
Use @samp{directory} with no argument to reset the source path to empty.
|
||||||
Use the @samp{cd} command to make that the current working directory.
|
|
||||||
|
|
||||||
@item
|
|
||||||
Use @samp{directory} with no argument to reset the source path to just
|
|
||||||
that directory.
|
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Use @samp{directory} with suitable arguments to add any other
|
Use @samp{directory} with suitable arguments to add any other
|
||||||
directories you want in the source path.
|
directories you want in the source path. You can add all the directories
|
||||||
|
in one command.
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
@node Data, Symbols, Source, Top
|
@node Data, Symbols, Source, Top
|
||||||
|
Loading…
Reference in New Issue
Block a user