Commit 1729cc05 authored by Alexandre Julliard's avatar Alexandre Julliard

krnl386: Use the magic format string prefix for relay traces.

parent 822e1424
......@@ -558,7 +558,7 @@ static LONG WINAPI exception_handler(EXCEPTION_POINTERS *eptr)
switch(rec->ExceptionCode) {
case EXCEPTION_VM86_INTx:
TRACE_(relay)("Call DOS int 0x%02x ret=%04x:%04x\n"
TRACE_(relay)("\1Call DOS int 0x%02x ret=%04x:%04x\n"
" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n"
" ebp=%08x esp=%08x ds=%04x es=%04x fs=%04x gs=%04x flags=%08x\n",
arg, context->SegCs, context->Eip,
......@@ -566,7 +566,7 @@ static LONG WINAPI exception_handler(EXCEPTION_POINTERS *eptr)
context->Ebp, context->Esp, context->SegDs, context->SegEs, context->SegFs, context->SegGs,
context->EFlags );
ret = DOSVM_EmulateInterruptRM( context, arg );
TRACE_(relay)("Ret DOS int 0x%02x ret=%04x:%04x\n"
TRACE_(relay)("\1Ret DOS int 0x%02x ret=%04x:%04x\n"
" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n"
" ebp=%08x esp=%08x ds=%04x es=%04x fs=%04x gs=%04x flags=%08x\n",
arg, context->SegCs, context->Eip,
......
......@@ -261,7 +261,7 @@ static void DOSVM_PushFlags( CONTEXT *context, BOOL islong, BOOL isstub )
*/
BOOL DOSVM_EmulateInterruptPM( CONTEXT *context, BYTE intnum )
{
TRACE_(relay)("Call DOS int 0x%02x ret=%04x:%08x\n"
TRACE_(relay)("\1Call DOS int 0x%02x ret=%04x:%08x\n"
" eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
" esi=%08x edi=%08x ebp=%08x esp=%08x\n"
" ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x\n",
......@@ -450,7 +450,7 @@ void DOSVM_HardwareInterruptPM( CONTEXT *context, BYTE intnum )
*/
BOOL DOSVM_EmulateInterruptRM( CONTEXT *context, BYTE intnum )
{
TRACE_(relay)("Call DOS int 0x%02x ret=%04x:%08x\n"
TRACE_(relay)("\1Call DOS int 0x%02x ret=%04x:%08x\n"
" eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
" esi=%08x edi=%08x ebp=%08x esp=%08x\n"
" ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x\n",
......
......@@ -446,7 +446,7 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
if (!TRACE_ON(relay) || !RELAY_ShowDebugmsgRelay( module, ordinal, func ))
return relay_call_from_16_no_debug( entry_point, args16, context, call );
DPRINTF( "%04x:Call %s.%d: %s(",GetCurrentThreadId(), module, ordinal, func );
TRACE( "\1Call %s.%d: %s(", module, ordinal, func );
/* look for the ret instruction */
for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
......@@ -459,43 +459,42 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
if (type == ARG_NONE) break;
if (i) DPRINTF( "," );
if (i) TRACE( "," );
switch(type)
{
case ARG_WORD:
DPRINTF( "%04x", *(WORD *)args16 );
TRACE( "%04x", *(WORD *)args16 );
args32[nb_args] = *(WORD *)args16;
args16 += sizeof(WORD);
break;
case ARG_SWORD:
DPRINTF( "%04x", *(WORD *)args16 );
TRACE( "%04x", *(WORD *)args16 );
args32[nb_args] = *(short *)args16;
args16 += sizeof(WORD);
break;
case ARG_LONG:
DPRINTF( "%08x", *(int *)args16 );
TRACE( "%08x", *(int *)args16 );
args32[nb_args] = *(int *)args16;
args16 += sizeof(int);
break;
case ARG_PTR:
DPRINTF( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
TRACE( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
args16 += sizeof(SEGPTR);
break;
case ARG_STR:
DPRINTF( "%08x %s", *(int *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )));
TRACE( "%08x %s", *(int *)args16, debugstr_a( MapSL(*(SEGPTR *)args16 )));
args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
args16 += sizeof(int);
break;
case ARG_SEGSTR:
DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )) );
TRACE( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )) );
args32[nb_args] = *(SEGPTR *)args16;
args16 += sizeof(SEGPTR);
break;
case ARG_VARARG:
DPRINTF( "..." );
TRACE( "..." );
args32[nb_args] = (int)args16;
break;
default:
......@@ -512,43 +511,42 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
int type = (call->arg_types[i / 10] >> (3 * (i % 10))) & 7;
if (type == ARG_NONE) break;
if (i) DPRINTF( "," );
if (i) TRACE( "," );
switch(type)
{
case ARG_WORD:
args16 -= sizeof(WORD);
args32[nb_args] = *(WORD *)args16;
DPRINTF( "%04x", *(WORD *)args16 );
TRACE( "%04x", *(WORD *)args16 );
break;
case ARG_SWORD:
args16 -= sizeof(WORD);
args32[nb_args] = *(short *)args16;
DPRINTF( "%04x", *(WORD *)args16 );
TRACE( "%04x", *(WORD *)args16 );
break;
case ARG_LONG:
args16 -= sizeof(int);
args32[nb_args] = *(int *)args16;
DPRINTF( "%08x", *(int *)args16 );
TRACE( "%08x", *(int *)args16 );
break;
case ARG_PTR:
args16 -= sizeof(SEGPTR);
args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
DPRINTF( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
TRACE( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
break;
case ARG_STR:
args16 -= sizeof(int);
args32[nb_args] = (int)MapSL( *(SEGPTR *)args16 );
DPRINTF( "%08x %s", *(int *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )));
TRACE( "%08x %s", *(int *)args16, debugstr_a( MapSL(*(SEGPTR *)args16 )));
break;
case ARG_SEGSTR:
args16 -= sizeof(SEGPTR);
args32[nb_args] = *(SEGPTR *)args16;
DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )) );
TRACE( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugstr_a( MapSL(*(SEGPTR *)args16 )) );
break;
case ARG_VARARG:
DPRINTF( "..." );
TRACE( "..." );
args32[nb_args] = (int)args16;
break;
default:
......@@ -557,16 +555,15 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
}
}
DPRINTF( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
if (!j) /* register function */
{
args32[nb_args++] = (int)context;
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08x\n",
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
(WORD)context->SegEs, context->EFlags );
TRACE( ") ret=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x ds=%04x es=%04x efl=%08x\n",
frame->cs, frame->ip, (WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi, (WORD)context->SegDs,
(WORD)context->SegEs, context->EFlags );
}
else TRACE( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
SYSLEVEL_CheckNotLevel( 2 );
......@@ -574,24 +571,22 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
SYSLEVEL_CheckNotLevel( 2 );
DPRINTF( "%04x:Ret %s.%d: %s() ",GetCurrentThreadId(), module, ordinal, func );
TRACE( "\1Ret %s.%d: %s() ", module, ordinal, func );
if (!j) /* register function */
{
DPRINTF("retval=none ret=%04x:%04x ds=%04x\n",
(WORD)context->SegCs, LOWORD(context->Eip), (WORD)context->SegDs);
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08x\n",
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
(WORD)context->SegEs, context->EFlags );
TRACE( "retval=none ret=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x ds=%04x es=%04x efl=%08x\n",
(WORD)context->SegCs, LOWORD(context->Eip), (WORD)context->Eax, (WORD)context->Ebx,
(WORD)context->Ecx, (WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
(WORD)context->SegDs, (WORD)context->SegEs, context->EFlags );
}
else
{
frame = CURRENT_STACK16; /* might have be changed by the entry point */
if (j == 1) /* 16-bit return sequence */
DPRINTF( "retval=%04x ret=%04x:%04x ds=%04x\n",
TRACE( "retval=%04x ret=%04x:%04x ds=%04x\n",
ret_val & 0xffff, frame->cs, frame->ip, frame->ds );
else
DPRINTF( "retval=%08x ret=%04x:%04x ds=%04x\n",
TRACE( "retval=%08x ret=%04x:%04x ds=%04x\n",
ret_val, frame->cs, frame->ip, frame->ds );
}
return ret_val;
......
......@@ -289,20 +289,20 @@ static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT *context) {
context->SegCs = HIWORD(fun->origfun);
DPRINTF("%04x:CALL %s.%d: %s(",GetCurrentThreadId(), dll->name,ordinal,fun->name);
TRACE("\1CALL %s.%d: %s(", dll->name, ordinal, fun->name);
if (fun->nrofargs>0) {
max = fun->nrofargs;
if (max>16) max=16;
for (i=max;i--;)
DPRINTF("%04x%s",*(WORD*)((char *) MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)) )+8+sizeof(WORD)*i),i?",":"");
TRACE("%04x%s",*(WORD*)((char *) MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)) )+8+sizeof(WORD)*i),i?",":"");
if (max!=fun->nrofargs)
DPRINTF(" ...");
TRACE(" ...");
} else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>");
TRACE("<unknown, check return>");
ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(WORD));
memcpy(ret->args,(LPBYTE)((char *) MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)) )+8),sizeof(WORD)*16);
}
DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
TRACE(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
}
static void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT *context) {
......@@ -318,9 +318,7 @@ static void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT *context) {
}
context->Eip = LOWORD(ret->origreturn);
context->SegCs = HIWORD(ret->origreturn);
DPRINTF("%04x:RET %s.%d: %s(",
GetCurrentThreadId(),ret->dll->name,ret->ordinal,
ret->dll->funs[ret->ordinal].name);
TRACE("\1RET %s.%d: %s(", ret->dll->name, ret->ordinal, ret->dll->funs[ret->ordinal].name);
if (ret->args) {
int i,max;
......@@ -331,14 +329,14 @@ static void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT *context) {
max=0;
for (i=max;i--;)
DPRINTF("%04x%s",ret->args[i],i?",":"");
TRACE("%04x%s",ret->args[i],i?",":"");
if (max!=ret->dll->funs[ret->ordinal].nrofargs)
DPRINTF(" ...");
TRACE(" ...");
HeapFree(GetProcessHeap(),0,ret->args);
ret->args = NULL;
}
DPRINTF(") retval = %04x:%04x ret=%04x:%04x\n",
(WORD)context->Edx,(WORD)context->Eax,
HIWORD(ret->origreturn),LOWORD(ret->origreturn));
TRACE(") retval = %04x:%04x ret=%04x:%04x\n",
(WORD)context->Edx,(WORD)context->Eax,
HIWORD(ret->origreturn),LOWORD(ret->origreturn));
ret->origreturn = NULL; /* mark as empty */
}
......@@ -538,16 +538,14 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
DWORD count = cbArgs / sizeof(WORD);
WORD * wstack = (WORD *)stack;
DPRINTF("%04x:CallTo16(func=%04x:%04x,ds=%04x",
GetCurrentThreadId(),
context->SegCs, LOWORD(context->Eip), context->SegDs );
while (count) DPRINTF( ",%04x", wstack[--count] );
DPRINTF(") ss:sp=%04x:%04x",
SELECTOROF(NtCurrentTeb()->WOW32Reserved), OFFSETOF(NtCurrentTeb()->WOW32Reserved) );
DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x es=%04x fs=%04x\n",
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
(WORD)context->Ebp, (WORD)context->SegEs, (WORD)context->SegFs );
TRACE_(relay)( "\1CallTo16(func=%04x:%04x", context->SegCs, LOWORD(context->Eip) );
while (count) TRACE_(relay)( ",%04x", wstack[--count] );
TRACE_(relay)( ") ss:sp=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x ds=%04x es=%04x\n",
SELECTOROF(NtCurrentTeb()->WOW32Reserved),
OFFSETOF(NtCurrentTeb()->WOW32Reserved),
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
(WORD)context->Ebp, (WORD)context->SegDs, (WORD)context->SegEs );
SYSLEVEL_CheckNotLevel( 2 );
}
......@@ -607,12 +605,11 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
if (TRACE_ON(relay))
{
DPRINTF("%04x:RetFrom16() ss:sp=%04x:%04x ",
GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->WOW32Reserved),
OFFSETOF(NtCurrentTeb()->WOW32Reserved));
DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x\n",
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Ebp, (WORD)context->Esp );
TRACE_(relay)( "\1RetFrom16() ss:sp=%04x:%04x ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x\n",
SELECTOROF(NtCurrentTeb()->WOW32Reserved),
OFFSETOF(NtCurrentTeb()->WOW32Reserved),
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
(WORD)context->Edx, (WORD)context->Ebp, (WORD)context->Esp );
SYSLEVEL_CheckNotLevel( 2 );
}
}
......@@ -625,12 +622,11 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
DWORD count = cbArgs / sizeof(WORD);
WORD * wstack = (WORD *)stack;
DPRINTF("%04x:CallTo16(func=%04x:%04x,ds=%04x",
GetCurrentThreadId(), HIWORD(vpfn16), LOWORD(vpfn16),
SELECTOROF(NtCurrentTeb()->WOW32Reserved) );
while (count) DPRINTF( ",%04x", wstack[--count] );
DPRINTF(") ss:sp=%04x:%04x\n",
SELECTOROF(NtCurrentTeb()->WOW32Reserved), OFFSETOF(NtCurrentTeb()->WOW32Reserved) );
TRACE_(relay)( "\1CallTo16(func=%04x:%04x,ds=%04x",
HIWORD(vpfn16), LOWORD(vpfn16), SELECTOROF(NtCurrentTeb()->WOW32Reserved) );
while (count) TRACE_(relay)( ",%04x", wstack[--count] );
TRACE_(relay)( ") ss:sp=%04x:%04x\n", SELECTOROF(NtCurrentTeb()->WOW32Reserved),
OFFSETOF(NtCurrentTeb()->WOW32Reserved) );
SYSLEVEL_CheckNotLevel( 2 );
}
......@@ -652,9 +648,9 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
if (TRACE_ON(relay))
{
DPRINTF("%04x:RetFrom16() ss:sp=%04x:%04x retval=%08x\n",
GetCurrentThreadId(), SELECTOROF(NtCurrentTeb()->WOW32Reserved),
OFFSETOF(NtCurrentTeb()->WOW32Reserved), ret);
TRACE_(relay)( "\1RetFrom16() ss:sp=%04x:%04x retval=%08x\n",
SELECTOROF(NtCurrentTeb()->WOW32Reserved),
OFFSETOF(NtCurrentTeb()->WOW32Reserved), ret );
SYSLEVEL_CheckNotLevel( 2 );
}
}
......
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