Debugging threads with HP Wilde Beest
thread apply [threadno] [all] args
The thread apply command allows you to apply a command to one or more threads.
Specify the numbers of the threads that you want affected with the command argument
threadno. The threadno is the internal GDB thread number, as shown in the first
field of the info threads display. To apply a command to all threads, use thread
apply all args.
Whenever GDB stops your program, due to a breakpoint or a signal, it automatically
selects the thread where that breakpoint or signal happened. GDB alerts you to the
context switch with a message of the form [Switching to systag] to identify the
thread.
NOTE: On HP-UX 11.x, debugging a multi-thread process can cause a deadlock if
the process is waiting for an NFS-server response. A thread can be stopped while asleep
in this state, and NFS holds a lock on the rnode while asleep.
To prevent the thread from being interrupted while holding the rnodelock, make the
NFS mount non-interruptible with the nointr flag. See mount(1).
On HP-UX systems, you can control the display of thread creation messages. Following
commands are used to control the display of thread creation:
set threadverbose on
Enable the output of informational messages regarding thread creation. The default
setting is on. You can set it to off to stop the display of messages.
set threadverbose off
Disable the output of informational messages regarding thread creation. The default
setting is on. You can set it to on to display messages.
show threadverbose
Display whether set threadverbose is on or off.
When your program has multiple threads, you can choose whether to set breakpoints
on all threads, or on a particular thread.
break linespec thread threadno
break linespec thread threadno if ...
linespec specifies source lines; there are several ways of writing them, but the effect
is always to specify some source line.
Use the qualifier thread threadno with a breakpoint command to specify that you
only want GDB to stop the program when a particular thread reaches this breakpoint.
threadno is one of the numeric thread identifiers assigned by GDB, shown in the first
column of the info threads display.
If you do not specify thread threadno when you set a breakpoint, the breakpoint
applies to all threads of your program.
16