1

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.

2 Answers 2

2

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.

0

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.

1
  • thank you, sir. I will figure out who sends me SIGTERM.
    – day
    Commented Apr 12, 2015 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.