Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
show objectdir Display the current search path for finding object files. By
default it is $cdir:$cwd. Where the variables $cwd and
$cdir have following information:
$cwd contains the path of Current Working Directory. $cdir
contains the path of the Compilation Directory of the source
file.
pathmap Enables you to define a list of substitution rules to be
applied to path names to identify object files and the
corresponding source files. The pathmap command,
however, may not find source files if the object files are not
available.
This minimizes or eliminates the need to specify multiple
objectdir commands when object files are moved from
the compilation directories or when compilation directories
are mounted over NFS.
To use this feature, the program must be compiled with the
+objdebug option. For information on how pathmap
works type help pathmap at the HP WDB prompt.
If the debugger cannot find the source files, perform the following steps:
1. Make certain the files were compiled with the -g switch. Type info sources to find
the list of files that the debugger knows were compiled with -g.
2. Make certain that the debugger can find the source file. Type show dir to find the
list of directories the debugger uses to search for source files and type set dir to
change that path.
On HP-UX, the debug information does not contain the full path name to the source
file, only the relative path name that was recorded at compile time. Consequently,
you may need several dir commands for a complex application with multiple source
directories. One way to do this is to place them in a .gdbinit file placed in the
directory used to debug the application.
A sample of the .gdbinit file might look like the following:
dir /home/fred/appx/system
dir /home/fred/appx/display
dir /home/fred/appx/actor
dir /home/fred/appx/actor/sys
...
When you compile the program with the +objdebug option, the debugger may
find the source files without using the dir command. This happens because the
debugger stores the full path name to the object files and searches for source files
in the same directories.
138 HP-UX Configuration-Specific Information