Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there tool to see call-stack of running thread similar to Process Explorer by Sysinternals ?

So far I tried htop, qps and Linux Process Explorer. None of them can provide that information.

Thanks!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Gdb, the GNU debugging utility, can provide such functionality, although only for selected programs or processes individually. There is not an easy way to do it and switch between the call-stacks of the processes running on the system like the Sysinternals program does on Windows. However, you could try pstack, but I have not had much success with it.

You also have to install the dbg packages (i.e. the symbol packages) so that any gdb call-stack backtrace will work. See the Ubuntu wiki for more information on these packages. Basically, the dbg version of the package is installed very like the normal one is. You run, for example,

sudo apt-get install xserver-xorg-core-dbg

You can do a backtrace on a program by starting the program under gdb or you can do one on a program already running by attaching gdb to that process: please see here for further details.

Please see the official manual for more information on gdb and backtracing and more generally useful information is here at the Ubuntu debugging page.

Additional ways of analysing running processes using strace,etc, which are of use to developers, etc, in analysing a process and its system calls, as opposed to stack calls, have been moved to this question here (as I thought they are now more relevant there):

share|improve this answer
    
Thanks a lot for very detailed answer. I'll try everything tonight. But there is no way to get call-stack of running thread I assume ? –  ruslan Sep 24 '12 at 22:16
    
@ruslan I've edited my answer and moved the strace and ltrace discussion to the linked askubuntu question, as I realised that you are more interested in looking at call stacks using something like gdb. See here askubuntu.com/questions/191964/…. I hope this is ok, as I realised it wasn't really what you wanted here. –  user76204 Sep 24 '12 at 23:32
    
Got it. Thank you for clarification! –  ruslan Sep 25 '12 at 3:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.