Commit bd02a82d authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

ntdll: Handle 64-bit addresses in +seh traces on x64.

parent 63de9483
...@@ -241,11 +241,11 @@ static void dump_scope_table( ULONG64 base, const SCOPE_TABLE *table ) ...@@ -241,11 +241,11 @@ static void dump_scope_table( ULONG64 base, const SCOPE_TABLE *table )
TRACE( "scope table at %p\n", table ); TRACE( "scope table at %p\n", table );
for (i = 0; i < table->Count; i++) for (i = 0; i < table->Count; i++)
TRACE( " %u: %lx-%lx handler %lx target %lx\n", i, TRACE( " %u: %p-%p handler %p target %p\n", i,
base + table->ScopeRecord[i].BeginAddress, (char *)base + table->ScopeRecord[i].BeginAddress,
base + table->ScopeRecord[i].EndAddress, (char *)base + table->ScopeRecord[i].EndAddress,
base + table->ScopeRecord[i].HandlerAddress, (char *)base + table->ScopeRecord[i].HandlerAddress,
base + table->ScopeRecord[i].JumpTarget ); (char *)base + table->ScopeRecord[i].JumpTarget );
} }
...@@ -384,8 +384,8 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C ...@@ -384,8 +384,8 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C
frame.Handler = nested_exception_handler; frame.Handler = nested_exception_handler;
__wine_push_frame( &frame ); __wine_push_frame( &frame );
TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n", TRACE( "calling handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
dispatch->LanguageHandler, rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch ); dispatch->LanguageHandler, rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, context, dispatch ); res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, context, dispatch );
TRACE( "handler at %p returned %u\n", dispatch->LanguageHandler, res ); TRACE( "handler at %p returned %u\n", dispatch->LanguageHandler, res );
...@@ -445,7 +445,7 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex ...@@ -445,7 +445,7 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex
dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit || dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit ||
dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase) dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase)
{ {
ERR( "invalid frame %lx (%p-%p)\n", dispatch.EstablisherFrame, ERR( "invalid frame %p (%p-%p)\n", (void *)dispatch.EstablisherFrame,
NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase ); NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase );
rec->ExceptionFlags |= EH_STACK_INVALID; rec->ExceptionFlags |= EH_STACK_INVALID;
break; break;
...@@ -480,8 +480,8 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex ...@@ -480,8 +480,8 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex
/* hack: call wine handlers registered in the tib list */ /* hack: call wine handlers registered in the tib list */
else while ((ULONG64)teb_frame < context.Rsp) else while ((ULONG64)teb_frame < context.Rsp)
{ {
TRACE( "found wine frame %p rsp %lx handler %p\n", TRACE( "found wine frame %p rsp %p handler %p\n",
teb_frame, context.Rsp, teb_frame->Handler ); teb_frame, (void *)context.Rsp, teb_frame->Handler );
dispatch.EstablisherFrame = (ULONG64)teb_frame; dispatch.EstablisherFrame = (ULONG64)teb_frame;
switch (call_teb_handler( rec, orig_context, &dispatch, teb_frame )) switch (call_teb_handler( rec, orig_context, &dispatch, teb_frame ))
{ {
...@@ -521,9 +521,9 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) ...@@ -521,9 +521,9 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
NTSTATUS status; NTSTATUS status;
DWORD c; DWORD c;
TRACE( "code=%x flags=%x addr=%p ip=%lx tid=%04x\n", TRACE( "code=%x flags=%x addr=%p ip=%p tid=%04x\n",
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
context->Rip, GetCurrentThreadId() ); (void *)context->Rip, GetCurrentThreadId() );
for (c = 0; c < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); c++) for (c = 0; c < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); c++)
TRACE( " info[%d]=%016lx\n", c, rec->ExceptionInformation[c] ); TRACE( " info[%d]=%016lx\n", c, rec->ExceptionInformation[c] );
...@@ -780,7 +780,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc, ...@@ -780,7 +780,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc,
unsigned int i, prolog_offset; unsigned int i, prolog_offset;
BOOL mach_frame = FALSE; BOOL mach_frame = FALSE;
TRACE( "type %x rip %lx rsp %lx\n", type, pc, context->Rsp ); TRACE( "type %x rip %p rsp %p\n", type, (void *)pc, (void *)context->Rsp );
if (TRACE_ON(seh)) dump_unwind_info( base, function ); if (TRACE_ON(seh)) dump_unwind_info( base, function );
frame = *frame_ret = context->Rsp; frame = *frame_ret = context->Rsp;
...@@ -944,8 +944,8 @@ static DWORD call_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT *dis ...@@ -944,8 +944,8 @@ static DWORD call_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT *dis
frame.dispatch = dispatch; frame.dispatch = dispatch;
__wine_push_frame( &frame.frame ); __wine_push_frame( &frame.frame );
TRACE( "calling handler %p (rec=%p, frame=0x%lx context=%p, dispatch=%p)\n", TRACE( "calling handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
dispatch->LanguageHandler, rec, dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch ); dispatch->LanguageHandler, rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch ); res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
TRACE( "handler %p returned %x\n", dispatch->LanguageHandler, res ); TRACE( "handler %p returned %x\n", dispatch->LanguageHandler, res );
...@@ -1162,7 +1162,7 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec ) ...@@ -1162,7 +1162,7 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
teb_frame = __wine_pop_frame( teb_frame ); teb_frame = __wine_pop_frame( teb_frame );
} }
TRACE( "returning to %lx stack %lx\n", context->Rip, context->Rsp ); TRACE( "returning to %p stack %p\n", (void *)context->Rip, (void *)context->Rsp );
NtSetContextThread( GetCurrentThread(), context ); NtSetContextThread( GetCurrentThread(), context );
} }
...@@ -1226,7 +1226,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec ...@@ -1226,7 +1226,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit || dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit ||
dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase) dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase)
{ {
ERR( "invalid frame %lx (%p-%p)\n", dispatch.EstablisherFrame, ERR( "invalid frame %p (%p-%p)\n", (void *)dispatch.EstablisherFrame,
NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase ); NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase );
rec->ExceptionFlags |= EH_STACK_INVALID; rec->ExceptionFlags |= EH_STACK_INVALID;
break; break;
...@@ -1236,7 +1236,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec ...@@ -1236,7 +1236,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
{ {
if (end_frame && (dispatch.EstablisherFrame > (ULONG64)end_frame)) if (end_frame && (dispatch.EstablisherFrame > (ULONG64)end_frame))
{ {
ERR( "invalid end frame %lx/%p\n", dispatch.EstablisherFrame, end_frame ); ERR( "invalid end frame %p/%p\n", (void *)dispatch.EstablisherFrame, end_frame );
raise_status( STATUS_INVALID_UNWIND_TARGET, rec ); raise_status( STATUS_INVALID_UNWIND_TARGET, rec );
} }
if (dispatch.EstablisherFrame == (ULONG64)end_frame) rec->ExceptionFlags |= EH_TARGET_UNWIND; if (dispatch.EstablisherFrame == (ULONG64)end_frame) rec->ExceptionFlags |= EH_TARGET_UNWIND;
...@@ -1381,7 +1381,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec, ...@@ -1381,7 +1381,7 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec,
return ExceptionContinueExecution; return ExceptionContinueExecution;
} }
} }
TRACE( "unwinding to target %lx\n", dispatch->ImageBase + table->ScopeRecord[i].JumpTarget ); TRACE( "unwinding to target %p\n", (char *)dispatch->ImageBase + table->ScopeRecord[i].JumpTarget );
RtlUnwindEx( frame, (char *)dispatch->ImageBase + table->ScopeRecord[i].JumpTarget, RtlUnwindEx( frame, (char *)dispatch->ImageBase + table->ScopeRecord[i].JumpTarget,
rec, 0, dispatch->ContextRecord, dispatch->HistoryTable ); rec, 0, dispatch->ContextRecord, dispatch->HistoryTable );
} }
...@@ -1471,7 +1471,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ...@@ -1471,7 +1471,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit || dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit ||
dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase) dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase)
{ {
ERR( "invalid frame %lx (%p-%p)\n", dispatch.EstablisherFrame, ERR( "invalid frame %p (%p-%p)\n", (void *)dispatch.EstablisherFrame,
NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase ); NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase );
break; break;
} }
......
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