Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)

NOTE: Use caution if you disable all signals from certain processes. Disabling 'SIGTRAP' in
your program may cause your program to hang.
HP-UX uses 'SIGTRAP' to communicate with the debugger. If you disable all signals from certain
processes so that signals will be delivered to the right process, your program may hang when you
try to debug it. This behavior occurs because if you disable 'SIGTRAP', the debugger no longer
receives notification of events such as breakpoint hits and loading or unloading of shared libraries.
To prevent this problem:
Make certain you set this flag:
(gdb) set complain-if-sigtrap-disabled on
Also make certain the following warning was not emitted by the debugger before your program
hung:
Warning: Thread %d (in process %d) has disabled SIGTRAPs.
Debugging this thread is probably impossible.
If you do not want to see this message again, use:
"set complain-if-sigtrap-disabled 0"
info signals, info handle Print a table of all the kinds of signals and how GDB has
been told to handle each one. You can use this to see the
signal numbers of all the defined types of signals.
info handle is an alias for info signals.
set
ignore-uninteresting-signals
[on|off]
The debugger does not deliver the silent signals to the
program when ignore-uninteresting-signals is
switched on. The default option is on.
show
ignore-uninteresting-signals
Display the current status of set
ignore-uninteresting-signals command.
handle signal keywords... Change the way GDB handles signal signal. signal
can be the number of a signal or its name (with or without
the 'SIG' at the beginning). The keywords say what
change to make.
The keywords allowed by the handle command can be abbreviated. Their full names are:
nostop GDB should not stop your program when this signal happens. It may still print a
message telling you that the signal has come in.
stop GDB should stop your program when this signal happens. This implies the print
keyword as well.
print GDB should print a message when this signal happens.
noprint GDB should not mention the occurrence of the signal at all. This implies the nostop
keyword as well.
pass GDB should allow your program to see this signal; your program can handle the
signal, or else it may terminate if the signal is fatal and not handled.
nopass GDB should not allow your program to see this signal.
When a signal stops your program, the signal is not visible to the program until you continue. Your
program sees the signal then, if pass is in effect for the signal in question at that time. In other
words, after GDB reports a signal, you can use the handle command with pass or nopass to
control whether your program sees that signal when you continue.
You can also use the signal command to prevent your program from seeing a signal, or cause
it to see a signal it normally would not see, or to give it any signal at any time. For example, if
your program stopped due to some sort of memory reference error, you might store correct values
5.3 Signals 51