blob: a5af80ed8d2c190bef7c4a2e94f6db04d6d8783a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
From 1c963b8694365c7e31605fda0939fe7564c38716 Mon Sep 17 00:00:00 2001
From: Konstantin Baladurin <k.baladurin@partner.samsung.com>
Date: Fri, 29 Sep 2017 11:08:01 +0300
Subject: [PATCH] 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.
---
src/vm/i386/cgenx86.cpp | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp
index ca81bb7..b4277db 100644
--- a/src/vm/i386/cgenx86.cpp
+++ b/src/vm/i386/cgenx86.cpp
@@ -379,7 +379,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();
--
2.7.4
|