Skip to content

Commit 6130a50

Browse files
authored
[cDAC] Delete GetAssemblyInfo (#127481)
Delete the DacDbi API GetAssemblyInfo
1 parent f30a847 commit 6130a50

13 files changed

Lines changed: 37 additions & 150 deletions

File tree

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,29 +4361,6 @@ HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetModuleForAssembly(VMPTR_Assemb
43614361
return hr;
43624362
}
43634363

4364-
4365-
// Implement IDacDbiInterface::GetAssemblyInfo
4366-
HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetAssemblyInfo(VMPTR_Assembly vmAssembly, OUT AssemblyInfo * pData)
4367-
{
4368-
DD_ENTER_MAY_THROW;
4369-
4370-
HRESULT hr = S_OK;
4371-
EX_TRY
4372-
{
4373-
4374-
_ASSERTE(pData != NULL);
4375-
4376-
ZeroMemory(pData, sizeof(*pData));
4377-
4378-
Assembly * pAssembly = vmAssembly.GetDacPtr();
4379-
4380-
pData->vmAssembly.SetHostPtr(pAssembly);
4381-
pData->vmAppDomain.SetHostPtr(AppDomain::GetCurrentDomain());
4382-
}
4383-
EX_CATCH_HRESULT(hr);
4384-
return hr;
4385-
}
4386-
43874364
// Implement IDacDbiInterface::GetModuleData
43884365
HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetModuleData(VMPTR_Module vmModule, OUT ModuleInfo * pData)
43894366
{

src/coreclr/debug/daccess/dacdbiimpl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,6 @@ class DacDbiInterfaceImpl :
617617
// Gets properties for a module
618618
HRESULT STDMETHODCALLTYPE GetModuleData(VMPTR_Module vmModule, OUT ModuleInfo * pData);
619619

620-
// Gets properties for an assembly
621-
HRESULT STDMETHODCALLTYPE GetAssemblyInfo(VMPTR_Assembly vmAssembly, OUT AssemblyInfo * pData);
622-
623620
HRESULT STDMETHODCALLTYPE GetModuleForAssembly(VMPTR_Assembly vmAssembly, OUT VMPTR_Module * pModule);
624621

625622
// Get the "type" of address.

src/coreclr/debug/di/divalue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ HRESULT CordbObjectValue::EnumerateExceptionCallStack(ICorDebugExceptionObjectCa
24712471
DacExceptionCallStackData& currentDacFrame = dacStackFrames[index];
24722472
CorDebugExceptionObjectStackFrame& currentStackFrame = pStackFrames[index];
24732473

2474-
CordbAppDomain* pAppDomain = GetProcess()->LookupOrCreateAppDomain(currentDacFrame.vmAppDomain);
2474+
CordbAppDomain* pAppDomain = GetProcess()->GetAppDomain();
24752475
CordbModule* pModule = pAppDomain->LookupOrCreateModule(currentDacFrame.vmAssembly);
24762476

24772477
hr = pModule->QueryInterface(IID_ICorDebugModule, reinterpret_cast<void**>(&currentStackFrame.pModule));
@@ -2675,7 +2675,7 @@ HRESULT CordbObjectValue::GetTargetHelper(ICorDebugReferenceValue **ppTarget)
26752675
}
26762676

26772677
RSLockHolder lockHolder(GetProcess()->GetProcessLock());
2678-
RSSmartPtr<CordbAppDomain> pCordbAppDomForTarget(GetProcess()->LookupOrCreateAppDomain(pAppDomainOfTarget));
2678+
RSSmartPtr<CordbAppDomain> pCordbAppDomForTarget(GetProcess()->GetAppDomain());
26792679
RSSmartPtr<CordbReferenceValue> targetObjRefVal(CordbValue::CreateHeapReferenceValue(pCordbAppDomForTarget, pDelegateTargetObj));
26802680
*ppTarget = static_cast<ICorDebugReferenceValue*>(targetObjRefVal.GetValue());
26812681
targetObjRefVal->ExternalAddRef();

src/coreclr/debug/di/module.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,14 @@ CordbModule::CordbModule(
5757
m_fDynamic = modInfo.fIsDynamic;
5858
m_fInMemory = modInfo.fInMemory;
5959
m_vmPEFile = modInfo.vmPEAssembly;
60+
m_pAppDomain = pProcess->GetAppDomain();
6061

6162
if (!vmAssembly.IsNull())
6263
{
63-
AssemblyInfo dfInfo;
64-
65-
IfFailThrow(pProcess->GetDAC()->GetAssemblyInfo(vmAssembly, &dfInfo)); // throws
66-
67-
m_pAppDomain = pProcess->LookupOrCreateAppDomain(dfInfo.vmAppDomain);
68-
_ASSERTE(m_pAppDomain == pProcess->GetAppDomain());
69-
m_pAssembly = m_pAppDomain->LookupOrCreateAssembly(dfInfo.vmAssembly);
64+
m_pAssembly = m_pAppDomain->LookupOrCreateAssembly(vmAssembly);
7065
}
7166
else
7267
{
73-
m_pAppDomain = pProcess->GetAppDomain();
7468
m_pAssembly = m_pAppDomain->LookupOrCreateAssembly(modInfo.vmAssembly);
7569
}
7670
#ifdef _DEBUG

src/coreclr/debug/di/process.cpp

Lines changed: 28 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,7 @@ IMDInternalImport * CordbProcess::LookupMetaData(VMPTR_PEAssembly vmPEAssembly)
360360
}
361361

362362
// Cache didn't have it... time to search harder
363-
VMPTR_AppDomain vmAppDomain;
364-
GetDAC()->GetCurrentAppDomain(&vmAppDomain);
365-
LookupOrCreateAppDomain(vmAppDomain);
363+
GetAppDomain();
366364

367365
// There may be perf issues here. The DAC may make a lot of metadata requests, and so
368366
// this may be an area for potential perf optimizations if we find things running slow.
@@ -2638,28 +2636,22 @@ COM_METHOD CordbProcess::GetAsyncStack(CORDB_ADDRESS continuationAddress, ICorDe
26382636

26392637
HRESULT CordbProcess::GetTypeForObject(CORDB_ADDRESS addr, CordbType **ppType, CordbAppDomain **pAppDomain)
26402638
{
2641-
VMPTR_AppDomain appDomain = VMPTR_AppDomain::NullPtr();
2642-
26432639
HRESULT hr = E_FAIL;
2644-
IfFailThrow(GetDAC()->GetCurrentAppDomain(&appDomain));
2645-
if (!appDomain.IsNull())
2646-
{
2647-
CordbAppDomain *cdbAppDomain = appDomain.IsNull() ? GetAppDomain() : LookupOrCreateAppDomain(appDomain);
2640+
CordbAppDomain *cdbAppDomain = GetAppDomain();
26482641

2649-
_ASSERTE(cdbAppDomain);
2642+
_ASSERTE(cdbAppDomain);
26502643

2651-
DebuggerIPCE_ExpandedTypeData data;
2652-
IfFailThrow(GetDAC()->GetObjectExpandedTypeInfo(AllBoxed, addr, &data));
2644+
DebuggerIPCE_ExpandedTypeData data;
2645+
IfFailThrow(GetDAC()->GetObjectExpandedTypeInfo(AllBoxed, addr, &data));
26532646

2654-
CordbType *type = 0;
2655-
hr = CordbType::TypeDataToType(cdbAppDomain, &data, &type);
2647+
CordbType *type = 0;
2648+
hr = CordbType::TypeDataToType(cdbAppDomain, &data, &type);
26562649

2657-
if (SUCCEEDED(hr))
2658-
{
2659-
*ppType = type;
2660-
if (pAppDomain)
2661-
*pAppDomain = cdbAppDomain;
2662-
}
2650+
if (SUCCEEDED(hr))
2651+
{
2652+
*ppType = type;
2653+
if (pAppDomain)
2654+
*pAppDomain = cdbAppDomain;
26632655
}
26642656

26652657
return hr;
@@ -2797,7 +2789,7 @@ HRESULT CordbRefEnum::Next(ULONG celt, COR_GC_REFERENCE refs[], ULONG *pceltFetc
27972789
{
27982790
for (ULONG i = 0; i < fetched; ++i)
27992791
{
2800-
CordbAppDomain *pDomain = process->LookupOrCreateAppDomain(dacRefs[i].vmDomain);
2792+
CordbAppDomain *pDomain = process->GetAppDomain();
28012793

28022794
ICorDebugAppDomain *pAppDomain = NULL;
28032795
ICorDebugValue *pOutObject = NULL;
@@ -4870,10 +4862,7 @@ void CordbProcess::RawDispatchEvent(
48704862
pThread = LookupOrCreateThread(pEvent->vmThread);
48714863
}
48724864

4873-
if (!pEvent->vmAppDomain.IsNull())
4874-
{
4875-
pAppDomain.Assign(LookupOrCreateAppDomain(pEvent->vmAppDomain));
4876-
}
4865+
pAppDomain.Assign(GetAppDomain());
48774866

48784867
DWORD dwVolatileThreadId = 0;
48794868
if (pThread != NULL)
@@ -5386,7 +5375,7 @@ void CordbProcess::RawDispatchEvent(
53865375
// Either way, still send the CreateEvent. (We don't want to skip the Create event
53875376
// just because the debugger did an enumerate)
53885377
// We remove AppDomains from the hash as soon as they are exited.
5389-
pAppDomain.Assign(LookupOrCreateAppDomain(pEvent->AppDomainData.vmAppDomain));
5378+
pAppDomain.Assign(GetAppDomain());
53905379
_ASSERTE(pAppDomain != NULL); // throws on failure
53915380

53925381
{
@@ -5461,7 +5450,7 @@ void CordbProcess::RawDispatchEvent(
54615450
pEval->m_resultType = pEvent->FuncEvalComplete.resultType;
54625451
pEval->m_resultAppDomainToken = pEvent->FuncEvalComplete.vmAppDomain;
54635452

5464-
CordbAppDomain *pResultAppDomain = LookupOrCreateAppDomain(pEvent->FuncEvalComplete.vmAppDomain);
5453+
CordbAppDomain *pResultAppDomain = GetAppDomain();
54655454

54665455
_ASSERTE(OutstandingEvalCount() > 0);
54675456
DecrementOutstandingEvalCount();
@@ -5531,7 +5520,7 @@ void CordbProcess::RawDispatchEvent(
55315520
else
55325521
{
55335522
_ASSERTE (pEvent->NameChange.eventType == APP_DOMAIN_NAME_CHANGE);
5534-
pAppDomain.Assign(LookupOrCreateAppDomain(pEvent->NameChange.vmAppDomain));
5523+
pAppDomain.Assign(GetAppDomain());
55355524
if (pAppDomain)
55365525
{
55375526
pAppDomain->InvalidateName();
@@ -8559,33 +8548,6 @@ HRESULT CordbProcess::SafeReadBuffer(TargetBuffer tb, BYTE * pLocalBuffer, BOOL
85598548
return S_OK;
85608549
}
85618550

8562-
8563-
//---------------------------------------------------------------------------------------
8564-
// Lookup or create an appdomain.
8565-
//
8566-
// Arguments:
8567-
// vmAppDomain - CLR appdomain to lookup
8568-
//
8569-
// Returns:
8570-
// Instance of CordbAppDomain for the given appdomain. This is a cached instance.
8571-
// If the CordbAppDomain does not yet exist, it will be created and added to the cache.
8572-
// Never returns NULL. Throw on error.
8573-
CordbAppDomain * CordbProcess::LookupOrCreateAppDomain(VMPTR_AppDomain vmAppDomain)
8574-
{
8575-
if (m_pAppDomain == NULL)
8576-
{
8577-
_ASSERTE(GetProcessLock()->HasLock());
8578-
8579-
RSInitHolder<CordbAppDomain> pAppDomain;
8580-
pAppDomain.Assign(new CordbAppDomain(this, vmAppDomain)); // throws
8581-
8582-
m_pAppDomain = pAppDomain;
8583-
m_pAppDomain->InternalAddRef();
8584-
pAppDomain.ClearAndMarkDontNeuter();
8585-
}
8586-
return m_pAppDomain;
8587-
}
8588-
85898551
CordbAppDomain * CordbProcess::GetAppDomain()
85908552
{
85918553
// Return the one and only app domain
@@ -8594,10 +8556,17 @@ CordbAppDomain * CordbProcess::GetAppDomain()
85948556
return m_pAppDomain;
85958557
}
85968558

8559+
_ASSERTE(GetProcessLock()->HasLock());
8560+
85978561
VMPTR_AppDomain vmAppDomain;
85988562
IfFailThrow(GetDAC()->GetCurrentAppDomain(&vmAppDomain));
8599-
CordbAppDomain * appDomain = LookupOrCreateAppDomain(vmAppDomain);
8600-
return appDomain;
8563+
RSInitHolder<CordbAppDomain> pAppDomain;
8564+
pAppDomain.Assign(new CordbAppDomain(this, vmAppDomain)); // throws
8565+
8566+
m_pAppDomain = pAppDomain;
8567+
m_pAppDomain->InternalAddRef();
8568+
pAppDomain.ClearAndMarkDontNeuter();
8569+
return m_pAppDomain;
86018570
}
86028571

86038572
//---------------------------------------------------------------------------------------
@@ -8625,9 +8594,7 @@ HRESULT CordbProcess::EnumerateAppDomains(ICorDebugAppDomainEnum **ppAppDomains)
86258594
ValidateOrThrow(ppAppDomains);
86268595

86278596
// Ensure the appdomain is populated.
8628-
VMPTR_AppDomain vmAppDomain;
8629-
GetDAC()->GetCurrentAppDomain(&vmAppDomain);
8630-
LookupOrCreateAppDomain(vmAppDomain);
8597+
GetAppDomain();
86318598

86328599
RSSmartPtr<CordbAppDomain> rgAppDomains[1];
86338600
DWORD count = 0;
@@ -15082,11 +15049,9 @@ HRESULT CordbProcess::GetReferenceValueFromGCHandle(
1508215049
{
1508315050
ThrowHR(CORDBG_E_BAD_REFERENCE_VALUE);
1508415051
}
15085-
VMPTR_AppDomain vmAppDomain;
15086-
IfFailThrow(pDAC->GetCurrentAppDomain(&vmAppDomain));
1508715052

1508815053
RSLockHolder lockHolder(GetProcessLock());
15089-
CordbAppDomain * pAppDomain = LookupOrCreateAppDomain(vmAppDomain);
15054+
CordbAppDomain * pAppDomain = GetAppDomain();
1509015055
lockHolder.Release();
1509115056

1509215057
// Now that we finally have the AppDomain, we can go ahead and get a ReferenceValue

src/coreclr/debug/di/rspriv.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,9 +3658,6 @@ class CordbProcess :
36583658

36593659
void PrepopulateThreadsOrThrow();
36603660

3661-
// Lookup or create an appdomain.
3662-
CordbAppDomain * LookupOrCreateAppDomain(VMPTR_AppDomain vmAppDomain);
3663-
36643661
// Get the app domain.
36653662
CordbAppDomain * GetAppDomain();
36663663

src/coreclr/debug/di/rsstackwalk.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ HRESULT CordbStackWalk::GetFrameWorker(ICorDebugFrame ** ppFrame)
642642

643643
// Lookup the appdomain that the thread was in when it was executing code for this frame. We pass this
644644
// to the frame when we create it so we can properly resolve locals in that frame later.
645-
CordbAppDomain * pCurrentAppDomain = GetProcess()->LookupOrCreateAppDomain(frameData.vmCurrentAppDomainToken);
645+
CordbAppDomain * pCurrentAppDomain = GetProcess()->GetAppDomain();
646646
_ASSERTE(pCurrentAppDomain != NULL);
647647

648648
// Lookup the module
@@ -819,8 +819,7 @@ HRESULT CordbStackWalk::GetFrameWorker(ICorDebugFrame ** ppFrame)
819819

820820
// Lookup the appdomain that the thread was in when it was executing code for this frame. We pass this
821821
// to the frame when we create it so we can properly resolve locals in that frame later.
822-
CordbAppDomain * pCurrentAppDomain =
823-
GetProcess()->LookupOrCreateAppDomain(frameData.vmCurrentAppDomainToken);
822+
CordbAppDomain * pCurrentAppDomain = GetProcess()->GetAppDomain();
824823
_ASSERTE(pCurrentAppDomain != NULL);
825824

826825
CordbRuntimeUnwindableFrame * pRuntimeFrame = new CordbRuntimeUnwindableFrame(m_pCordbThread,

src/coreclr/debug/di/rsthread.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,12 +2300,7 @@ void CordbThread::GetActiveInternalFramesCallback(const DebuggerIPCE_STRData * p
23002300
_ASSERTE(pFrameData->eType == DebuggerIPCE_STRData::cStubFrame);
23012301

23022302
// Look up the CordbAppDomain.
2303-
CordbAppDomain * pAppDomain = NULL;
2304-
VMPTR_AppDomain vmCurrentAppDomain = pFrameData->vmCurrentAppDomainToken;
2305-
if (!vmCurrentAppDomain.IsNull())
2306-
{
2307-
pAppDomain = pThis->GetProcess()->LookupOrCreateAppDomain(vmCurrentAppDomain);
2308-
}
2303+
CordbAppDomain * pAppDomain = pThis->GetProcess()->GetAppDomain();
23092304

23102305
// Create a CordbInternalFrame.
23112306
CordbInternalFrame * pInternalFrame = new CordbInternalFrame(pThis,
@@ -10471,7 +10466,7 @@ HRESULT CordbEval::GetResult(ICorDebugValue **ppResult)
1047110466
// @dbgtodo funceval - push this up
1047210467
RSLockHolder lockHolder(GetProcess()->GetProcessLock());
1047310468

10474-
pAppDomain = m_thread->GetProcess()->LookupOrCreateAppDomain(m_resultAppDomainToken);
10469+
pAppDomain = m_thread->GetProcess()->GetAppDomain();
1047510470
}
1047610471
else
1047710472
{

src/coreclr/debug/inc/dacdbiinterface.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -490,24 +490,8 @@ IDacDbiInterface : public IUnknown
490490
// vmModule - vm handle to a module
491491
// pData - required out parameter which will be filled out with module properties
492492
//
493-
// Notes:
494-
// See definition of AssemblyInfo for more details about what properties
495-
// this gives back.
496493
virtual HRESULT STDMETHODCALLTYPE GetModuleData(VMPTR_Module vmModule, OUT ModuleInfo * pData) = 0;
497494

498-
499-
//
500-
// Get properties for a Assembly
501-
//
502-
// Arguments:
503-
// vmAssembly - vm handle to a Assembly
504-
// pData - required out parameter which will be filled out with module properties
505-
//
506-
// Notes:
507-
// See definition of AssemblyInfo for more details about what properties
508-
// this gives back.
509-
virtual HRESULT STDMETHODCALLTYPE GetAssemblyInfo(VMPTR_Assembly vmAssembly, OUT AssemblyInfo * pData) = 0;
510-
511495
virtual HRESULT STDMETHODCALLTYPE GetModuleForAssembly(VMPTR_Assembly vmAssembly, OUT VMPTR_Module * pModule) = 0;
512496

513497
//.........................................................................

src/coreclr/debug/inc/dacdbistructures.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,10 @@ struct MSLAYOUT TargetBuffer
160160
ULONG cbSize;
161161
};
162162

163-
//===================================================================================
164163
// Module properties, retrieved by DAC.
165-
// Describes a VMPTR_Assembly representing a module.
166-
//===================================================================================
167-
struct MSLAYOUT AssemblyInfo
168-
{
169-
// The appdomain that the Assembly is associated with.
170-
VMPTR_AppDomain vmAppDomain;
171-
172-
// The assembly this module belongs to. All modules live in an assembly.
173-
VMPTR_Assembly vmAssembly;
174-
};
175-
176164
struct MSLAYOUT ModuleInfo
177165
{
178-
// The non-domain specific assembly which this module resides in.
166+
// The assembly which this module resides in.
179167
VMPTR_Assembly vmAssembly;
180168

181169
// The PE Base address and size of the module. These may be 0 if there is no image

0 commit comments

Comments
 (0)