JIT debugger startup

Eric Pouech eric.pouech at wanadoo.fr
Fri May 10 16:08:54 CDT 2002


As Uwe Bonnes noted, since the '--' handling removal when a process was
created with CreateProcess (and not the command line), any debugger
(like winedbg) started by an unhandled exception (aka JIT debugger),
now inherits all the trace options from its parent (read the process
which issued the exception)

this patch lets you turn off this inheritance by adding a value under
the
HKLM\Software\Microsoft\Windows NT\CurrentVersion\AeDebug key
if the value MuteDbgChannels is found and is TRUE then the debugger
will be started will all the debug channels turned off

A+
-------------- next part --------------
Name:          dbg_nochn
ChangeLog:     added option to mute all debug channels in debugger when started by an exception
License:       X11
GenDate:       2002/05/10 20:57:15 UTC
ModifiedFiles: win32/except.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/win32/except.c,v
retrieving revision 1.52
diff -u -u -r1.52 except.c
--- win32/except.c	10 Mar 2002 00:18:37 -0000	1.52
+++ win32/except.c	25 Apr 2002 19:56:05 -0000
@@ -208,7 +208,7 @@
 static BOOL	start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
 {
     HKEY		hDbgConf;
-    DWORD		bAuto = FALSE;
+    DWORD		bAuto = FALSE, bMuteDbgChn = FALSE;
     PROCESS_INFORMATION	info;
     STARTUPINFOA	startup;
     char*		cmdline = NULL;
@@ -249,10 +249,21 @@
            if (!RegQueryValueExA(hDbgConf, "Auto", 0, &type, autostr, &count))
                bAuto = atoi(autostr);
        }
+       count = sizeof(bAuto);
+       /* this is a wine specific flag */
+       if (RegQueryValueExA(hDbgConf, "MuteDebugChannels", 0, &type, (char*)&bMuteDbgChn, &count))
+	  bMuteDbgChn = TRUE;
+       else if (type == REG_SZ)
+       {
+           char mutestr[10];
+           count = sizeof(mutestr);
+           if (!RegQueryValueExA(hDbgConf, "MuteDebugChannels", 0, &type, mutestr, &count))
+               bMuteDbgChn = atoi(mutestr);
+       }
        RegCloseKey(hDbgConf);
     } else {
 	/* try a default setup... */
-	strcpy( format, "winedbg --debugmsg -all -- --auto %ld %ld" );
+	strcpy( format, "winedbg --auto %ld %ld" );
     }
 
     if (!bAuto)
@@ -274,6 +285,19 @@
     }
 
     if (format) {
+        if (bMuteDbgChn)
+        {
+            char    buffer[1024];
+
+            if (GetEnvironmentVariableA( "WINEOPTIONS", buffer, sizeof(buffer) ) && buffer[0])
+            {
+                strncat( buffer, " --debugmsg -all", sizeof(buffer) );
+            }
+            else
+                strcpy( buffer, "--debugmsg -all" );
+            SetEnvironmentVariableA( "WINEOPTIONS", buffer );
+        }
+
         TRACE("Starting debugger (fmt=%s)\n", format);
         cmdline=HeapAlloc(GetProcessHeap(), 0, format_size+2*20);
         sprintf(cmdline, format, GetCurrentProcessId(), hEvent);


More information about the wine-patches mailing list