Debugging threads with HP Wilde Beest
The backtrace_other_thread command prints the backtrace of all stack frames
for a thread with stack pointer SP, program counter PCand address of gr32 in the
backing storeBSP. This command enables you to view the stack trace when the stack
is corrupted. When using this command, you must ensure that the SP,PC , and BSP
values are valid.
The syntax for the backtrace_other_thread command is as follows:
backtrace_other_thread SP PC BSP
For PA RISC systems, the command is as follows:
backtrace_other_thread SP PC
This command prints backtrace of all stack frames for a thread with stack pointer SP
and program counter PC.
Debugging programs with multiple threads
In some operating systems, such as HP-UX, a single program may have more than one
thread of execution. The precise semantics of threads differ from one operating system
to another, but in general, the threads of a single program are akin to multiple processes
- except that they share one address space (that is, they can all examine and modify
the same variables). On the other hand, each thread has its own registers and execution
stack, and private memory.
GDB provides these facilities for debugging multi-thread programs:
• Automatic notification of new threads
• Thread-specific breakpoints
WARNING! These facilities are not yet available on every GDB configuration where
the operating system supports threads. If your GDB does not support threads, these
commands have no effect. For example, a system without thread support shows no
output from `info threads', and always rejects the thread command, like this:
((gdb)) info threads
((gdb)) thread 1
Thread ID 1 not known. Use the "info threads" command to
see the IDs of currently known threads.
The GDB thread debugging facility allows you to observe all threads while your
program runs - but whenever GDB takes control, one thread in particular is always the
focus of debugging. This thread is called the current thread. Debugging commands
show program information from the perspective of the current thread.
Whenever GDB detects a new thread in your program, it displays the target system's
identification for the thread with a message in the form [New systag]. systag is a
thread identifier whose form varies depending on the particular system.
14