diff options
| author | Martin Storsjö <martin@martin.st> | 2025-10-16 22:47:08 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-16 22:47:08 +0300 |
| commit | a17afee7ec41e53292f074fc967d264452e4363b (patch) | |
| tree | 65113a98d9a6e99b55dfdb8ef0fd03fcf36b4e48 /clang/unittests/Frontend/CompilerInvocationTest.cpp | |
| parent | 2a7e7e2ac40a8bad2629a7790538e4ff608501ab (diff) | |
| download | llvm-a17afee7ec41e53292f074fc967d264452e4363b.zip llvm-a17afee7ec41e53292f074fc967d264452e4363b.tar.gz llvm-a17afee7ec41e53292f074fc967d264452e4363b.tar.bz2 | |
[libunwind] Fix aarch64 SEH unwinding with a debugger attached (#162867)
See https://github.com/LuaJIT/LuaJIT/issues/593#issuecomment-1717728494
for the original explanation of the problem.
In short; when a debugger is attached, there's a
function KiUserExceptionDispatcher in the stack that is being unwound.
The function KiUserExceptionDispatcher contains a CONTEXT, with a copy
of the context from where the exception was raised. When unwinding
through this function, this whole CONTEXT gets restored.
This CONTEXT is what we receive a pointer to in the callbacks, as the
ms_ctx pointer.
When we unwind manually using RtlUnwindEx, the unwinding overwrites the
CONTEXT that is passed to it. Thus, to avoid clobbering the CONTEXT that
needs to be restored by KiUserExceptionDispatcher, we could either
declare a new temporary CONTEXT on the stack before calling RtlUnwindEx,
or just use disp->ContextRecord as we already have available.
Fixes: https://github.com/llvm/llvm-project/issues/161851
Co-authored-by: Peter Cawley <corsix@corsix.org>
Co-authored-by: Hannes Domani <ssbssa@yahoo.de>
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
0 files changed, 0 insertions, 0 deletions
