Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
3. the current stack frame summary for that
thread
4. the priority of a thread
An asterisk '*' to the left of the GDB thread
number indicates the current thread.
For example,
((gdb)) info threads
* 3 system thread 26607 worker
(wptr=0x7b09c318 "@") \
at quicksort.c:137
2 system thread 26606 0x7b0030d8 in
__ksleep () \
from /usr/lib/libc.2
1 system thread 27905 0x7b003498 in _brk
() \
from /usr/lib/libc.2
thread threadno Make thread number threadno the current
thread. The command argument threadno is the
internal GDB thread number, as shown in the first
field of the 'info threads' display. GDB
responds by displaying the system identifier of the
thread you selected, and its current stack frame
summary:
((gdb)) thread 2
[Switching to thread 2 (system thread
26594)]
0x34e5 in sigpause ()
As with the '[New ...]' message, the form of
the text after 'Switching to' depends on your
system's conventions for identifying threads.
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.
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.
4.9 Debugging programs with multiple threads 43