My application goes into zombie on a Linux box, it cannot be killed and gdb cannot attach to it, I cannot debug. Now I want to know the last called function or backtrace, is there anyway I can get this? Is there any information under /proc/pid/stat I can use for this?
Asked
Active
Viewed 1,807 times
2 Answers
1
No you can't. Zombie is a process that already disappeared. The only thing that exists is an entry in the process' table of the OS.

Igor Chubin
- 61,765
- 13
- 122
- 144
1
Zombies are processes that have finished but their parent has still not processed the SIGCHLD
signal and/or has not called the wait(2)
syscall (jargon has it that the parent has not "reaped" the child process). Zombie processes have their memory freed but some of the kernel structures that describe the process are kept, including entries in the process table. Having their memory freed there is no way to obtain a stack trace or a memory dump of a zombie.

Hristo Iliev
- 72,659
- 12
- 135
- 186
-
Thanks for the response. Someone told me, there is a field in the proc entry of that process which shows the last called function address, I can get that value, then gdb open the binary and read the function name of that address, do you know is this possible? – hexiay Jun 28 '12 at 11:54
-
1If the zombie process has terminated normally then the last function called would be the `exit(2)` syscall. If it has terminated because of an error, e.g. it has received `SIGSEGV`, you can arrange for a core dump to be produced. But having zombies around means that you should start with debugging the parent process, not the zombies, to find out why children are not reaped properly. – Hristo Iliev Jun 28 '12 at 12:09