Commit ac13d2f4 authored by Alexandre Julliard's avatar Alexandre Julliard

Print thread ids in traces with only 4 digits now that they are small

integers.
parent 8bc93e2d
...@@ -43,9 +43,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -43,9 +43,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
MSVCRT_thread_data *tls; MSVCRT_thread_data *tls;
TRACE("(%p, %s, %p) pid(%ld), tid(%ld), tls(%ld)\n", TRACE("(%p, %s, %p) pid(%lx), tid(%lx), tls(%ld)\n",
hinstDLL, msvcrt_get_reason(fdwReason), lpvReserved, hinstDLL, msvcrt_get_reason(fdwReason), lpvReserved,
(long)GetCurrentProcessId(), (long)GetCurrentThreadId(), GetCurrentProcessId(), GetCurrentThreadId(),
(long)MSVCRT_tls_index); (long)MSVCRT_tls_index);
switch (fdwReason) switch (fdwReason)
......
...@@ -117,12 +117,12 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit ) ...@@ -117,12 +117,12 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
{ {
const char *name = (char *)crit->DebugInfo; const char *name = (char *)crit->DebugInfo;
if (!name) name = "?"; if (!name) name = "?";
ERR( "section %p %s wait timed out, retrying (60 sec) tid=%08lx\n", ERR( "section %p %s wait timed out, retrying (60 sec) tid=%04lx\n",
crit, debugstr_a(name), GetCurrentThreadId() ); crit, debugstr_a(name), GetCurrentThreadId() );
res = WaitForSingleObject( sem, 60000L ); res = WaitForSingleObject( sem, 60000L );
if ( res == WAIT_TIMEOUT && TRACE_ON(relay) ) if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
{ {
ERR( "section %p %s wait timed out, retrying (5 min) tid=%08lx\n", ERR( "section %p %s wait timed out, retrying (5 min) tid=%04lx\n",
crit, debugstr_a(name), GetCurrentThreadId() ); crit, debugstr_a(name), GetCurrentThreadId() );
res = WaitForSingleObject( sem, 300000L ); res = WaitForSingleObject( sem, 300000L );
} }
......
...@@ -307,7 +307,7 @@ static int NTDLL_dbg_vlog( unsigned int cls, const char *channel, ...@@ -307,7 +307,7 @@ static int NTDLL_dbg_vlog( unsigned int cls, const char *channel,
int ret = 0; int ret = 0;
if (TRACE_ON(tid)) if (TRACE_ON(tid))
ret = wine_dbg_printf( "%08lx:", NtCurrentTeb()->tid ); ret = wine_dbg_printf( "%04lx:", NtCurrentTeb()->tid );
if (cls < sizeof(classes)/sizeof(classes[0])) if (cls < sizeof(classes)/sizeof(classes[0]))
ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function ); ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
if (format) if (format)
......
...@@ -228,7 +228,7 @@ static LRESULT call_hook( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM ...@@ -228,7 +228,7 @@ static LRESULT call_hook( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM
LRESULT ret; LRESULT ret;
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF( "%08lx:Call hook proc %p (id=%s,code=%x,wp=%08x,lp=%08lx)\n", DPRINTF( "%04lx:Call hook proc %p (id=%s,code=%x,wp=%08x,lp=%08lx)\n",
GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam ); GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam );
if (!prev_unicode == !next_unicode) ret = proc( code, wparam, lparam ); if (!prev_unicode == !next_unicode) ret = proc( code, wparam, lparam );
...@@ -236,7 +236,7 @@ static LRESULT call_hook( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM ...@@ -236,7 +236,7 @@ static LRESULT call_hook( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM
else ret = call_hook_AtoW( proc, id, code, wparam, lparam ); else ret = call_hook_AtoW( proc, id, code, wparam, lparam );
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF( "%08lx:Ret hook proc %p (id=%s,code=%x,wp=%08x,lp=%08lx) retval=%08lx\n", DPRINTF( "%04lx:Ret hook proc %p (id=%s,code=%x,wp=%08x,lp=%08lx) retval=%08lx\n",
GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam, ret ); GetCurrentThreadId(), proc, hook_names[id-WH_MINHOOK], code, wparam, lparam, ret );
return ret; return ret;
......
...@@ -5464,7 +5464,7 @@ INT X11DRV_DIB_Lock(BITMAPOBJ *bmp, INT req, BOOL lossy) ...@@ -5464,7 +5464,7 @@ INT X11DRV_DIB_Lock(BITMAPOBJ *bmp, INT req, BOOL lossy)
INT ret = DIB_Status_None; INT ret = DIB_Status_None;
if (dib) { if (dib) {
TRACE("Locking %p from thread %08lx\n", bmp, GetCurrentThreadId()); TRACE("Locking %p from thread %04lx\n", bmp, GetCurrentThreadId());
EnterCriticalSection(&(dib->lock)); EnterCriticalSection(&(dib->lock));
ret = dib->status; ret = dib->status;
if (req != DIB_Status_None) if (req != DIB_Status_None)
......
...@@ -254,7 +254,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) ...@@ -254,7 +254,7 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
call = get_entry_point( frame, funstr, &ordinal ); call = get_entry_point( frame, funstr, &ordinal );
if (!call) return; /* happens for the two snoop register relays */ if (!call) return; /* happens for the two snoop register relays */
if (!RELAY_ShowDebugmsgRelay(funstr)) return; if (!RELAY_ShowDebugmsgRelay(funstr)) return;
DPRINTF( "%08lx:Call %s(",GetCurrentThreadId(),funstr); DPRINTF( "%04lx:Call %s(",GetCurrentThreadId(),funstr);
VA_START16( args16 ); VA_START16( args16 );
if (call->lret == 0xcb66) /* cdecl */ if (call->lret == 0xcb66) /* cdecl */
...@@ -364,7 +364,7 @@ void RELAY_DebugCallFrom16Ret( CONTEXT86 *context, int ret_val ) ...@@ -364,7 +364,7 @@ void RELAY_DebugCallFrom16Ret( CONTEXT86 *context, int ret_val )
call = get_entry_point( frame, funstr, &ordinal ); call = get_entry_point( frame, funstr, &ordinal );
if (!call) return; if (!call) return;
if (!RELAY_ShowDebugmsgRelay(funstr)) return; if (!RELAY_ShowDebugmsgRelay(funstr)) return;
DPRINTF( "%08lx:Ret %s() ",GetCurrentThreadId(),funstr); DPRINTF( "%04lx:Ret %s() ",GetCurrentThreadId(),funstr);
if (call->arg_types[0] & ARG_REGISTER) if (call->arg_types[0] & ARG_REGISTER)
{ {
...@@ -412,7 +412,7 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func ) ...@@ -412,7 +412,7 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func )
{ {
CONTEXT86 *context = (CONTEXT86 *)target; CONTEXT86 *context = (CONTEXT86 *)target;
DPRINTF("%08lx:CallTo16(func=%04lx:%04x,ds=%04lx", DPRINTF("%04lx:CallTo16(func=%04lx:%04x,ds=%04lx",
GetCurrentThreadId(), GetCurrentThreadId(),
context->SegCs, LOWORD(context->Eip), context->SegDs ); context->SegCs, LOWORD(context->Eip), context->SegDs );
while (nb_args--) DPRINTF( ",%04x", *--stack16 ); while (nb_args--) DPRINTF( ",%04x", *--stack16 );
...@@ -425,7 +425,7 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func ) ...@@ -425,7 +425,7 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func )
} }
else else
{ {
DPRINTF("%08lx:CallTo16(func=%04x:%04x,ds=%04x", DPRINTF("%04lx:CallTo16(func=%04x:%04x,ds=%04x",
GetCurrentThreadId(), GetCurrentThreadId(),
HIWORD(target), LOWORD(target), SELECTOROF(teb->cur_stack) ); HIWORD(target), LOWORD(target), SELECTOROF(teb->cur_stack) );
while (nb_args--) DPRINTF( ",%04x", *--stack16 ); while (nb_args--) DPRINTF( ",%04x", *--stack16 );
...@@ -446,7 +446,7 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val ) ...@@ -446,7 +446,7 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val )
if (!reg_func) if (!reg_func)
{ {
DPRINTF("%08lx:RetFrom16() ss:sp=%04x:%04x retval=%08x\n", DPRINTF("%04lx:RetFrom16() ss:sp=%04x:%04x retval=%08x\n",
GetCurrentThreadId(), GetCurrentThreadId(),
SELECTOROF(NtCurrentTeb()->cur_stack), SELECTOROF(NtCurrentTeb()->cur_stack),
OFFSETOF(NtCurrentTeb()->cur_stack), ret_val); OFFSETOF(NtCurrentTeb()->cur_stack), ret_val);
...@@ -455,7 +455,7 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val ) ...@@ -455,7 +455,7 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val )
{ {
CONTEXT86 *context = (CONTEXT86 *)ret_val; CONTEXT86 *context = (CONTEXT86 *)ret_val;
DPRINTF("%08lx:RetFrom16() ss:sp=%04x:%04x ", DPRINTF("%04lx:RetFrom16() ss:sp=%04x:%04x ",
GetCurrentThreadId(), GetCurrentThreadId(),
SELECTOROF(NtCurrentTeb()->cur_stack), SELECTOROF(NtCurrentTeb()->cur_stack),
OFFSETOF(NtCurrentTeb()->cur_stack)); OFFSETOF(NtCurrentTeb()->cur_stack));
......
...@@ -624,11 +624,11 @@ BOOL PE_InitDLL( HMODULE module, DWORD type, LPVOID lpReserved ) ...@@ -624,11 +624,11 @@ BOOL PE_InitDLL( HMODULE module, DWORD type, LPVOID lpReserved )
{ {
DLLENTRYPROC entry = (void*)((char*)module + nt->OptionalHeader.AddressOfEntryPoint); DLLENTRYPROC entry = (void*)((char*)module + nt->OptionalHeader.AddressOfEntryPoint);
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF("%08lx:Call PE DLL (proc=%p,module=%p,type=%ld,res=%p)\n", DPRINTF("%04lx:Call PE DLL (proc=%p,module=%p,type=%ld,res=%p)\n",
GetCurrentThreadId(), entry, module, type, lpReserved ); GetCurrentThreadId(), entry, module, type, lpReserved );
retv = entry( module, type, lpReserved ); retv = entry( module, type, lpReserved );
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF("%08lx:Ret PE DLL (proc=%p,module=%p,type=%ld,res=%p) retval=%x\n", DPRINTF("%04lx:Ret PE DLL (proc=%p,module=%p,type=%ld,res=%p) retval=%x\n",
GetCurrentThreadId(), entry, module, type, lpReserved, retv ); GetCurrentThreadId(), entry, module, type, lpReserved, retv );
} }
......
...@@ -412,7 +412,7 @@ static LONGLONG RELAY_CallFrom32( int ret_addr, ... ) ...@@ -412,7 +412,7 @@ static LONGLONG RELAY_CallFrom32( int ret_addr, ... )
{ {
get_entry_point( buffer, relay ); get_entry_point( buffer, relay );
DPRINTF( "%08lx:Call %s(", GetCurrentThreadId(), buffer ); DPRINTF( "%04lx:Call %s(", GetCurrentThreadId(), buffer );
RELAY_PrintArgs( args, nb_args, relay->argtypes ); RELAY_PrintArgs( args, nb_args, relay->argtypes );
DPRINTF( ") ret=%08x\n", ret_addr ); DPRINTF( ") ret=%08x\n", ret_addr );
} }
...@@ -430,11 +430,11 @@ static LONGLONG RELAY_CallFrom32( int ret_addr, ... ) ...@@ -430,11 +430,11 @@ static LONGLONG RELAY_CallFrom32( int ret_addr, ... )
{ {
BOOL ret64 = (relay->argtypes & 0x80000000) && (nb_args < 16); BOOL ret64 = (relay->argtypes & 0x80000000) && (nb_args < 16);
if (ret64) if (ret64)
DPRINTF( "%08lx:Ret %s() retval=%08x%08x ret=%08x\n", DPRINTF( "%04lx:Ret %s() retval=%08x%08x ret=%08x\n",
GetCurrentThreadId(), GetCurrentThreadId(),
buffer, (UINT)(ret >> 32), (UINT)ret, ret_addr ); buffer, (UINT)(ret >> 32), (UINT)ret, ret_addr );
else else
DPRINTF( "%08lx:Ret %s() retval=%08x ret=%08x\n", DPRINTF( "%04lx:Ret %s() retval=%08x ret=%08x\n",
GetCurrentThreadId(), GetCurrentThreadId(),
buffer, (UINT)ret, ret_addr ); buffer, (UINT)ret, ret_addr );
} }
...@@ -478,7 +478,7 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context ) ...@@ -478,7 +478,7 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context )
{ {
get_entry_point( buffer, relay ); get_entry_point( buffer, relay );
DPRINTF( "%08lx:Call %s(", GetCurrentThreadId(), buffer ); DPRINTF( "%04lx:Call %s(", GetCurrentThreadId(), buffer );
RELAY_PrintArgs( args, nb_args, relay->argtypes ); RELAY_PrintArgs( args, nb_args, relay->argtypes );
DPRINTF( ") ret=%08lx fs=%04lx\n", context->Eip, context->SegFs ); DPRINTF( ") ret=%08lx fs=%04lx\n", context->Eip, context->SegFs );
...@@ -505,7 +505,7 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context ) ...@@ -505,7 +505,7 @@ void WINAPI RELAY_DoCallFrom32Regs( CONTEXT86 *context )
if (TRACE_ON(relay)) if (TRACE_ON(relay))
{ {
DPRINTF( "%08lx:Ret %s() retval=%08lx ret=%08lx fs=%04lx\n", DPRINTF( "%04lx:Ret %s() retval=%08lx ret=%08lx fs=%04lx\n",
GetCurrentThreadId(), GetCurrentThreadId(),
buffer, context->Eax, context->Eip, context->SegFs ); buffer, context->Eax, context->Eip, context->SegFs );
......
...@@ -315,7 +315,7 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context ) ...@@ -315,7 +315,7 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context )
context->Eip = (DWORD)fun->origfun; context->Eip = (DWORD)fun->origfun;
DPRINTF("%08lx:CALL %s.%ld: %s(",GetCurrentThreadId(),dll->name,dll->ordbase+ordinal,fun->name); DPRINTF("%04lx:CALL %s.%ld: %s(",GetCurrentThreadId(),dll->name,dll->ordbase+ordinal,fun->name);
if (fun->nrofargs>0) { if (fun->nrofargs>0) {
max = fun->nrofargs; if (max>16) max=16; max = fun->nrofargs; if (max>16) max=16;
for (i=0;i<max;i++) for (i=0;i<max;i++)
...@@ -349,7 +349,7 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context ) ...@@ -349,7 +349,7 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
if (ret->args) { if (ret->args) {
int i,max; int i,max;
DPRINTF("%08lx:RET %s.%ld: %s(", DPRINTF("%04lx:RET %s.%ld: %s(",
GetCurrentThreadId(), GetCurrentThreadId(),
ret->dll->name,ret->dll->ordbase+ret->ordinal,ret->dll->funs[ret->ordinal].name); ret->dll->name,ret->dll->ordbase+ret->ordinal,ret->dll->funs[ret->ordinal].name);
max = ret->dll->funs[ret->ordinal].nrofargs; max = ret->dll->funs[ret->ordinal].nrofargs;
...@@ -365,7 +365,7 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context ) ...@@ -365,7 +365,7 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
HeapFree(GetProcessHeap(),0,ret->args); HeapFree(GetProcessHeap(),0,ret->args);
ret->args = NULL; ret->args = NULL;
} else } else
DPRINTF("%08lx:RET %s.%ld: %s() retval = %08lx ret=%08lx\n", DPRINTF("%04lx:RET %s.%ld: %s() retval = %08lx ret=%08lx\n",
GetCurrentThreadId(), GetCurrentThreadId(),
ret->dll->name,ret->dll->ordbase+ret->ordinal,ret->dll->funs[ret->ordinal].name, ret->dll->name,ret->dll->ordbase+ret->ordinal,ret->dll->funs[ret->ordinal].name,
context->Eax, (DWORD)ret->origreturn); context->Eax, (DWORD)ret->origreturn);
......
...@@ -263,7 +263,7 @@ static void THREAD_Start(void) ...@@ -263,7 +263,7 @@ static void THREAD_Start(void)
LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)NtCurrentTeb()->entry_point; LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)NtCurrentTeb()->entry_point;
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF("%08lx:Starting thread (entryproc=%p)\n", GetCurrentThreadId(), func ); DPRINTF("%04lx:Starting thread (entryproc=%p)\n", GetCurrentThreadId(), func );
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 ); PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 );
MODULE_DllThreadAttach( NULL ); MODULE_DllThreadAttach( NULL );
...@@ -886,7 +886,7 @@ DWORD WINAPI GetCurrentProcessId(void) ...@@ -886,7 +886,7 @@ DWORD WINAPI GetCurrentProcessId(void)
*/ */
DWORD WINAPI GetCurrentThreadId(void) DWORD WINAPI GetCurrentThreadId(void)
{ {
return (DWORD)NtCurrentTeb()->tid; return NtCurrentTeb()->tid;
} }
#endif /* __i386__ */ #endif /* __i386__ */
...@@ -2284,7 +2284,7 @@ void SPY_EnterMessage( INT iFlag, HWND hWnd, UINT msg, ...@@ -2284,7 +2284,7 @@ void SPY_EnterMessage( INT iFlag, HWND hWnd, UINT msg,
DWORD tid = GetWindowThreadProcessId( hWnd, NULL ); DWORD tid = GetWindowThreadProcessId( hWnd, NULL );
if (tid == GetCurrentThreadId()) strcpy( taskName, "self" ); if (tid == GetCurrentThreadId()) strcpy( taskName, "self" );
else sprintf( taskName, "tid %08lx", GetCurrentThreadId() ); else sprintf( taskName, "tid %04lx", GetCurrentThreadId() );
if (iFlag == SPY_SENDMESSAGE16) if (iFlag == SPY_SENDMESSAGE16)
TRACE("%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n", TRACE("%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment