Debugging with GDB (September 2007)
106 Debugging with GDB
info share
info sharedlibrary
Print the names of the shared libraries which are currently loaded.
sharedlibrary regex
share regex
Load shared object library symbols for files matching a Unix regular expression.
As with files loaded automatically, it only loads shared libraries required by your
program for a core file or after typing run. If regex is omitted all shared libraries
required by your program are loaded.
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, sym-
bols 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.
12.2 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 w ith 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 spe cified 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.