From c96565d646095540210f051cdb677000b69ecb15 Mon Sep 17 00:00:00 2001 From: Konstantin Baladurin Date: Thu, 25 Jan 2018 13:31:32 +0300 Subject: [PATCH] [x86/Linux] Fix HelperMethodFrame::UpdateRegDisplay (dotnet/coreclr#15993) For DAC after initialization MachState using InsureInit method, register pointers are NULL so we cannot use them to restore register values. Commit migrated from https://github.com/dotnet/coreclr/commit/949b94eabd74f2632c220b03f998a802032d2b82 --- src/coreclr/src/vm/i386/cgenx86.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/vm/i386/cgenx86.cpp b/src/coreclr/src/vm/i386/cgenx86.cpp index 7071d27..a43bc85 100644 --- a/src/coreclr/src/vm/i386/cgenx86.cpp +++ b/src/coreclr/src/vm/i386/cgenx86.cpp @@ -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(); -- 2.7.4