Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
To perform command line calls after attaching a running process to GDB, you must execute one
of the following commands:
• /opt/langtools/bin/pxdb -s on <executable>
• chatr +dbg enable <executable>
Additional support for command line calls in a stripped executable
HP WDB enables you to perform command line calls in a stripped executable. The various scenarios
in which you can make command line calls in a stripped executable are as follows:
For 32-bit applications:
To perform command line calls in a shared library, without the help of dynamic linker (using
end.o), you must perform the following operations:
• Execute the chatr -B immediate <executable> command.
• Modify all the calls to shl_load() to specify BIND_IMMEDIATE, if any.
To perform command line calls after attaching GDB to a running process, without the help of
dynamic linker (using end.o), you must do the following for the program:
• Execute the chatr -B immediate <executable> command
• Modify all the calls to shl_load() to specify BIND_IMMEDIATE, if any.
• Execute the /opt/langtools/bin/pxdb -s on <executable> or chatr +dbg
enable <executable> command.
On HP-UX 11i v3 Integrity systems, HP WDB enables automatic debugging of shared libraries
without them being mapped private while attaching to a running program. For enabling
automatic debugging of shared libraries, you must install the kernel patches PHKL_38651
and PHKL_38778.
To avoid changing of the run-time binding behavior of a program to BIND_IMMEDIATE, to perform
command line call, do the following:
• Use the linker option, +ea, to export symbols from an object file.
• Install the linker patch, PHSS 28870 (for 11.0) or PHSS 28871 (for 11i).
• Execute the following commands:
cc -c file.c cc file.o -Wl,+ea,/opt/langtools/lib/end.o -s
For 64-bit applications
To perform command line calls in a stripped executable, linked with end.o, you need to do the
following:
• In the +std link mode, GDB supports this feature without any changes. You must export the
__wdb_call_dummy symbol as shown in the next line.
• In the +compat link mode, execute the following command:
cc +DD64-g file.c -Wl,+ee,__wdb_call_dummy -s
Support for debugging stripped binaries
HP WDB provides limited support for debugging stripped binaries.
Printing of locals and globals in a stripped module
GDB will not be able to print the locals and statics declared in a module which has been stripped.
GDB will be able to print the exported symbols since exported symbols are not stripped with strip
command (they stay in .dynsym).
182 HP-UX Configuration-Specific Information