Traces: fs -> tid

Francois Gouget fgouget at free.fr
Mon Apr 16 02:55:58 CDT 2001


On Tue, 10 Apr 2001, eric pouech wrote:

> >    Another way to do this would be to hack the code decoding the
> > debugmsg settings to recognize +relay and set +tid at the same time, so
> > that '+relay'=='+relay,+tid'=='-tid,+relay' != '+relay,-tid'. But the
> > last two may be confusing.
> 
> what about a +notid channel ? I know it's against the semantics of the
> channel, but it's close to what you're looking for...

   Here's a patch that implements the notid solution.
   Since I have I have it in my tree I might as well post it.


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
               RFC 2549: ftp://ftp.isi.edu/in-notes/rfc2549.txt
                IP over Avian Carriers with Quality of Service
-------------- next part --------------
Index: dlls/ntdll/ntdll.spec
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/ntdll.spec,v
retrieving revision 1.44
diff -u -r1.44 ntdll.spec
--- dlls/ntdll/ntdll.spec	2001/04/09 18:34:50	1.44
+++ dlls/ntdll/ntdll.spec	2001/04/13 01:33:09
@@ -3,9 +3,9 @@
 
 debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
                 file fixup global heap int int10 int16 int17 int19 int21 int31
-                io loaddll local module ntdll process profile reg relay resource
+                io loaddll local module notid ntdll process profile reg relay resource
                 segment seh selector server snoop string system tape task thread
-                thunk timer toolhelp ver virtual vxd win32)
+                thunk tid timer toolhelp ver virtual vxd win32)
 
 #note that the Zw... functions are alternate names for the 
 #Nt... functions.  (see www.sysinternals.com for details)
Index: dlls/ntdll/debugtools.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/debugtools.c,v
retrieving revision 1.6
diff -u -r1.6 debugtools.c
--- dlls/ntdll/debugtools.c	2001/03/21 23:54:59	1.6
+++ dlls/ntdll/debugtools.c	2001/04/13 01:33:08
@@ -15,6 +15,11 @@
 #include "winnt.h"
 #include "wtypes.h"
 
+DECLARE_DEBUG_CHANNEL(relay);
+DECLARE_DEBUG_CHANNEL(tid);
+DECLARE_DEBUG_CHANNEL(notid);
+
+
 /* ---------------------------------------------------------------------- */
 
 struct debug_info
@@ -248,8 +253,11 @@
     int ret = 0;
 
     va_start(valist, format);
-    if (cls < __DBCL_COUNT)
-        ret = wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
+    if (cls < __DBCL_COUNT) {
+        if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+            ret = wine_dbg_printf( "%08lx:", GetCurrentThreadId() );
+        ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
+    }
     if (format)
         ret += wine_dbg_vprintf( format, valist );
     va_end(valist);
Index: if1632/relay.c
===================================================================
RCS file: /home/wine/wine/if1632/relay.c,v
retrieving revision 1.41
diff -u -r1.41 relay.c
--- if1632/relay.c	2001/02/14 23:11:19	1.41
+++ if1632/relay.c	2001/04/13 01:33:14
@@ -18,6 +18,8 @@
 #include "callback.h"
 
 DEFAULT_DEBUG_CHANNEL(relay);
+DECLARE_DEBUG_CHANNEL(tid);
+DECLARE_DEBUG_CHANNEL(notid);
 
 /***********************************************************************
  *           RELAY_Init
@@ -154,6 +156,8 @@
     args = BUILTIN_GetEntryPoint16( frame, funstr, &ordinal );
     if (!args) return; /* happens for the two snoop register relays */
     if (!RELAY_ShowDebugmsgRelay(funstr)) return;
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     DPRINTF( "Call %s(",funstr);
     VA_START16( args16 );
 
@@ -274,6 +278,8 @@
     args = BUILTIN_GetEntryPoint16( frame, funstr, &ordinal );
     if (!args) return;
     if (!RELAY_ShowDebugmsgRelay(funstr)) return;
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     DPRINTF( "Ret  %s() ",funstr);
 
     if ( memcmp( args+2, "long_", 5 ) == 0 )
@@ -320,6 +326,8 @@
 
     nb_args /= sizeof(WORD);
 
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     if ( reg_func )
     {
         CONTEXT86 *context = (CONTEXT86 *)target;
@@ -354,9 +362,11 @@
 {
     if (!TRACE_ON(relay)) return;
 
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     if (!reg_func)
     {
-        DPRINTF("CallTo16() ss:sp=%04x:%04x retval=0x%08x\n", 
+        DPRINTF("RetFrom16() ss:sp=%04x:%04x retval=0x%08x\n", 
                 SELECTOROF(NtCurrentTeb()->cur_stack),
                 OFFSETOF(NtCurrentTeb()->cur_stack), ret_val);
     }
@@ -364,7 +374,7 @@
     {
         CONTEXT86 *context = (CONTEXT86 *)ret_val;
 
-        DPRINTF("CallTo16() ss:sp=%04x:%04x\n", 
+        DPRINTF("RetFrom16() ss:sp=%04x:%04x\n", 
                 SELECTOROF(NtCurrentTeb()->cur_stack),
                 OFFSETOF(NtCurrentTeb()->cur_stack));
         DPRINTF("     AX=%04x BX=%04x CX=%04x DX=%04x BP=%04x SP=%04x\n",
Index: relay32/relay386.c
===================================================================
RCS file: /home/wine/wine/relay32/relay386.c,v
retrieving revision 1.33
diff -u -r1.33 relay386.c
--- relay32/relay386.c	2001/04/09 18:47:10	1.33
+++ relay32/relay386.c	2001/04/13 01:33:27
@@ -17,6 +17,8 @@
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(relay);
+DECLARE_DEBUG_CHANNEL(tid);
+DECLARE_DEBUG_CHANNEL(notid);
 
 char **debug_relay_excludelist = NULL, **debug_relay_includelist = NULL;
 
@@ -183,9 +185,11 @@
 
     get_entry_point( buffer, relay );
 
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     DPRINTF( "Call %s(", buffer );
     RELAY_PrintArgs( args, nb_args, relay->argtypes );
-    DPRINTF( ") ret=%08x tid=%08lx\n", ret_addr, GetCurrentThreadId() );
+    DPRINTF( ") ret=%08x\n", ret_addr );
     ret64 = (relay->argtypes & 0x80000000) && (nb_args < 16);
 
     /* the user driver functions may be called with the window lock held */
@@ -278,12 +282,14 @@
             assert(FALSE);
         }
     }
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     if (ret64)
-        DPRINTF( "Ret  %s() retval=%08x%08x ret=%08x tid=%08lx\n",
-                 buffer, (UINT)(ret >> 32), (UINT)ret, ret_addr, GetCurrentThreadId() );
+        DPRINTF( "Ret  %s() retval=%08x%08x ret=%08x\n",
+                 buffer, (UINT)(ret >> 32), (UINT)ret, ret_addr );
     else
-        DPRINTF( "Ret  %s() retval=%08x ret=%08x tid=%08lx\n",
-                 buffer, (UINT)ret, ret_addr, GetCurrentThreadId() );
+        DPRINTF( "Ret  %s() retval=%08x ret=%08x\n",
+                 buffer, (UINT)ret, ret_addr );
 
     if (memcmp( buffer, "x11drv.", 7 ) && memcmp( buffer, "ttydrv.", 7 ))
       SYSLEVEL_CheckNotLevel( 2 );
@@ -328,6 +334,8 @@
 
     get_entry_point( buffer, relay );
 
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     DPRINTF( "Call %s(", buffer );
     RELAY_PrintArgs( args, nb_args, relay->argtypes );
     DPRINTF( ") ret=%08lx fs=%04lx\n", context->Eip, context->SegFs );
@@ -374,6 +382,8 @@
         assert(FALSE);
     }
 
+    if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+        DPRINTF("%08lx:",GetCurrentThreadId());
     DPRINTF( "Ret  %s() retval=%08lx ret=%08lx fs=%04lx\n",
              buffer, context->Eax, context->Eip, context->SegFs );
 
Index: relay32/snoop.c
===================================================================
RCS file: /home/wine/wine/relay32/snoop.c,v
retrieving revision 1.39
diff -u -r1.39 snoop.c
--- relay32/snoop.c	2001/02/12 01:19:04	1.39
+++ relay32/snoop.c	2001/04/13 01:33:27
@@ -18,6 +18,9 @@
 #include "wine/exception.h"
 
 DEFAULT_DEBUG_CHANNEL(snoop);
+DECLARE_DEBUG_CHANNEL(relay);
+DECLARE_DEBUG_CHANNEL(tid);
+DECLARE_DEBUG_CHANNEL(notid);
 
 static WINE_EXCEPTION_FILTER(page_fault)
 {
@@ -322,6 +331,8 @@
 
 	context->Eip = (DWORD)fun->origfun;
 
+        if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+            DPRINTF("%08lx:",GetCurrentThreadId());
 	DPRINTF("CALL %s.%ld: %s(",dll->name,ordinal,fun->name);
 	if (fun->nrofargs>0) {
 		max = fun->nrofargs; if (max>16) max=16;
@@ -334,7 +345,7 @@
 		ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(DWORD));
 		memcpy(ret->args,(LPBYTE)(context->Esp + 4),sizeof(DWORD)*16);
 	}
-	DPRINTF(") ret=%08lx fs=%04lx\n",(DWORD)ret->origreturn,context->SegFs);
+	DPRINTF(") ret=%08lx\n",(DWORD)ret->origreturn);
 }
 
 
@@ -350,6 +361,8 @@
 	if (ret->dll->funs[ret->ordinal].nrofargs<0)
 		ret->dll->funs[ret->ordinal].nrofargs=(context->Esp - ret->origESP-4)/4;
 	context->Eip = (DWORD)ret->origreturn;
+        if (TRACE_ON(tid) || (TRACE_ON(relay) && !TRACE_ON(notid)))
+            DPRINTF("%08lx:",GetCurrentThreadId());
 	if (ret->args) {
 		int	i,max;
 
@@ -359,8 +372,8 @@
 
 		for (i=0;i<max;i++)
 			DPRINTF("%s%s",SNOOP_PrintArg(ret->args[i]),(i<max-1)?",":"");
-		DPRINTF(") retval = %08lx ret=%08lx fs=%04lx\n",
-			context->Eax,(DWORD)ret->origreturn,context->SegFs );
+		DPRINTF(") retval = %08lx ret=%08lx\n",
+			context->Eax,(DWORD)ret->origreturn );
 		HeapFree(GetProcessHeap(),0,ret->args);
 		ret->args = NULL;
 	} else


More information about the wine-devel mailing list