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.
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.
/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.
It looks like the command is /usr/bin/pstack as shown at man page pstack(1).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With