diff options
author | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2017-09-29 11:08:01 +0300 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-09-29 10:08:01 +0200 |
commit | 9b49593f5ca1b3168a4ff947cbfc3d52a97671cb (patch) | |
tree | f60c2f7bfe16a8e443cfd37f901c71cee31a70c7 /src | |
parent | eab3a973346bf4bc5ddffc5201f862141a96b000 (diff) | |
download | coreclr-9b49593f5ca1b3168a4ff947cbfc3d52a97671cb.tar.gz coreclr-9b49593f5ca1b3168a4ff947cbfc3d52a97671cb.tar.bz2 coreclr-9b49593f5ca1b3168a4ff947cbfc3d52a97671cb.zip |
[x86/Linux] Fix assert in HelperMethodFrame::UpdateRegDisplay (#14235)
In some cases during execution of the SOS command 'clrstack -i'
portability assert in HelperMethodFrame::UpdateRegDisplay occurs.
This patch removes this assert and adds corresponding implementation.
Diffstat (limited to 'src')
-rw-r--r-- | src/vm/i386/cgenx86.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp index 9b8960a6eb..3b523c9c28 100644 --- a/src/vm/i386/cgenx86.cpp +++ b/src/vm/i386/cgenx86.cpp @@ -378,7 +378,30 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD) pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary. #ifdef DACCESS_COMPILE - PORTABILITY_ASSERT("HelperMethodFrame::UpdateRegDisplay"); + // For DAC, we may get here when the HMF is still uninitialized. + // So we may need to unwind here. + if (!m_MachState.isValid()) + { + // This allocation throws on OOM. + MachState* pUnwoundState = (MachState*)DacAllocHostOnlyInstance(sizeof(*pUnwoundState), true); + + InsureInit(false, pUnwoundState); + + 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 + +#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD*) pUnwoundState->p##regname(); + ENUM_CALLEE_SAVED_REGISTERS(); +#undef CALLEE_SAVED_REGISTER + + ClearRegDisplayArgumentAndScratchRegisters(pRD); + + return; + } #endif // DACCESS_COMPILE pRD->pCurrentContext->Eip = pRD->ControlPC = m_MachState.GetRetAddr(); |