[x86/Linux] Correctly unwind esp frames (#10685)
authorJonghyun Park <parjong@gmail.com>
Tue, 4 Apr 2017 08:50:02 +0000 (15:50 +0700)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 4 Apr 2017 08:50:02 +0000 (10:50 +0200)
src/unwinder/i386/unwinder_i386.cpp
src/vm/eetwain.cpp

index 2c184d1..5ce6e16 100644 (file)
@@ -76,7 +76,7 @@ OOPStackUnwinderX86::VirtualUnwind(
 
     FillRegDisplay(&rd, ContextRecord);
 
-    rd.SP = ContextRecord->ResumeEsp;
+    rd.SP = ContextRecord->Esp;
     rd.PCTAddr = (UINT_PTR)&(ContextRecord->Eip);
 
     if (ContextPointers)
index 18bc24a..a0d302c 100644 (file)
@@ -3815,7 +3815,10 @@ bool UnwindEbpDoubleAlignFrame(
         // TODO Currently we assume that ESP of funclet frames is always fixed but actually it could change.
         if (pCodeInfo->IsFunclet())
         {
-            baseSP = curESP + 12; // padding for 16byte stack alignment allocated in genFuncletProlog()
+            // Set baseSP as initial SP
+            baseSP = pContext->pCurrentContext->ResumeEsp;
+            // 16-byte stack alignment padding (allocated in genFuncletProlog)
+            baseSP += 12;
 
             pContext->PCTAddr = baseSP;
             pContext->ControlPC = *PTR_PCODE(pContext->PCTAddr);