View stack of process
If I issue the following and the process doesn't quit, is there a way to view what it's doing with the SIGTERM signal on the stack? Is this done via the pstack command?
kill -s SIGTERM <PID> |
One way to see what's happening is to use gdb. Before you send the signal, note the proces' ID, fireup gdb and issue the following commands:
Code:
attach PID |
I just wanna pick up a little extra knowledge here - do signals go on to the STACK??!!! Can you give a few details about this?
|
Quote:
But a program certainly *has* a stack when it *gets* a signal. And you can see the stack if you attach to the process with GDB. You can do this in any of three ways: a) Starting GDB, then "attach" to the already-running PID b) "run" the process directly from GDB ... or ... c) Specify the program name and PID as GDB command line arguments ("gdb name-of-executable -pid process-id") "pstack" is great if the program is conveniently "stopped" for you. But it probably wouldn't work well to try capturing the stack at the moment you hit the signal handler (and catch it before it exited) |
What if the program wasn't coded in C? For example, I'm working on a Java program from a vendor and I tried running GDB on it without luck. In this case, if I execute pstack 'PID' would the dumped out information contains the signals? Can you give an example output of pstack and highlight where we can see the signal?
|
All times are GMT -5. The time now is 04:05 AM. |