[x86/Linux] Clean up pContext access (dotnet/coreclr#9933)
authorJonghyun Park <parjong@gmail.com>
Fri, 3 Mar 2017 23:57:35 +0000 (08:57 +0900)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 3 Mar 2017 23:57:35 +0000 (00:57 +0100)
* [x86/Linux] Clean up pContext access

* Fix ARM/Windows build error

Commit migrated from https://github.com/dotnet/coreclr/commit/3834e6b27cbd32ebb7433e6a15f320c77c3074c6

src/coreclr/src/debug/daccess/dacdbiimplstackwalk.cpp
src/coreclr/src/debug/ee/debugger.h
src/coreclr/src/debug/ee/debugger.inl
src/coreclr/src/vm/i386/cgenx86.cpp

index 29c9626..3bb2b9f 100644 (file)
@@ -1152,7 +1152,7 @@ CorDebugInternalFrameType DacDbiInterfaceImpl::GetInternalFrameType(Frame * pFra
 void DacDbiInterfaceImpl::UpdateContextFromRegDisp(REGDISPLAY * pRegDisp,
                                                    T_CONTEXT *  pContext)
 {
-#if defined(_TARGET_X86_)
+#if defined(_TARGET_X86_) && !defined(WIN64EXCEPTIONS)
     // Do a partial copy first.
     pContext->ContextFlags = (CONTEXT_INTEGER | CONTEXT_CONTROL);
 
@@ -1174,9 +1174,9 @@ void DacDbiInterfaceImpl::UpdateContextFromRegDisp(REGDISPLAY * pRegDisp,
     {
         *pContext = *pRegDisp->pContext;
     }
-#else
+#else // _TARGET_X86_ && !WIN64EXCEPTIONS
     *pContext = *pRegDisp->pCurrentContext;
-#endif
+#endif // !_TARGET_X86_ || WIN64EXCEPTIONS
 }
 
 //---------------------------------------------------------------------------------------
index 9cdf546..278bef7 100644 (file)
@@ -397,9 +397,9 @@ inline LPVOID PushedRegAddr(REGDISPLAY* pRD, LPVOID pAddr)
 {
     LIMITED_METHOD_CONTRACT;
 
-#if defined(_TARGET_AMD64_)
+#ifdef WIN64EXCEPTIONS
     if ( ((UINT_PTR)(pAddr) >= (UINT_PTR)pRD->pCurrentContextPointers) &&
-         ((UINT_PTR)(pAddr) <= ((UINT_PTR)pRD->pCurrentContextPointers + sizeof(_KNONVOLATILE_CONTEXT_POINTERS))) )
+         ((UINT_PTR)(pAddr) <= ((UINT_PTR)pRD->pCurrentContextPointers + sizeof(T_KNONVOLATILE_CONTEXT_POINTERS))) )
 #else
     if ( ((UINT_PTR)(pAddr) >= (UINT_PTR)pRD->pContext) &&
          ((UINT_PTR)(pAddr) <= ((UINT_PTR)pRD->pContext + sizeof(T_CONTEXT))) )
index 5737286..612aacd 100644 (file)
@@ -225,7 +225,7 @@ inline void FuncEvalFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
         return;
     }
 
-#if !defined(_WIN64)
+#ifndef WIN64EXCEPTIONS
     // Reset pContext; it's only valid for active (top-most) frame.
     pRD->pContext = NULL;
 #endif // !_WIN64
index 83bb255..6dd1121 100644 (file)
@@ -594,9 +594,6 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
     }
     CONTRACT_END;
 
-    // reset pContext; it's only valid for active (top-most) frame
-    pRD->pContext = NULL;
-
     pRD->PCTAddr = GetReturnAddressPtr();
 
 #ifdef WIN64EXCEPTIONS
@@ -619,6 +616,9 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
 
 #else // WIN64EXCEPTIONS
 
+    // reset pContext; it's only valid for active (top-most) frame
+    pRD->pContext = NULL;
+
     CalleeSavedRegisters* regs = GetCalleeSavedRegisters();
 
 #define CALLEE_SAVED_REGISTER(regname) pRD->p##regname = (DWORD*) &regs->regname;
@@ -890,8 +890,6 @@ void TailCallFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
     }
     CONTRACT_END;
 
-    // reset pContext; it's only valid for active (top-most) frame
-    pRD->pContext = NULL;
     pRD->PCTAddr = GetReturnAddressPtr();
 
 #ifdef WIN64EXCEPTIONS
@@ -909,6 +907,9 @@ void TailCallFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
 
 #else
 
+    // reset pContext; it's only valid for active (top-most) frame
+    pRD->pContext = NULL;
+
 #define CALLEE_SAVED_REGISTER(regname) pRD->p##regname = (DWORD*) &m_regs.regname;
     ENUM_CALLEE_SAVED_REGISTERS();
 #undef CALLEE_SAVED_REGISTER