(ddd.info)Source Path


Prev: Looking up Previous Locations Up: Looking up Items
Enter node , (file) or (file)node

4.3.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.

   Here's how GDB accesses source files; other inferior debuggers have
similar methods.

   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.

   To specify a source path for your inferior debugger, use `Edit =>
Debugger Settings' (Note: Debugger Settings and search for
appropriate entries (in GDB, this is `Search path for source files').

   If `Debugger Settings' has no suitable entry, you can also specify a
source path for the inferior debugger when invoking DDD.  Note:
Inferior Debugger Options, for details.

   When using JDB, you can set the `CLASSPATH' environment variable to
specify directories where JDB (and DDD) should search for classes.

   If DDD does not find a source file for any reason, check the
following issues:

   * In order to debug a program effectively, you need to generate
     debugging information when you compile it.  Without debugging
     information, the inferior debugger will be unable to locate the
     source code. To request debugging information, specify the `-g'
     option when you run the compiler.  Note: Compiling for
     Debugging, for details.

   * You may need to tell your inferior debugger where the source code
     files are.  Note: Source Path, for details.

     Using GDB, you can also create a local `.gdbinit' file that
     contains a line `directory PATH'.  Here, PATH is a colon-separated
     list of source paths.


automatically generated by info2www version 1.2.2.9