What happened in gdb between handle_sigint and async_request_quit?

Amker.Cheng amker.cheng@gmail.com
Fri Feb 6 15:14:00 GMT 2009

Hi :
I think I've got the truth about what happened when CTRL+C is hit
during debugging.

both of GDB and Debuggee will get the event. Windows will report DBG_CONTROL_C
exception to GDB, which was turned into TARGET_SIGNAL_INT in GDB.
According to MSDN, this is the First Chance Exception!

Now the debugee is stopped and GDB got informed.

After I input the "continue" command .
Because the default action is nopass for SIGINT, GDB will just resume
debuggee using
function ContinueDebugEvent() with the second argument set to DBG_CONTINUE,
which stops all exception processing and continues the
thread(debuggee). That's why
debuggee will not get the CTRL+C event. To be accurate, the debuggee
has received
the CTRL+C event, just bypassed by OS violently.

Again, if I let GDB pass SIGINT to debuggee using command "handle 2 pass",
GDB will call function ContinueDebugEvent() with the second argument set to
DBG_EXCEPTION_NOT_HANDLED, which cause debuggee to continues the
exception processing(for this is a first-chance exception event).

Now I think it clear enough as how GDB handles SIGINT is concerned, am I right?
Although there are other puzzles such as the "quit_flag", etc..

Thanks for your time

More information about the Gdb mailing list