[x86/Linux] Fix CopyREGDISPLAY for WIN64EXCEPTIONS (dotnet/coreclr#14254)
authorKonstantin Baladurin <k.baladurin@partner.samsung.com>
Fri, 29 Sep 2017 17:15:35 +0000 (20:15 +0300)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 29 Sep 2017 17:15:35 +0000 (19:15 +0200)
When WIN64EXCEPTIONS is defined, fields pCurrentContextPointers,
pCallerContextPointers, pCurrentContext and pCallerContext of the
REGDISPLAY are used. So we need to fix their values after coping.

Commit migrated from https://github.com/dotnet/coreclr/commit/2eed20ce511fa25085742d4aaffc29a3939e84dd

src/coreclr/src/debug/ee/i386/debuggerregdisplayhelper.cpp

index 576fdeb..86927b7 100644 (file)
 void CopyREGDISPLAY(REGDISPLAY* pDst, REGDISPLAY* pSrc)
 {
     *pDst = *pSrc;
+
+#ifdef WIN64EXCEPTIONS
+    if (pSrc->pCurrentContextPointers == &(pSrc->ctxPtrsOne))
+    {
+        pDst->pCurrentContextPointers = &(pDst->ctxPtrsOne);
+        pDst->pCallerContextPointers  = &(pDst->ctxPtrsTwo);
+    }
+    else
+    {
+        pDst->pCurrentContextPointers = &(pDst->ctxPtrsTwo);
+        pDst->pCallerContextPointers  = &(pDst->ctxPtrsOne);
+    }
+
+    if (pSrc->pCurrentContext == &(pSrc->ctxOne))
+    {
+        pDst->pCurrentContext = &(pDst->ctxOne);
+        pDst->pCallerContext  = &(pDst->ctxTwo);
+    }
+    else
+    {
+        pDst->pCurrentContext = &(pDst->ctxTwo);
+        pDst->pCallerContext  = &(pDst->ctxOne);
+    }
+#endif
 }