From 8f60f146c6e474533a062b2a75d01a3cc9b2a7cd Mon Sep 17 00:00:00 2001 From: David Mason Date: Thu, 21 Nov 2019 13:08:01 -0800 Subject: [PATCH] Fix GetSequencePoints when profiler provides mapping via SetILInstrumentedCodeMap (#27843) Port #25802 to 3.0.2 --- 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 4ef3bc7b20b6..a65233c2d063 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1003,13 +1003,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