[x86/Linux] Fix HelperMethodFrame::UpdateRegDisplay (#15993)
authorKonstantin Baladurin <k.baladurin@partner.samsung.com>
Thu, 25 Jan 2018 10:31:32 +0000 (13:31 +0300)
committerJan Vorlicek <janvorli@microsoft.com>
Thu, 25 Jan 2018 10:31:32 +0000 (11:31 +0100)
For DAC after initialization MachState using InsureInit method,
register pointers are NULL so we cannot use them to restore register
values.

src/vm/i386/cgenx86.cpp

index 7071d27928dd2b65d6cd0e96ade2cae2213a1f24..a43bc8558a9c93d498900702220b4c5ffc8f6e23 100644 (file)
@@ -390,9 +390,11 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
         pRD->pCurrentContext->Eip = pRD->ControlPC = pUnwoundState->GetRetAddr();
         pRD->pCurrentContext->Esp = pRD->SP        = pUnwoundState->esp();
 
-#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContext->regname = *((DWORD*) pUnwoundState->p##regname());
-        ENUM_CALLEE_SAVED_REGISTERS();
-#undef CALLEE_SAVED_REGISTER
+        // Do not use pUnwoundState->p##regname() here because it returns NULL in this case
+        pRD->pCurrentContext->Edi = pUnwoundState->_edi;
+        pRD->pCurrentContext->Esi = pUnwoundState->_esi;
+        pRD->pCurrentContext->Ebx = pUnwoundState->_ebx;
+        pRD->pCurrentContext->Ebp = pUnwoundState->_ebp;
 
 #define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD*) pUnwoundState->p##regname();
         ENUM_CALLEE_SAVED_REGISTERS();