I would like to attach gdb to a dying process, because the program runs in production and I need to debug it there, if I open the program with gdb it slows down and the computers are not that great. I tried to catch signals in the application and attach gdb there but it just works if I send them signals myself. When the program stalls (multi-threaded program, and the main thread gets a deadlock or somehow gets stuck (or apparently stuck)), and the user forces it to quit in the Desktop Environment (LXDE), I can't catch no signal. The program is all python with PySide for the graphical interface. Just care about linux. My idea is to create a kernel driver and try too hook process termination or signals sending in there but since it would be much of a hassle I would like to ask if there is some tool for this kind of thing or some information that I could make use of. Thanks.
Asked
Active
Viewed 195 times
1 Answers
1
There might be a way to do what you want, but if you can't perhaps it would be sufficient to freeze the program and inspect its memory image?
Enable core dump file generation before it starts, and then once the process is hosed, terminate it with kill. Then use gdb to open the core file and analyze what was happening.

wallyk
- 56,922
- 16
- 83
- 148
-
What I'm trying to solve is when it gets stuck for the user (basically the main thread gets a deadlock or infinite loop or something) so what I'm doing now is to tell the user to call me so I can make a coredump at that point. I can create a button for them to click when the program gets stuck and then do the kill there, it works, I've tried, but it brings aditional problems because I have the program distributed in several places and it is a bit of a hassle in terms of managing the users and not disrupting the normal functioning of its usage. – user246100 Jun 25 '15 at 22:22