mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-28 08:16:05 +00:00
[Support] Don't modify the current EH context during stack unwinding
Copy it instead. Otherwise, key registers (such as RBP) may get zeroed out by the stack unwinder. Fixes CrashRecoveryTest.DumpStackCleanup with MSVC in release builds. Reviewed By: stella.stamenova Differential Revision: https://reviews.llvm.org/D73809
This commit is contained in:
parent
977eaba2c6
commit
eff6112fc5
@ -820,7 +820,13 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
LocalPrintStackTrace(llvm::errs(), ep ? ep->ContextRecord : nullptr);
|
||||
// Stack unwinding appears to modify the context. Copy it to preserve the
|
||||
// caller's context.
|
||||
CONTEXT ContextCopy;
|
||||
if (ep)
|
||||
memcpy(&ContextCopy, ep->ContextRecord, sizeof(ContextCopy));
|
||||
|
||||
LocalPrintStackTrace(llvm::errs(), ep ? &ContextCopy : nullptr);
|
||||
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user