Example 7 Printing the default output for a sample threaded process

-------------------------------- lwpid : 119942 -------------------------------

0:60000000c042fb70 : __pause_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)

1:60000000c0444de0 : pause() + 0xc0 (/usr/lib/hpux32/libc.so.1)

2:0000000004000e80 : main() + 0x270 (./thread32)

3:60000000c0030c90 : main_opd_entry() + 0x50 (/usr/lib/hpux32/dld.so)

-------------------------------- lwpid : 119943 -------------------------------

0:60000000c042fb70 : __pause_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)

1:60000000c0444de0 : pause() + 0xc0 (/usr/lib/hpux32/libc.so.1)

2:0000000004000b80 : thread_func1() + 0x50 (./thread32)

3:60000000c00f69a0 : __pthread_bound_body() + 0x190 (/usr/lib/hpux32/libpthread.so.1)

-------------------------------- lwpid : 119944 -------------------------------

0:60000000c042fb70 : __pause_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)

1:60000000c0444de0 : pause() + 0xc0 (/usr/lib/hpux32/libc.so.1)

2:0000000004000bf0 : thread_func2() + 0x50 (./thread32)

3:60000000c00f69a0 : __pthread_bound_body() + 0x190 (/usr/lib/hpux32/libpthread.so.1)

Using the –toption to specify the thread, you can get the information specific to a thread without stopping the other threads as shown below.

Example 8 Printing the output for a sample threaded process with the -t option

-------------------------------- lwpid : 119942 -------------------------------

0:60000000c042fb70 : __pause_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)

1:60000000c0444de0 : pause() + 0xc0 (/usr/lib/hpux32/libc.so.1)

2:0000000004000e80 : main() + 0x270 (./thread32)

3:60000000c0030c90 : main_opd_entry() + 0x50 (/usr/lib/hpux32/dld.so)

A special argument -1enables you to trace the calling process without entering the PID of the process. Hence, you can skip the process of finding the PID by using this argument on a calling process.

The example below shows the usage of special argument -1that can be used to run pstack on the calling process. In this case, the calling process is the shell itself.

64 Linker Tools for Itanium-Based Systems