From 4ea3c26a7d8de7c8298cdf0e1fbd31c7349e874c Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@codeweavers.com>
Date: Mon, 9 Apr 2001 18:47:10 +0000
Subject: [PATCH] Display thread id instead of %fs in relay trace.

---
 relay32/relay386.c  | 16 +++++++++-------
 scheduler/process.c |  3 ++-
 scheduler/thread.c  |  3 +++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/relay32/relay386.c b/relay32/relay386.c
index 16519366f35..d4e251b7ae3 100644
--- a/relay32/relay386.c
+++ b/relay32/relay386.c
@@ -128,8 +128,10 @@ static void get_entry_point( char *buffer, DEBUG_ENTRY_POINT *relay )
 
     /* Now find the function */
 
-    name = find_exported_name( base, exp, ordinal + exp->Base );
-    sprintf( buffer, "%s.%ld: %s", base + exp->Name, ordinal + exp->Base, name ? name : "@" );
+    if ((name = find_exported_name( base, exp, ordinal + exp->Base )))
+        sprintf( buffer, "%s.%s", base + exp->Name, name );
+    else
+        sprintf( buffer, "%s.%ld", base + exp->Name, ordinal + exp->Base );
 }
 
 
@@ -183,7 +185,7 @@ static LONGLONG RELAY_CallFrom32( int ret_addr, ... )
 
     DPRINTF( "Call %s(", buffer );
     RELAY_PrintArgs( args, nb_args, relay->argtypes );
-    DPRINTF( ") ret=%08x fs=%04x\n", ret_addr, __get_fs() );
+    DPRINTF( ") ret=%08x tid=%08lx\n", ret_addr, GetCurrentThreadId() );
     ret64 = (relay->argtypes & 0x80000000) && (nb_args < 16);
 
     /* the user driver functions may be called with the window lock held */
@@ -277,11 +279,11 @@ static LONGLONG RELAY_CallFrom32( int ret_addr, ... )
         }
     }
     if (ret64)
-        DPRINTF( "Ret  %s() retval=%08x%08x ret=%08x fs=%04x\n",
-                 buffer, (UINT)(ret >> 32), (UINT)ret, ret_addr, __get_fs() );
+        DPRINTF( "Ret  %s() retval=%08x%08x ret=%08x tid=%08lx\n",
+                 buffer, (UINT)(ret >> 32), (UINT)ret, ret_addr, GetCurrentThreadId() );
     else
-        DPRINTF( "Ret  %s() retval=%08x ret=%08x fs=%04x\n",
-                 buffer, (UINT)ret, ret_addr, __get_fs() );
+        DPRINTF( "Ret  %s() retval=%08x ret=%08x tid=%08lx\n",
+                 buffer, (UINT)ret, ret_addr, GetCurrentThreadId() );
 
     if (memcmp( buffer, "x11drv.", 7 ) && memcmp( buffer, "ttydrv.", 7 ))
       SYSLEVEL_CheckNotLevel( 2 );
diff --git a/scheduler/process.c b/scheduler/process.c
index 6d3ad5ecaff..7f4fb98bb51 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -393,7 +393,8 @@ static void start_process(void)
     /* Call UserSignalProc ( USIG_PROCESS_RUNNING ... ) only for non-GUI win32 apps */
     if (console_app) PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0 );
 
-    TRACE_(relay)( "Starting Win32 process %s (entryproc=%p)\n", main_exe_name, entry );
+    TRACE_(relay)( "Starting Win32 process %s (entryproc=%p) tid=%08lx\n",
+                   main_exe_name, entry, GetCurrentThreadId() );
     if (debugged) DbgBreakPoint();
     /* FIXME: should use _PEB as parameter for NT 3.5 programs !
      * Dunno about other OSs */
diff --git a/scheduler/thread.c b/scheduler/thread.c
index b0410f58ae9..49df3c7eb23 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -30,6 +30,7 @@
 #include "winnls.h"
 
 DEFAULT_DEBUG_CHANNEL(thread);
+DECLARE_DEBUG_CHANNEL(relay);
 
 /* TEB of the initial thread */
 static TEB initial_teb;
@@ -271,6 +272,8 @@ static void THREAD_Start(void)
         NtCurrentTeb()->cleanup = SERVICE_AddObject( cleanup_object, (PAPCFUNC)THREAD_FreeTEB,
                                                      (ULONG_PTR)NtCurrentTeb() );
 
+    TRACE_(relay)("Starting thread %08lx\n", GetCurrentThreadId());
+
     PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 );
     PE_InitTls();
     MODULE_DllThreadAttach( NULL );
-- 
GitLab