Reputation: 1157
I have searched several questions on stackoverflow about debugging SIGTERM, but have not get the information I needed. Perhaps, I am still new to this issue.
My program terminated with the SIGTERM signal without core dump and I donot know how to track this down. My Question is, what is the general way of debugging this issue in GDB?
Thanks.
Upvotes: 1
Views: 3067
Reputation: 10251
Although SIGTERM can be sent by the kernel in a few cases, it's almost always sent by another user process. If you run your program under gdb, then when it receives a SIGTERM it will become paused. You can then get some info about the signal by looking at the $_siginfo
structure:
(gdb) print $_siginfo._sifields._kill
$2 = {si_pid = 3926, si_uid = 1001}
This is on Linux. It means that pid 3926 sent the signal, and the userid who sent it is 1001.
Upvotes: 2
Reputation: 213385
My program terminated with the SIGTERM signal without core dump
It is expected that if someone sends your program a SIGTERM
, then no core dump is produced.
and I donot know how to track this down.
You need to figure out where that SIGTERM
is coming from. Someone sends it your program, and the key question is who.
Usually SIGTERM
is sent when either you type Control-C in the terminal in which you started the program (correction, that would send SIGINT
, not SIGTERM
), or you type kill <pid>
in some other terminal.
Upvotes: 0