Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/coreclr/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4186,6 +4186,11 @@ ClrDataAccess::StartEnumMethodInstancesByAddress(
goto Exit;
}

if (!methodDesc->HasNativeCodeAnyVersion())
{
goto Exit;
}

status = EnumMethodInstances::CdStart(methodDesc, appDomain,
handle);

Expand Down Expand Up @@ -5990,7 +5995,7 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc,
BOOL success = DebugInfoManager::GetBoundariesAndVars(
request,
DebugInfoStoreNew, NULL, // allocator
BoundsType::Instrumented,
BoundsType::Instrumented,
NULL, NULL,
&countNativeVarInfo, &nativeVars);

Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/debug/daccess/dacimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

//----------------------------------------------------------------------------
Expand Down
49 changes: 9 additions & 40 deletions src/coreclr/debug/daccess/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Assembly *> 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;
}

Expand All @@ -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)
Expand Down
Loading