From d8778d7789d9d0877ca35b74555895bd1384a95c Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Thu, 19 Jan 2017 21:10:45 +0900 Subject: [PATCH] [x86/Linux] Port 'FaultingExceptionFrame::UpdateRegDisplay' (dotnet/coreclr#8993) Commit migrated from https://github.com/dotnet/coreclr/commit/0d04afc8f5919edcbb371c1e0c4f832f76aed09f --- src/coreclr/src/vm/i386/cgenx86.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/coreclr/src/vm/i386/cgenx86.cpp b/src/coreclr/src/vm/i386/cgenx86.cpp index 57b7bff..d721e3b 100644 --- a/src/coreclr/src/vm/i386/cgenx86.cpp +++ b/src/coreclr/src/vm/i386/cgenx86.cpp @@ -533,33 +533,42 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD) } CONTRACT_END; -#ifndef WIN64EXCEPTIONS - CalleeSavedRegisters* regs = GetCalleeSavedRegisters(); - // reset pContext; it's only valid for active (top-most) frame pRD->pContext = NULL; +#ifndef WIN64EXCEPTIONS + CalleeSavedRegisters* regs = GetCalleeSavedRegisters(); + #define CALLEE_SAVED_REGISTER(regname) pRD->p##regname = (DWORD*) ®s->regname; ENUM_CALLEE_SAVED_REGISTERS(); #undef CALLEE_SAVED_REGISTER pRD->Esp = m_Esp; pRD->PCTAddr = GetReturnAddressPtr(); pRD->ControlPC = *PTR_PCODE(pRD->PCTAddr); -#else + +#else // WIN64EXCEPTIONS + + pRD->IsCallerContextValid = FALSE; + pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary. + memcpy(pRD->pCurrentContext, &m_ctx, sizeof(CONTEXT)); - pRD->ControlPC = m_ctx.Eip; +#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = &m_ctx.regname; + ENUM_CALLEE_SAVED_REGISTERS(); +#undef CALLEE_SAVED_REGISTER - pRD->Esp = m_ctx.Esp; +#define CALLEE_SAVED_REGISTER(regname) pRD->p##regname = &m_ctx.regname; + ENUM_CALLEE_SAVED_REGISTERS(); +#undef CALLEE_SAVED_REGISTER - pRD->pCurrentContextPointers->Ebx = &m_ctx.Ebx; - pRD->pCurrentContextPointers->Edi = &m_ctx.Edi; - pRD->pCurrentContextPointers->Esi = &m_ctx.Esi; - pRD->pCurrentContextPointers->Ebp = &m_ctx.Ebp; + pRD->Esp = m_ctx.Esp; + pRD->PCTAddr = GetReturnAddressPtr(); + pRD->ControlPC = m_ctx.Eip; - pRD->IsCallerContextValid = FALSE; - pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary. #endif // WIN64EXCEPTIONS + + LOG((LF_GCROOTS, LL_INFO100000, "STACKWALK FaultingExceptionFrame::UpdateRegDisplay(ip:%p, sp:%p)\n", pRD->ControlPC, pRD->Esp)); + RETURN; } -- 2.7.4