[PATCH] D73809: eSupport] Don't modify the current EH context during stack unwinding

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 17:12:03 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb074acb82f7e: [Support] Don't modify the current EH context during stack unwinding (authored by rnk).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73809/new/

https://reviews.llvm.org/D73809

Files:
  llvm/lib/Support/Windows/Signals.inc


Index: llvm/lib/Support/Windows/Signals.inc
===================================================================
--- llvm/lib/Support/Windows/Signals.inc
+++ llvm/lib/Support/Windows/Signals.inc
@@ -820,7 +820,13 @@
                    << "\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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73809.241850.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200201/8f327b77/attachment.bin>


More information about the llvm-commits mailing list