Stack of a Running Process in Unix/Linux
The command pstack can be used to view the stack trace of a running process.
Let us select a running process.
[neo@techpulp ~]# ps -e | grep konqueror 22937 pts/5 00:00:17 konqueror
Run pstack command with PID of the process.
[neo@techpulp ~]# pstack 22937 22937: konqueror (No symbols found) 0x001fb402: ???? (89c6ed8, 2, bfa39b08, 3812df0, 89c6ed8, 3c21362) 0x0325074b: ???? (89c6ed8, 8a00908) 0x03250656: ???? (89c6ed8, 3c372ec) 0x03237a59: ???? (bfa39c20, bfa39d48, bfa39de8, bfa39d1c, 0, bfa39fb4) + 4c0 0x03bb1d0d: ???? (1, bfa3a094, bfa3a09c, 0, bfa3a094, 1) + 40 0x00248de6: ???? (80485ec, 1, bfa3a094, 8048600, 8048650, 21ff2d) + 405c5f78 [neo@techpulp ~]#
There is an alternate way to use gdb and attach to the running process.


about 1 year ago
You could also use gdb if you don’t mind stopping the process for a while.
bash# gdb konqueror 22937
...
...
(gdb) bt
...
...
(gdb) quit
This is the way to attach gdb to an already running process. You need to give PID along with the command.