summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Kulaychuk <i.kulaychuk@samsung.com>2017-09-13 20:39:44 +0300
committerIgor Kulaychuk <i.kulaychuk@samsung.com>2017-09-13 20:56:28 +0300
commited63a9873f5228fcc2b9b0280a9a237a3401aa05 (patch)
tree6f54dc58aa92f4225a9cacd026637d2256a39ddb
parent6e131e5588c5031fcd91a6537b7812e3e294fd60 (diff)
downloadcoreclr-ed63a9873f5228fcc2b9b0280a9a237a3401aa05.tar.gz
coreclr-ed63a9873f5228fcc2b9b0280a9a237a3401aa05.tar.bz2
coreclr-ed63a9873f5228fcc2b9b0280a9a237a3401aa05.zip
[ARM] Fix SetDebuggerREGDISPLAYFromREGDISPLAY() function
Use the same logic as in AMD64 code: when setting DebuggerREGDISPLAY from the context, the context flags might not be initialized. Since it is only called from stackwalker, we can copy valid integer, control, and floating point sections from the context.
-rw-r--r--src/debug/shared/arm/primitives.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/debug/shared/arm/primitives.cpp b/src/debug/shared/arm/primitives.cpp
index e9d0bbd59b..8771dd946d 100644
--- a/src/debug/shared/arm/primitives.cpp
+++ b/src/debug/shared/arm/primitives.cpp
@@ -80,8 +80,15 @@ void CORDbgSetDebuggerREGDISPLAYFromContext(DebuggerREGDISPLAY *pDRD,
void SetDebuggerREGDISPLAYFromREGDISPLAY(DebuggerREGDISPLAY* pDRD, REGDISPLAY* pRD)
{
SUPPORTS_DAC_HOST_ONLY;
-
+ // CORDbgSetDebuggerREGDISPLAYFromContext() checks the context flags. In cases where we don't have a filter
+ // context from the thread, we initialize a CONTEXT on the stack and use that to do our stack walking. We never
+ // initialize the context flags in such cases. Since this function is called from the stackwalker, we can
+ // guarantee that the integer, control, and floating point sections are valid. So we set the flags here and
+ // restore them afterwards.
+ DWORD contextFlags = pRD->pCurrentContext->ContextFlags;
+ pRD->pCurrentContext->ContextFlags = CONTEXT_FULL;
CORDbgSetDebuggerREGDISPLAYFromContext(pDRD, reinterpret_cast<DT_CONTEXT*>(pRD->pCurrentContext));
+ pRD->pCurrentContext->ContextFlags = contextFlags;
pDRD->SP = pRD->SP;
pDRD->PC = (SIZE_T)*(pRD->pPC);