I am trying to get the backtrace stack of a running process (PID and binary path are known) from another program. This program is written in C ++ and compiled with g ++ using gdb debugging symbols.
I am looking for a C or C ++ library that works on Linux, HP-UX, and Solaris, which produces output similar to the output of a popen () call, with something like this:
gdb -batch -x /dev/stdin <BINARY> <PID> << EOF thread apply all bt EOF
I found lsstack ( http://sourceforge.net/projects/lsstack/ ), which is Linux only and knows the pstack program for Solaris.
Does anyone know of a reliable way to execute this Unix / POSIX cross?
c ++ c stack-trace unix
jsc
source share