named critical sections

Andreas Mohr a.mohr at mailto.de
Tue Aug 7 09:15:41 CDT 2001


Hi all,

this patch implements *names* for the most important critical sections.

I simply grew tired of constantly having to look up the crst addresses
in winedbg whenever there was some crst timeout.
Yeah, I know, that patch is slightly weird/dirty, but it's useful.

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
"Point is, nothing here is unfamiliar or unexpected.  How long does
it take before there's general recognition that Microsoft software
has no business on the Internet? - Dennis E. Powell re: Code Red
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/ntdll/critsection.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/critsection.c,v
retrieving revision 1.4
diff -u -r1.4 critsection.c
--- dlls/ntdll/critsection.c	22 Jan 2001 02:18:13 -0000	1.4
+++ dlls/ntdll/critsection.c	7 Aug 2001 14:12:55 -0000
@@ -190,11 +190,39 @@
         DWORD res = WaitForSingleObject( sem, 5000L );
         if ( res == WAIT_TIMEOUT )
         {
-            ERR("Critical section %p wait timed out, retrying (60 sec) fs=%04x\n", crit, __get_fs() );
+	    char crst_name[32];
+
+	    if (HIWORD(crit->DebugInfo) == 0xface)
+	    {
+		switch (LOWORD(crit->DebugInfo))
+		{
+		    case 0x0001:
+			strcpy(crst_name, "Win16Mutex");
+			break;
+		    case 0x0002:
+			strcpy(crst_name, "WIN_SysLevel");
+			break;
+		    case 0x0003:
+			strcpy(crst_name, "GDI_level");
+			break;
+		    case 0x4401:
+			strcpy(crst_name, "X11DRV_CritSection");
+			break;
+		    case 0x4402:
+			strcpy(crst_name, "peb_lock");
+			break;
+		    default:
+			strcpy(crst_name, "unknown_crst_FIXME");
+			break;
+		}
+	    }
+	    else
+		sprintf(crst_name, "%p", crit);
+            ERR("Critical section %s wait timed out, retrying (60 sec) fs=%04x\n", crst_name, __get_fs() );
             res = WaitForSingleObject( sem, 60000L );
             if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
             {
-                ERR("Critical section %p wait timed out, retrying (5 min) fs=%04x\n", crit, __get_fs() );
+                ERR("Critical section %s wait timed out, retrying (5 min) fs=%04x\n", crst_name, __get_fs() );
                 res = WaitForSingleObject( sem, 300000L );
             }
         }
Index: dlls/ntdll/rtl.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/rtl.c,v
retrieving revision 1.40
diff -u -r1.40 rtl.c
--- dlls/ntdll/rtl.c	25 Jul 2001 00:43:31 -0000	1.40
+++ dlls/ntdll/rtl.c	7 Aug 2001 14:12:55 -0000
@@ -21,7 +21,7 @@
 DEFAULT_DEBUG_CHANNEL(ntdll);
 
 
-static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT;
+static RTL_CRITICAL_SECTION peb_lock = { (void *)0xface4402, -1, 0, 0, 0, 0 };
 
 /*
  *	resource functions
Index: dlls/x11drv/x11drv_main.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv_main.c,v
retrieving revision 1.41
diff -u -r1.41 x11drv_main.c
--- dlls/x11drv/x11drv_main.c	23 Jul 2001 00:04:01 -0000	1.41
+++ dlls/x11drv/x11drv_main.c	7 Aug 2001 14:12:56 -0000
@@ -47,7 +47,7 @@
 static void (*old_tsx11_lock)(void);
 static void (*old_tsx11_unlock)(void);
 
-static CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT;
+static CRITICAL_SECTION X11DRV_CritSection = { (void *)0xface4401, -1, 0, 0, 0, 0 };
 
 Screen *screen;
 Visual *visual;
Index: objects/gdiobj.c
===================================================================
RCS file: /home/wine/wine/objects/gdiobj.c,v
retrieving revision 1.51
diff -u -r1.51 gdiobj.c
--- objects/gdiobj.c	12 Jul 2001 22:33:52 -0000	1.51
+++ objects/gdiobj.c	7 Aug 2001 14:12:56 -0000
@@ -170,7 +170,7 @@
 
 HBITMAP hPseudoStockBitmap; /* 1x1 bitmap for memory DCs */
 
-static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT, 3 };
+static SYSLEVEL GDI_level = { { (void *)0xface0003, -1, 0, 0, 0, 0 }, 3 };
 static WORD GDI_HeapSel;
 
 static BOOL get_bool(char *buffer, BOOL def_value)
@@ -438,9 +438,11 @@
         if (!(obj = alloc_large_heap( size, handle ))) goto error;
         break;
     default:
+	TRACE("#1\n");
         if (!(*handle = LOCAL_Alloc( GDI_HeapSel, LMEM_MOVEABLE, size ))) goto error;
         assert( *handle & 2 );
         obj = (GDIOBJHDR *)LOCAL_Lock( GDI_HeapSel, *handle );
+	TRACE("#2: %p\n", obj);
         break;
     }
 
Index: scheduler/syslevel.c
===================================================================
RCS file: /home/wine/wine/scheduler/syslevel.c,v
retrieving revision 1.24
diff -u -r1.24 syslevel.c
--- scheduler/syslevel.c	2 Jul 2001 19:59:49 -0000	1.24
+++ scheduler/syslevel.c	7 Aug 2001 14:12:56 -0000
@@ -14,7 +14,7 @@
 
 DEFAULT_DEBUG_CHANNEL(win32);
 
-static SYSLEVEL Win16Mutex = { CRITICAL_SECTION_INIT, 1 };
+static SYSLEVEL Win16Mutex = { { 0xface0001, -1, 0, 0, 0, 0 }, 1 };
 
 /* Global variable to save current TEB while in 16-bit code */
 WORD SYSLEVEL_Win16CurrentTeb = 0;
Index: windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.138
diff -u -r1.138 win.c
--- windows/win.c	26 Jul 2001 20:12:23 -0000	1.138
+++ windows/win.c	7 Aug 2001 14:12:57 -0000
@@ -38,7 +38,7 @@
 static WORD wDragHeight= 3;
 
 /* thread safeness */
-static SYSLEVEL WIN_SysLevel = { CRITICAL_SECTION_INIT, 2 };
+static SYSLEVEL WIN_SysLevel = { { (void *)0xface0002, -1, 0, 0, 0, 0 }, 2 };
 
 /***********************************************************************
  *           WIN_LockWnds


More information about the wine-patches mailing list