Tutorial :jstack equavalent in C++


jstack is very helpful to me in checking stack traces of live running processes.

Is there any tool in C++ to do this task. I am working with Solaris/GCC compilers.

Actually GDB/DBX can do that. But my process is hanging some times that to very rarely. So when that is hanging I want to know where it is going wrong. Just track that in live.

Thanks D. L. Kumar


Lessee... on solaris, can't use gdb... I think what you're looking for is 'pstack' On my solaris 8 system it's located at

/usr/bin/pstack  usage:  pstack [-F] { pid | core } ...  


man pstack  

shows a nice list of related tools you may find very useful in diagnosis.


I believe that GDB has that capability too, refer gdb documentation for the same


Considering you are running on Solaris, and you don't want to use GDB, DTrace seems the obvious remaining solution.

But are you perhaps dismissing GDB for the wrong reasons? You can attach GDB to existing hanging processes.


I wrote a article about dumping the stack in C/C++ with Windows and Unix/Linux at DDJ some years ago. Maybe it helps you:

See http://www.ddj.com/architect/185300443

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »