[release/6.0-rc2] Undo breaking change compat in GetMethodNativeMap (#59231)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Mon, 20 Sep 2021 17:20:33 +0000 (10:20 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Sep 2021 17:20:33 +0000 (10:20 -0700)
* Undo breaking change compat

* Fix compilation

Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com>
src/coreclr/debug/daccess/daccess.cpp

index 61f0d82..dee4fe1 100644 (file)
@@ -6077,13 +6077,20 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc,
     SUPPORTS_DAC;
     COUNT_T countNativeVarInfo;
     NewHolder<ICorDebugInfo::NativeVarInfo> nativeVars(NULL);
-
-    NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address);
-    if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL)
+    TADDR nativeCodeStartAddr;
+    if (address != NULL)
     {
-        return E_INVALIDARG;
+        NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address);
+        if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL)
+        {
+            return E_INVALIDARG;
+        }
+        nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode());
+    }
+    else
+    {
+        nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode());
     }
-    TADDR nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode());
 
     DebugInfoRequest request;
     request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr);
@@ -6128,13 +6135,20 @@ ClrDataAccess::GetMethodNativeMap(MethodDesc* methodDesc,
 
     // Use the DebugInfoStore to get IL->Native maps.
     // It doesn't matter whether we're jitted, ngenned etc.
-
-    NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address);
-    if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL)
+    TADDR nativeCodeStartAddr;
+    if (address != NULL)
     {
-        return E_INVALIDARG;
+        NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address);
+        if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL)
+        {
+            return E_INVALIDARG;
+        }
+        nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode());
+    }
+    else
+    {
+        nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode());
     }
-    TADDR nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode());
 
     DebugInfoRequest request;
     request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr);