The -level n option can be used to print n levels of procedure calls. Without this option, pstack normally prints the complete procedure stack. With this option, pstack can be restricted to print 'n' levels in the procedure stack. With this option, pstack can be restricted to print only n levels of procedure calls in the procedure stack.

The following example shows the result of running pstack for a process id 3975.

Example 5 Calling pstack with a process id

-------------------------------- lwpid : 4549 -------------------------------

0:60000000c0454230 : _read_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)

1:60000000c0469840 : _read() + 0x80 (/usr/lib/hpux32/libc.so.1)

2:60000000c04304a0 : __filbuf() + 0x1a0 (/usr/lib/hpux32/libc.so.1)

3:00000000040009e0 : (unknown) () (unknown)

4:60000000c0048c90 : main_opd_entry() + 0x50 (/usr/lib/hpux32/dld.so)

The following example shows the usage id -leveloption is used to print 3 levels of procedures stack for a process id 3975.

Example 6 Calling pstack with -level option

-------------------------------- lwpid : 4549 -------------------------------

0:60000000c0454230 : _read_sys() + 0x30 (/usr/lib/hpux32/libc.so.1)

1:60000000c0469840 : _read() + 0x80 (/usr/lib/hpux32/libc.so.1)

2:60000000c04304a0 : __filbuf() + 0x1a0 (/usr/lib/hpux32/libc.so.1)

On HP-UX 11i v3 Integrity systems, the -t <thread id> can be used to print stack trace of the target thread alone. Only the execution of the target thread is suspended while other threads continue to execute. The following example shows the usage if -t <thread id> option is used to print the default output for a sample threaded process.

Printing a Stack Trace with pstack(1)

63

Page 63
Image 63
HP UX Software Transition Kit (STK) manual Example 5 Calling pstack with a process id