HPlogo Debugging threads with HP Wilde Beest Debugger

Thread Debugging Support in HP WDB

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

HP WDB provides thread-debugging support for kernel, user, and MxN threads. You can exclusively disable or enable specific thread execution. Advanced thread debugging support in HP WDB enables you to view information on pthread primitives and detect certain thread-related conditions.

NOTE: WDB supports pthread Parallelism, but it does not support compiler-generated parallelism like parallelism with Directives.

Support for enabling and disabling specific threads

If you suspect that a specific thread causes problems when you debug a multi-threaded application, HP WDB allows you to suspend the execution of all other threads in the application and debug this thread exclusively.

thread disable <thread-no>

The thread disable <thread-no> command prevents the specified threads from running until they are enabled again using the thread enable <thread-no> command.

thread enable <thread-no>

The thread enable <thread-no> command enables the specified thread to run when you enter the continue or step command. All threads are in the enabled state by default.

To disable a thread, execute the following command:

(gdb) thread disable 1
warning: ATTENTION!! Disabling threads may result in
deadlocks in the program. Disabling thread 1

To enable a thread, execute the following command:

(gdb) thread enable 1
Enabling thread 1

Back trace support for thread debugging

The following commands are available as backtrace support for thread debugging:

bt

The btcommand provides the stack trace of the current thread in execution or the thread that accepts the signal in core files.

thread apply all bt

The thread apply all bt command enables you to display the backtrace of all threads. The bt command provides the stack trace of only the current thread under execution.

backtrace_other_thread

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.

© 2008 Hewlett-Packard Development Company, L.P.