From a3856a521f25456083aaff3c7b14e79aea43e132 Mon Sep 17 00:00:00 2001 From: David Mason Date: Fri, 19 Jul 2019 16:34:06 -0700 Subject: [PATCH 1/2] Fix GetSequencePoints when profiler provides mapping via SetILInstrumentedCodeMap --- src/debug/daccess/dacdbiimpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index 7f207f239021..1a4fdab1c51b 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1006,10 +1006,10 @@ void DacDbiInterfaceImpl::GetSequencePoints(MethodDesc * pMethodDesc, // if there is a rejit IL map for this function, apply that in preference to load-time mapping #ifdef FEATURE_REJIT CodeVersionManager * pCodeVersionManager = pMethodDesc->GetCodeVersionManager(); - NativeCodeVersion nativeCodeVersion = pCodeVersionManager->GetNativeCodeVersion(dac_cast(pMethodDesc), (PCODE)startAddr); - if (!nativeCodeVersion.IsNull()) + ILCodeVersion ilVersion = pCodeVersionManager->GetNativeCodeVersion(dac_cast(pMethodDesc), (PCODE)startAddr).GetILCodeVersion(); + if (!ilVersion.IsDefaultVersion()) { - const InstrumentedILOffsetMapping * pRejitMapping = nativeCodeVersion.GetILCodeVersion().GetInstrumentedILMap(); + const InstrumentedILOffsetMapping * pRejitMapping = ilVersion.GetInstrumentedILMap(); ComposeMapping(pRejitMapping, mapCopy, &entryCount); } else From 88700db221667b4990cf9b3f09f61dbf85b3a7a3 Mon Sep 17 00:00:00 2001 From: David Mason Date: Tue, 23 Jul 2019 13:57:45 -0700 Subject: [PATCH 2/2] code review feedback --- src/debug/daccess/dacdbiimpl.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index 1a4fdab1c51b..6d115b938a59 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1003,11 +1003,17 @@ void DacDbiInterfaceImpl::GetSequencePoints(MethodDesc * pMethodDesc, if (!success) ThrowHR(E_FAIL); - // if there is a rejit IL map for this function, apply that in preference to load-time mapping #ifdef FEATURE_REJIT CodeVersionManager * pCodeVersionManager = pMethodDesc->GetCodeVersionManager(); - ILCodeVersion ilVersion = pCodeVersionManager->GetNativeCodeVersion(dac_cast(pMethodDesc), (PCODE)startAddr).GetILCodeVersion(); - if (!ilVersion.IsDefaultVersion()) + ILCodeVersion ilVersion; + NativeCodeVersion nativeCodeVersion = pCodeVersionManager->GetNativeCodeVersion(dac_cast(pMethodDesc), (PCODE)startAddr); + if (!nativeCodeVersion.IsNull()) + { + ilVersion = nativeCodeVersion.GetILCodeVersion(); + } + + // if there is a rejit IL map for this function, apply that in preference to load-time mapping + if (!ilVersion.IsNull() && !ilVersion.IsDefaultVersion()) { const InstrumentedILOffsetMapping * pRejitMapping = ilVersion.GetInstrumentedILMap(); ComposeMapping(pRejitMapping, mapCopy, &entryCount);