[PATCH 1/2] ntdll: Unwind to the LR register if no unwind info is available

Martin Storsjo martin at martin.st
Mon Oct 5 04:16:39 CDT 2020


Try to keep the behaviour from ea9f47a767c2 of erroring out if
unwinding ends up out of bounds (with pc==lr, where setting pc
to lr doesn't progress the unwind), but support unwinding from
functions without unwind info.

Signed-off-by: Martin Storsjo <martin at martin.st>
---
 dlls/ntdll/signal_arm64.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index eb451603fe4..c9f44e92d30 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -197,8 +197,16 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
     }
     else
     {
-        WARN( "exception data not found in %s\n", debugstr_w(module->BaseDllName.Buffer) );
-        return STATUS_INVALID_DISPOSITION;
+        status = context->Pc != context->u.s.Lr ?
+                 STATUS_SUCCESS : STATUS_INVALID_DISPOSITION;
+        WARN( "exception data not found in %s for %p, LR %p, status %x\n",
+               debugstr_w(module->BaseDllName.Buffer), (void*) context->Pc,
+               (void*) context->u.s.Lr, status );
+        dispatch->EstablisherFrame = context->Sp;
+        dispatch->LanguageHandler = NULL;
+        context->Pc = context->u.s.Lr;
+        context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL;
+        return status;
     }
 
     dispatch->EstablisherFrame = context->u.s.Fp;
-- 
2.17.1




More information about the wine-devel mailing list