Issue 161851
Summary Can't debug windows aarch64 executables that throw c++ exceptions, if built with lllvm-mingw
Labels new issue
Assignees
Reporter ssbssa
    If you try to debug any executable that throws a c++ exception, you get this result:
```
* thread #​1, stop reason = Exception 0xc00000ff encountered at address 0x7fff44a181b0
  frame #​0: 0x00007fff44a181b0 ntdll.dll`RtlRaiseStatus + 32
```
I even tried cdb, and got a similar result.

After lots of searching I found [this post](https://github.com/LuaJIT/LuaJIT/issues/593#issuecomment-1717728494) detailing a deep analysis plus [solution](https://github.com/LuaJIT/LuaJIT/commit/7a1c139569874f371f567d060738a3f5704930a1) of the problem.

I didn't test it, but I expect that a similar change like the following should fix this:
```diff
--- a/libunwind/src/Unwind-seh.cpp
+++ b/libunwind/src/Unwind-seh.cpp
@@ -174,7 +174,7 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
     }
     // FIXME: Indicate target frame in foreign case!
     // phase 2: the clean up phase
-    RtlUnwindEx(frame, (PVOID)disp->ControlPc, ms_exc, exc, ms_ctx, disp->HistoryTable);
+    RtlUnwindEx(frame, (PVOID)disp->ControlPc, ms_exc, exc, disp->ContextRecord, disp->HistoryTable);
     _LIBUNWIND_ABORT("RtlUnwindEx() failed");
   case _URC_INSTALL_CONTEXT: {
     // If we were called by __libunwind_seh_personality(), indicate that
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to