Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
On HP-UX systems, GDB detects the loading of a shared library and automatically reads in symbols
from the newly loaded library, up to a threshold that is initially set but that you can modify if you
wish.
Beyond that threshold, symbols from shared libraries must be explicitly loaded. To load these
symbols, use the command sharedlibrary filename. The base address of the shared library
is determined automatically by GDB and need not be specified.
To display or set the threshold, use the commands:
set auto-solib-add
threshold
Set the autoloading size threshold, in megabytes. If
threshold is nonzero, symbols from all shared object
libraries will be loaded automatically when the inferior
begins execution or when the dynamic linker informs GDB
that a new library has been loaded, until the symbol table
of the program and libraries exceeds this threshold.
Otherwise, symbols must be loaded manually, using the
sharedlibrary command. The default threshold is 100
megabytes.
show auto-solib-add Display the current autoloading size threshold, in megabytes.
set stop-on-solib-events This command controls whether GDB should give you control
when the dynamic linker notifies it about some shared library
event. The most common event of interest is loading or
unloading of a new shared library.
show stop-on-solib-events Display the status of stopping for shared library events.
Specifying shared library locations
On HP-UX, when the shared libraries your program uses are in a different directory than the path
specified in the source or object files, specify the correct files to use with one of two environment
variables.
`GDB_SHLIB_PATH' Set this variable to a colon-separated list of directory path names where
the desired shared libraries reside. GDB searches specified list of
directories for shared libraries before searching the default system
directories.
`GDB_SHLIB_ROOT' Set this variable to point to the root of the library in which the desired
libraries reside.
NOTE: If you set both the `GDB_SHLIB_PATH' and `GDB_SHLIB_ROOT' environment variables,
the `GDB_SHLIB_PATH' behavior overrides `GDB_SHLIB_ROOT'.
These environment variables are useful when you are analyzing core files on a system other than
the one that produced the core file.
For example, if you want GDB to search for libraries in /home/debugger/lib and /tmp/lib
before searching the default system directories for libraries, you can use this setting:
GDB_SHLIB_PATH=/home/debugger/lib:/tmp/lib
With this setting, GDB searches the directories in the order specified until it finds a library with the
correct name.
In this example, if GDB encounters a library by the name of /usr/lib/libsubs.sl, GDB
searches first for /home/debugger/lib/libsubs.sl and then for /tmp/lib/libsubs.sl.
If neither of these exists, then GDB searches the default system directories and finds /usr/lib/
libsubs.sl.
In most cases, GDB_SHLIB_PATH allows more flexibility than GDB_SHLIB_ROOT' because it
allows you to specify more than one path. However, there are some cases in which you may want
to choose to use GDB_SHLIB_ROOT.
Specifying shared library locations 91