however, for implementing the Ctrl-C handling in winedbg, we really need DebugBreakProcess to work this API was (on i386) sending single step exception instead of breakpoint exception this patch takes care of it A+
Name: sig_trap ChangeLog: fixed DebugBreakProcess (now generates EXCEPTION_BREAKPOINT instead of EXCEPTION_SINGLE_STEP) License: X11 GenDate: 2002/06/01 19:21:53 UTC ModifiedFiles: dlls/ntdll/signal_i386.c AddedFiles: =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/signal_i386.c,v retrieving revision 1.36 diff -u -u -r1.36 signal_i386.c --- dlls/ntdll/signal_i386.c 31 May 2002 23:25:49 -0000 1.36 +++ dlls/ntdll/signal_i386.c 1 Jun 2002 12:27:32 -0000 @@ -765,8 +765,19 @@ switch(trap_code) { case T_TRCTRAP: /* Single-step exception */ - rec.ExceptionCode = EXCEPTION_SINGLE_STEP; - context->EFlags &= ~0x100; /* clear single-step flag */ + if (context->EFlags & 0x100) + { + rec.ExceptionCode = EXCEPTION_SINGLE_STEP; + context->EFlags &= ~0x100; /* clear single-step flag */ + } + else + { + /* likely we get this because of a kill(SIGTRAP) on ourself, + * so send a bp exception instead of a single step exception + */ + TRACE("Spurious single step trap => breakpoint simulation\n"); + rec.ExceptionCode = EXCEPTION_BREAKPOINT; + } break; case T_BPTFLT: /* Breakpoint exception */ rec.ExceptionAddress = (char *)rec.ExceptionAddress - 1; /* back up over the int3 instruction */ @@ -963,17 +974,21 @@ */ static HANDLER_DEF(int_handler) { - EXCEPTION_RECORD rec; - CONTEXT context; + extern int CONSOLE_HandleCtrlC(void); + if (!CONSOLE_HandleCtrlC()) + { + EXCEPTION_RECORD rec; + CONTEXT context; - save_context( &context, HANDLER_CONTEXT ); - rec.ExceptionCode = CONTROL_C_EXIT; - rec.ExceptionFlags = EXCEPTION_CONTINUABLE; - rec.ExceptionRecord = NULL; - rec.ExceptionAddress = (LPVOID)context.Eip; - rec.NumberParameters = 0; - EXC_RtlRaiseException( &rec, &context ); - restore_context( &context, HANDLER_CONTEXT ); + save_context( &context, HANDLER_CONTEXT ); + rec.ExceptionCode = CONTROL_C_EXIT; + rec.ExceptionFlags = EXCEPTION_CONTINUABLE; + rec.ExceptionRecord = NULL; + rec.ExceptionAddress = (LPVOID)context.Eip; + rec.NumberParameters = 0; + EXC_RtlRaiseException( &rec, &context ); + restore_context( &context, HANDLER_CONTEXT ); + } }