Skip to content

Can't debug windows aarch64 executables that throw c++ exceptions, if built with lllvm-mingw #161851

@ssbssa

Description

@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 detailing a deep analysis plus solution of the problem.

I didn't test it, but I expect that a similar change like the following should fix this:

--- 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions