HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 59 (of 101)
Chapter 11 Software Development
October 29, 2013
(gdb) c
Continuing.
Hello World!
Program exited with code 013.
warning: Temporarily disabling shared library breakpoints:
warning: breakpoint #2
(gdb) quit
$
After continuing, the program it exits as before. We leave gdb by typing quit or simply q.
When debugging a program that died on another system, it is not sufficient to take program and
core file and start debugging. You must make sure that the debugger uses the same versions of
the shared libraries as at program runtime. When using the wrong library versions, the debugger
will print incorrect information.
To find out which libraries were used and in which version, you can either login there and use
ldd and check their versions with what, or you can check the what string of the core file. It
contains the what strings of all used libraries, but it can be difficult to determine which what
string belongs to which library.
All these libraries should be available on your system. You can either put them into their original
locations which normally means that you must remove the currently used versions and possibly
downgrade your runtime libraries, or you can put them into a dedicated directory and tell gdb(1)
to pick the libs from there. The environment variable GDB_SHLIB_PATH is used for that purpose.
If possible, debug a core file on the system where it was generated. If all else fails, newer gdb
versions (5.4 and higher) know the packcore and unpackcore commands. Use packcore on the
system where the core file was written, to create a packcore.tar.Z (default output name) file with
the executable and all shared libs in use by the process. Copy the packcore.tar.Z file to the
system where you want to debug, then use unpackcore before debugging, to extract the files.
coreadm(1M)
There are various reasons that might cause difficulties with the creation of core files, such as lack
of disk space, permission problems etc. Many problems result from the fact that per default all
core files are stored as $PWD/core. There is no way to define where and under which name the
core file should be stored.
To overcome this limitation, HP-UX 11.31 introduces the command coreadm(1M). It allows
setting various core file related attributes like path and exact name, including process specific
info. These settings can be applied globally for all processes, or on a per-user or per-process
basis.