Skip to content

Commit

Permalink
Take process lock earlier (#105280)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT authored Jul 22, 2024
1 parent b6741a7 commit 47da68b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/coreclr/debug/di/divalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2691,22 +2691,22 @@ HRESULT CordbObjectValue::GetFunctionHelper(ICorDebugFunction **ppFunction)
if (hr != S_OK)
return hr;

mdMethodDef functionMethodDef = 0;
VMPTR_DomainAssembly functionDomainAssembly;
NativeCodeFunctionData nativeCodeForDelFunc;

hr = pDAC->GetDelegateFunctionData(delType, pDelegateObj, &functionDomainAssembly, &functionMethodDef);
if (hr != S_OK)
return hr;

// TODO: How to ensure results are sanitized?
// Also, this is expensive. Do we really care that much about this?
pDAC->GetNativeCodeInfo(functionDomainAssembly, functionMethodDef, &nativeCodeForDelFunc);

RSSmartPtr<CordbModule> funcModule(GetProcess()->LookupOrCreateModule(functionDomainAssembly));
RSSmartPtr<CordbFunction> func;
{
RSLockHolder lockHolder(GetProcess()->GetProcessLock());

VMPTR_DomainAssembly functionDomainAssembly;
mdMethodDef functionMethodDef = 0;
hr = pDAC->GetDelegateFunctionData(delType, pDelegateObj, &functionDomainAssembly, &functionMethodDef);
if (hr != S_OK)
return hr;

// TODO: How to ensure results are sanitized?
// Also, this is expensive. Do we really care that much about this?
NativeCodeFunctionData nativeCodeForDelFunc;
pDAC->GetNativeCodeInfo(functionDomainAssembly, functionMethodDef, &nativeCodeForDelFunc);

RSSmartPtr<CordbModule> funcModule(GetProcess()->LookupOrCreateModule(functionDomainAssembly));
func.Assign(funcModule->LookupOrCreateFunction(functionMethodDef, nativeCodeForDelFunc.encVersion));
}

Expand Down

0 comments on commit 47da68b

Please sign in to comment.