Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
PSTACK(1)		    General Commands Manual		     PSTACK(1)

NAME
       pstack -- print the backtrace of	the running program

SYNOPSIS
       pstack [-loOtv] [-a arg count] [-f frame	count] pid

DESCRIPTION
       The pstack utility prints the stack backtraces for the running program.
       The pstack attaches to the traced process using the ptrace(2) debugging
       interface.   If possible, the symbolic name and offset for the function
       executing in each frame is displayed.  The pstack can  be  directed  to
       print the shared	object name, which contains the	function.

       The  first  line	 of the	output displays	the pid	of the traced process,
       binary name as reported by the kernel, and the currently	 active	 osrel
       version of the ABI for the process.  After that,	for each thread	in the
       process,	the thread id is displayed, followed by	the backtrace.

       The following options are available:

       -a count
	       Try  to	guess  the arguments of	each function appearing	in the
	       backtrace.  Not more than count arguments are printed for  each
	       function.   Ability  to	correctly read the argument values de-
	       pends on	the architecture and compiler optimization, but	it  is
	       generally impossible to do.

       -f count
	       For  each thread, print not more	than count frames in the back-
	       trace.

       -l      Instead of walking the stacks of	the running threads, print the
	       names of	the shared objects loaded  into	 the  process  address
	       space.	The  output  of	 the  utility  resembles the output of
	       ldd(1) command run on the binary.

       -o      Show the	names of the objects which contain the location	of the
	       frame current instruction pointer.

       -O      Same as -o, but displays	the full path to the  objects  instead
	       of only names.

       -t      Measure	and  print  the	time which the target process was sus-
	       pended to walk the stack	frames.

       -v      Be verbose.

SEE ALSO
       gdb(1), ldd(1), ptrace(2), libunwind(3),	procfs(5)

AUTHORS
       The pstack command is reimplemented by Konstantin Belousov to mimic the
       user interface of other similar pstack utilities,  in  particular,  the
       pstack written by
       Peter  Edwards.	 This  version	relies on the libunwind	library	as the
       stack unwinding backend.

CAVEATS
       On i386,	the argument printing code assumes that	the  frame  layout  is
       standard,  which	 is  currently	often  not the case due	to the padding
       added between return address and	previous frame	pointer,  as  done  by
       compilers to align the stack.

       On amd64, the argument printing currently does not work.	 The amd64 ABI
       specifies  that integer arguments are passed in the registers which are
       not required to be preserved across function  calls.   As  the  result,
       there  is  typically  no	 way  to re-create the arguments values	on any
       frame except the	current	one.

       The symbol names	cannot be inferred  if	the  corresponding  binary  or
       shared  object  are  already deleted, since libunwind needs to read the
       symbols from the	on-disk	ELF image.  This could typically occur if  the
       binary or library is reinstalled, but the process uses older version of
       the binary with the same	name.

       The pstack only works on	the processes executing	ELF binaries.

       You  cannot  get	a backtrace for	the process, to	which another debugger
       is currently attached.  The ptrace(2) debugging mechanism used  to  ob-
       tain  the  neccessary  live process information causes some syscalls to
       return EINTR errors on pstack detach.

       The pstack utility cannot yet extract a backtrace from the core dump.

       The architecture	of  the	 program  and  pstack  shall  match  (this  is
       libunwind restriction).

FreeBSD	ports 15.0		 June 17, 2014			     PSTACK(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=pstack&sektion=1&manpath=FreeBSD+Ports+15.0>

home | help