[PATCH] ntdll: Handle 64-bit addresses in +seh traces.

Daniel Lehman dlehman25 at gmail.com
Fri Oct 2 15:44:26 CDT 2020


Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>

---
-0110:trace:seh:dump_scope_table   0: 40004cdc-40004ce2 handler 4000b1a0 target 40000000
-0110:trace:seh:dump_scope_table   1: 40004cdc-40004d1b handler 4000b1ce target 40004d1b
-0110:trace:seh:dump_scope_table   2: 40004cdc-40004d4f handler 4000b1fe target 40000000
-0110:trace:seh:dump_scope_table   3: 40004cdc-40004d88 handler 4000b22c target 40004d88
+0110:trace:seh:dump_scope_table   0: 140004cdc-140004ce2 handler 14000b1a0 target 140000000
+0110:trace:seh:dump_scope_table   1: 140004cdc-140004d1b handler 14000b1ce target 140004d1b
+0110:trace:seh:dump_scope_table   2: 140004cdc-140004d4f handler 14000b1fe target 140000000
+0110:trace:seh:dump_scope_table   3: 140004cdc-140004d88 handler 14000b22c target 140004d88

-0110:trace:seh:__C_specific_handler unwinding to target 40005569
+0110:trace:seh:__C_specific_handler unwinding to target 140005569

-0110:trace:seh:RtlRestoreContext returning to 40005336 stack 21ed00
+0110:trace:seh:RtlRestoreContext returning to 140005336 stack 21ed00

-0110:trace:seh:RtlVirtualUnwind type 2 rip 40005567 rsp 21fd00
+0110:trace:seh:RtlVirtualUnwind type 2 rip 140005567 rsp 21fd00

-0110:trace:seh:dispatch_exception code=c0000094 flags=0 addr=000000014000225C ip=4000225c tid=0110
+0110:trace:seh:dispatch_exception code=c0000094 flags=0 addr=000000014000225C ip=14000225c tid=0110
---
 dlls/ntdll/signal_x86_64.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

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




More information about the wine-devel mailing list