Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the linux command to get the stack of a running process without having to attach to it in a debugger?

What's the linux command to get the stack of a running process without having to attach to it in a debugger?

I've seen someone do this before, but do not recall the command they used to do it.

This is really handy as a quick way to see what your program is doing without going through the overhead of attaching to it in a debugger to get the stack trace to see where it is currently at.

like image 975
WilliamKF Avatar asked Dec 24 '10 14:12

WilliamKF


People also ask

Can GDB attach to a running process?

With GDB it is always possible to debug a running process by attaching to it. It is possible to debug a DLL this way. The limitation of this approach is that the DLL must run long enough to perform the attach operation.

What is Proc pid stack?

/proc/[pid]/stack (since Linux 2.6.29) This file provides a symbolic trace of the function calls in this process's kernel stack. This file is provided only if the kernel was built with the CONFIG_STACKTRACE configuration option.


1 Answers

It looks like the command is /usr/bin/pstack as shown at man page pstack(1).

like image 148
WilliamKF Avatar answered Sep 22 '22 16:09

WilliamKF