Debugging with GDB (September 2007)

120 Debugging with GDB
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.
1. Make certain the files were compiled with the ’-g’ switch. Typ e 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 lo ok 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.
14.7 Fix and continue debugging
Fix and continue enables you to see the result of changes you make to a program you
are debugging without having to re-compile and re-link the entire program.
For example, you can edit a function and use the fix command, which automatically
re-compiles the code, links it into a shared library, and continues execution of the program,
without leaving the debugger.
With Fix and Continue, you can experiment with various ways of fixing problems until
you are satisfied with the correction, b e fore you exit the debugger.
The advantages include:
You do not have to recompile and relink the entire program.
You do not have to reload the program into the debugger.
You can resume execution of the program from the fix location.
You can speed up the development cycle.
Note: