diff --git a/src/coreclr/debug/daccess/daccess.cpp b/src/coreclr/debug/daccess/daccess.cpp index 470ce99e3950b1..61f0d827e60f19 100644 --- a/src/coreclr/debug/daccess/daccess.cpp +++ b/src/coreclr/debug/daccess/daccess.cpp @@ -6078,8 +6078,14 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc, COUNT_T countNativeVarInfo; NewHolder nativeVars(NULL); + NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address); + if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL) + { + return E_INVALIDARG; + } + TADDR nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode()); + DebugInfoRequest request; - TADDR nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode()); request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr); BOOL success = DebugInfoManager::GetBoundariesAndVars( @@ -6088,7 +6094,6 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc, NULL, NULL, &countNativeVarInfo, &nativeVars); - if (!success) { return E_FAIL; @@ -6105,8 +6110,7 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc, if (codeOffset) { - *codeOffset = (ULONG32) - (address - nativeCodeStartAddr); + *codeOffset = (ULONG32)(address - nativeCodeStartAddr); } return S_OK; } @@ -6125,11 +6129,16 @@ 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) + { + return E_INVALIDARG; + } + TADDR nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode()); + DebugInfoRequest request; - TADDR nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode()); request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr); - // Bounds info. ULONG32 countMapCopy; NewHolder mapCopy(NULL); @@ -6145,7 +6154,6 @@ ClrDataAccess::GetMethodNativeMap(MethodDesc* methodDesc, return E_FAIL; } - // Need to convert map formats. *numMap = countMapCopy; @@ -6179,8 +6187,7 @@ ClrDataAccess::GetMethodNativeMap(MethodDesc* methodDesc, } if (codeOffset) { - *codeOffset = (ULONG32) - (address - nativeCodeStartAddr); + *codeOffset = (ULONG32)(address - nativeCodeStartAddr); } *mapAllocated = true;