diff --git a/src/coreclr/debug/daccess/daccess.cpp b/src/coreclr/debug/daccess/daccess.cpp index e800a6eed33fe1..9a67f00f60cb77 100644 --- a/src/coreclr/debug/daccess/daccess.cpp +++ b/src/coreclr/debug/daccess/daccess.cpp @@ -4186,6 +4186,11 @@ ClrDataAccess::StartEnumMethodInstancesByAddress( goto Exit; } + if (!methodDesc->HasNativeCodeAnyVersion()) + { + goto Exit; + } + status = EnumMethodInstances::CdStart(methodDesc, appDomain, handle); @@ -5990,7 +5995,7 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc, BOOL success = DebugInfoManager::GetBoundariesAndVars( request, DebugInfoStoreNew, NULL, // allocator - BoundsType::Instrumented, + BoundsType::Instrumented, NULL, NULL, &countNativeVarInfo, &nativeVars); diff --git a/src/coreclr/debug/daccess/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h index 027efee6d3bb67..51483280466fbd 100644 --- a/src/coreclr/debug/daccess/dacimpl.h +++ b/src/coreclr/debug/daccess/dacimpl.h @@ -3798,9 +3798,8 @@ class EnumMethodInstances static HRESULT CdEnd(CLRDATA_ENUM handle); MethodDesc* m_methodDesc; - bool m_appDomainUsed; AppDomain* m_appDomain; - LoadedMethodDescIterator m_methodIter; + bool m_completed; }; //---------------------------------------------------------------------------- diff --git a/src/coreclr/debug/daccess/task.cpp b/src/coreclr/debug/daccess/task.cpp index b55626e2d33185..746337b5733486 100644 --- a/src/coreclr/debug/daccess/task.cpp +++ b/src/coreclr/debug/daccess/task.cpp @@ -5152,52 +5152,28 @@ EnumMethodDefinitions::CdEnd(CLRDATA_ENUM handle) EnumMethodInstances::EnumMethodInstances(MethodDesc* methodDesc, IXCLRDataAppDomain* givenAppDomain) + : m_methodDesc(methodDesc), + m_appDomain(givenAppDomain ? + ((ClrDataAppDomain*)givenAppDomain)->GetAppDomain() : + AppDomain::GetCurrentDomain()), + m_completed(false) { - m_methodDesc = methodDesc; - if (givenAppDomain) - { - m_appDomain = - ((ClrDataAppDomain*)givenAppDomain)->GetAppDomain(); - } - else - { - m_appDomain = AppDomain::GetCurrentDomain(); - } - m_appDomainUsed = false; } HRESULT EnumMethodInstances::Next(ClrDataAccess* dac, IXCLRDataMethodInstance **instance) { - if (!m_appDomainUsed) + if (m_completed) { - m_appDomainUsed = true; - m_methodIter.Start(m_appDomain, - m_methodDesc->GetModule(), // module - m_methodDesc->GetMemberDef(), // token - m_methodDesc); // initial method desc - } - - NextMethod: - { - // Note: DAC doesn't need to keep the assembly alive - see code:CollectibleAssemblyHolder#CAH_DAC - CollectibleAssemblyHolder pAssembly; - if (!m_methodIter.Next(pAssembly.This())) - { - return S_FALSE; - } - } - - if (!m_methodIter.Current()->HasNativeCodeAnyVersion()) - { - goto NextMethod; + return S_FALSE; } + m_completed = true; *instance = new (nothrow) ClrDataMethodInstance(dac, m_appDomain, - m_methodIter.Current()); + m_methodDesc); return *instance ? S_OK : E_OUTOFMEMORY; } @@ -5206,13 +5182,6 @@ EnumMethodInstances::CdStart(MethodDesc* methodDesc, IXCLRDataAppDomain* appDomain, CLRDATA_ENUM* handle) { - if (!methodDesc->HasClassOrMethodInstantiation() && - !(methodDesc->HasNativeCodeAnyVersion())) - { - *handle = 0; - return S_FALSE; - } - EnumMethodInstances* iter = new (nothrow) EnumMethodInstances(methodDesc, appDomain); if (iter)