winedbg and control-C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



now that we can properly handle ctrl-c in console applications, let's
use that in the debugger:
you can now stop winedbg while it's running by hitting ctrl-c in its
(wineconsole) window (it won't work in regular unix console)
you'll be brought back to the winedbg prompt for any action

A+
Name:          wdbg_ctrl_c
ChangeLog:     add ctrl-c support in winedbg
License:       X11
GenDate:       2002/06/01 19:19:45 UTC
ModifiedFiles: debugger/winedbg.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/winedbg.c,v
retrieving revision 1.55
diff -u -u -r1.55 winedbg.c
--- debugger/winedbg.c	31 May 2002 23:06:47 -0000	1.55
+++ debugger/winedbg.c	1 Jun 2002 16:22:19 -0000
@@ -932,6 +932,19 @@
     }
 }
 
+static BOOL WINAPI DEBUG_CtrlCHandler(DWORD dwCtrlType)
+{
+    if (dwCtrlType == CTRL_C_EVENT)
+    {
+        DEBUG_Printf(DBG_CHN_MESG, "Ctrl-C: stopping debuggee\n");
+        /* FIXME: since we likely have a single process, signal the first process
+         * in list
+         */
+        return DEBUG_ProcessList && DebugBreakProcess(DEBUG_ProcessList->handle);
+    }
+    return FALSE;
+}
+
 static void DEBUG_InitConsole(void)
 {
     COORD	c;
@@ -962,12 +975,15 @@
     /* put the line editing mode with the nice emacs features (FIXME: could be triggered by a IVAR) */
     if (GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &mode))
         SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), mode | WINE_ENABLE_LINE_INPUT_EMACS);
+
+    /* set our control-C handler */
+    SetConsoleCtrlHandler(DEBUG_CtrlCHandler, TRUE);
 }
 
 int main(int argc, char** argv)
 {
     DWORD	retv = 0;
 
     /* Initialize the type handling stuff. */
     DEBUG_InitTypes();
     DEBUG_InitCVDataTypes();

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux