Debugging Core Files Using HP WDB

What is a Symbol Table?
A symbol table is a set of records that define the set of visible and important symbols in a program.
These symbols are stored in the program. Each (unstripped) program has an associated symbol
table.
The nm command displays the symbol information for a specified object file.
Example 4 illustrates how to view symbol information for an object file by using the nm command
for an object file, on an HP 9000 system.
Example 4 Viewing Symbol Information by Using the nm Command
This example illustrates the use of the nm command to display the symbol information for the
common linker and debugger symbols, Cerrno and Cselectdraw, on an HP 9000 system:
$ nm -x Cscreen_selection.o |grep Cerrno
Cerrno | |undef |data |
$ nm -x Cscreen_selection.o |grep Cselectdraw
Cselectdraw |0x00001178|extern|entry |$CODE$
The output of the nm command illustrates that the symbol, Cerrno is an undefined data symbol
and that the symbol, Cselectdraw is a function that is a code entry point.
Alternately, you can use odump -slexport, elfdump -n, or dynsym -s, instead of nm to
view the symbol definition for stripped binaries.
The dynamic symbols are not removed with the strip command. The strip -l command
only strips the line number tables.
What is a Stripped Binary?
The strip command removes the symbol table, debug information, and line number information
from the object file, including the archives. Thereafter, no symbolic debugging access is available
for the stripped object file.
The strip -l strips only the line table information, and the symbolic debugging access continues
to be available.
For more information on the strip command, see strip(1)
Stripped executables or shared libraries can also be built by using the -s compiler or linker
option.
In HP 9000 systems, the file command displays whether an executable is stripped or not.
The following example illustrates the use of the file command before and after a strip
operation:
$ file a
a: PA-RISC1.1 shared executable dynamically linked -not stripped
$ strip a
$ file a
a: PA-RISC1.1 shared executable dynamically linked
In Integrity systems, you must use the nm to display whether the binary is stripped or not. The
output from the nm command displays 'no symbols' for a stripped binary on Integrity systems.
Debugging Core Files Created by Stripped Binaries (When the Symbol Table is
Available)
You can debug a core file that is created by a stripped binary effectively, if the symbol table for
the unstripped version of the program (before the program is stripped) is available.
Alternately, you can also debug the core file that is created by a stripped program if the symbol
table is available from another program, which functionally uses the same symbols, but has a
different link order.
20