Legend
Legend

Reputation: 116950

What does it mean when an executable stops responding to Ctrl+C?

I have been playing around with some debugging and wrote some C code that does a lot of pointer related operations (as a Valgrind tool) that runs on top of Valgrind. In the last one hour I changed something as a result of which the program executes fine but then stops responding to Ctrl+C when I try to terminate it.

I tried running the program through gdb and still observing the same behavior. Can someone tell me what triggers this kind of a behavior?

UPDATE: I figured it was infinite recursion that was causing the error but I am still curious as to why it does not respond to the command.

Upvotes: 2

Views: 474

Answers (2)

SingleNegationElimination
SingleNegationElimination

Reputation: 156258

as for How this can happen, when a wishes to actually handle an interrupt, say, to do some cleanup, it will register its own interrupt handler to use instead of the default handler (which usually just calls exit() or abort() depending on the specific interrupt). If there is a bug in that interrupt, then the handler occurs, but the program doesn't actually work as expected. Since the only way to kill off the program is by sending it an interrupt, then you can't kill off the program at all.

Well, actually, there is one interrupt you cannot do this with, SIGKILL. You can't do anything in your program to prevent it from being handled by immediately calling abort()

Upvotes: 1

krzysz00
krzysz00

Reputation: 2103

A VERY badly hung program. Try opening another terminal and doing

kill -SIGINT `pidof program-name`

(If -SIGINT doesn't work, move to -SIGTERM and -SIGKILL (be warned that SIGKILL is immediate termination with NO cleanup))

Upvotes: 2

Related Questions