From d36fefc33a06b8a999304d8e80231b8b254df93c Mon Sep 17 00:00:00 2001 From: David Mason Date: Fri, 22 Nov 2019 13:08:27 -0800 Subject: [PATCH] Fix GetSequencePoints when profiler provides mapping via SetILInstrumentedCodeMap (#27295) Port #25802 to release/2.1 --- src/debug/daccess/dacdbiimpl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index faaa7ec1314b..3c588d66b699 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1002,13 +1002,19 @@ 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; NativeCodeVersion nativeCodeVersion = pCodeVersionManager->GetNativeCodeVersion(dac_cast(pMethodDesc), (PCODE)startAddr); if (!nativeCodeVersion.IsNull()) { - const InstrumentedILOffsetMapping * pRejitMapping = nativeCodeVersion.GetILCodeVersion().GetInstrumentedILMap(); + 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); } else