Skip to content

Commit fcfb4ae

Browse files
barosiakrcj1
andauthored
Remove DacDbi GetAppDomainObject API from native and cDAC (#127673)
GetRawExposedObjectHandleForDebugger() always returned NULL, making GetAppDomainObject a no-op. This pr removes it from all layers: - IDacDbiInterface (abstract interface + IDL) - DacDbiInterfaceImpl (native implementation) - cDAC managed interface and implementation - AppDomain::GetRawExposedObjectHandleForDebugger (sole consumer) - CordbAppDomain::GetObject call site (simplified, since deletion created new dead code) --------- Co-authored-by: Rachel Jarvi <rachel.jarvi@gmail.com>
1 parent b745957 commit fcfb4ae

8 files changed

Lines changed: 4 additions & 67 deletions

File tree

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -664,26 +664,6 @@ HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetAppDomainId(VMPTR_AppDomain vm
664664
return hr;
665665
}
666666

667-
// Get the managed AppDomain object for an AppDomain.
668-
HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetAppDomainObject(VMPTR_AppDomain vmAppDomain, OUT VMPTR_OBJECTHANDLE * pRetVal)
669-
{
670-
DD_ENTER_MAY_THROW;
671-
672-
HRESULT hr = S_OK;
673-
EX_TRY
674-
{
675-
676-
AppDomain* pAppDomain = vmAppDomain.GetDacPtr();
677-
OBJECTHANDLE hAppDomainManagedObject = pAppDomain->GetRawExposedObjectHandleForDebugger();
678-
VMPTR_OBJECTHANDLE vmObj = VMPTR_OBJECTHANDLE::NullPtr();
679-
vmObj.SetDacTargetPtr(hAppDomainManagedObject);
680-
*pRetVal = vmObj;
681-
682-
}
683-
EX_CATCH_HRESULT(hr);
684-
return hr;
685-
}
686-
687667
// Get the full AD friendly name for the given EE AppDomain.
688668
HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName)
689669
{

src/coreclr/debug/daccess/dacdbiimpl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ class DacDbiInterfaceImpl :
8787
// Get the AppDomain ID for an AppDomain.
8888
HRESULT STDMETHODCALLTYPE GetAppDomainId(VMPTR_AppDomain vmAppDomain, OUT ULONG * pRetVal);
8989

90-
// Get the managed AppDomain object for an AppDomain.
91-
HRESULT STDMETHODCALLTYPE GetAppDomainObject(VMPTR_AppDomain vmAppDomain, OUT VMPTR_OBJECTHANDLE * pRetVal);
92-
9390
// Get the full AD friendly name for the appdomain.
9491
HRESULT STDMETHODCALLTYPE GetAppDomainFullName(VMPTR_AppDomain vmAppDomain, IStringHolder * pStrName);
9592

src/coreclr/debug/di/rsappdomain.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ HRESULT CordbAppDomain::GetName(ULONG32 cchName,
702702
}
703703

704704
/*
705-
* GetObject returns the runtime app domain object.
706-
* Note: this is lazily initialized and may be NULL
705+
* GetObject always returns S_FALSE with a null object.
706+
* The runtime AppDomain object is not available through this API.
707707
*/
708708
HRESULT CordbAppDomain::GetObject(ICorDebugValue **ppObject)
709709
{
@@ -714,24 +714,11 @@ HRESULT CordbAppDomain::GetObject(ICorDebugValue **ppObject)
714714
ATT_REQUIRE_STOPPED_MAY_FAIL(GetProcess());
715715

716716
_ASSERTE(!m_vmAppDomain.IsNull());
717-
IDacDbiInterface * pDac = NULL;
718717
HRESULT hr = S_OK;
719718
EX_TRY
720719
{
721-
pDac = m_pProcess->GetDAC();
722-
VMPTR_OBJECTHANDLE vmObjHandle;
723-
IfFailThrow(pDac->GetAppDomainObject(m_vmAppDomain, &vmObjHandle));
724-
if (!vmObjHandle.IsNull())
725-
{
726-
ICorDebugReferenceValue * pRefValue = NULL;
727-
hr = CordbReferenceValue::BuildFromGCHandle(this, vmObjHandle, &pRefValue);
728-
*ppObject = pRefValue;
729-
}
730-
else
731-
{
732-
*ppObject = NULL;
733-
hr = S_FALSE;
734-
}
720+
*ppObject = NULL;
721+
hr = S_FALSE;
735722
}
736723
EX_CATCH_HRESULT(hr);
737724

src/coreclr/debug/inc/dacdbiinterface.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,23 +265,6 @@ IDacDbiInterface : public IUnknown
265265
//
266266
virtual HRESULT STDMETHODCALLTYPE GetAppDomainId(VMPTR_AppDomain vmAppDomain, OUT ULONG * pRetVal) = 0;
267267

268-
//
269-
// Get the managed AppDomain object for an AppDomain.
270-
//
271-
// Arguments:
272-
// vmAppDomain - VM pointer to the AppDomain object of interest
273-
// pRetVal - [out] Objecthandle for the managed app domain object or the Null VMPTR if there is no object created yet.
274-
//
275-
// Return Value:
276-
// S_OK on success; otherwise, an appropriate failure HRESULT.
277-
//
278-
// Notes:
279-
// The AppDomain managed object is lazily constructed on the AppDomain the first time
280-
// it is requested. It may be NULL.
281-
//
282-
virtual HRESULT STDMETHODCALLTYPE GetAppDomainObject(VMPTR_AppDomain vmAppDomain, OUT VMPTR_OBJECTHANDLE * pRetVal) = 0;
283-
284-
285268
//
286269
// Get the full AD friendly name for the given EE AppDomain.
287270
//

src/coreclr/inc/dacdbi.idl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ interface IDacDbiInterface : IUnknown
202202

203203
// App Domains
204204
HRESULT GetAppDomainId([in] VMPTR_AppDomain vmAppDomain, [out] ULONG * pRetVal);
205-
HRESULT GetAppDomainObject([in] VMPTR_AppDomain vmAppDomain, [out] VMPTR_OBJECTHANDLE * pRetVal);
206205
HRESULT GetAppDomainFullName([in] VMPTR_AppDomain vmAppDomain, [in] IDacDbiStringHolder pStrName);
207206
HRESULT GetModuleSimpleName([in] VMPTR_Module vmModule, [in] IDacDbiStringHolder pStrFilename);
208207
HRESULT GetAssemblyPath([in] VMPTR_Assembly vmAssembly, [in] IDacDbiStringHolder pStrFilename, [out] BOOL * pResult);

src/coreclr/vm/appdomain.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,6 @@ class AppDomain final
675675
STRINGREF *IsStringInterned(STRINGREF *pString);
676676
STRINGREF *GetOrInternString(STRINGREF *pString);
677677

678-
OBJECTREF GetRawExposedObject() { LIMITED_METHOD_CONTRACT; return NULL; }
679-
OBJECTHANDLE GetRawExposedObjectHandleForDebugger() { LIMITED_METHOD_DAC_CONTRACT; return (OBJECTHANDLE)NULL; }
680-
681678
#ifndef DACCESS_COMPILE
682679
PTR_NativeImage GetNativeImage(LPCUTF8 compositeFileName);
683680
PTR_NativeImage SetNativeImage(LPCUTF8 compositeFileName, PTR_NativeImage pNativeImage);

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ public int GetAppDomainId(ulong vmAppDomain, uint* pRetVal)
120120
return hr;
121121
}
122122

123-
public int GetAppDomainObject(ulong vmAppDomain, ulong* pRetVal)
124-
=> LegacyFallbackHelper.CanFallback() && _legacy is not null ? _legacy.GetAppDomainObject(vmAppDomain, pRetVal) : HResults.E_NOTIMPL;
125-
126123
public int GetAppDomainFullName(ulong vmAppDomain, nint pStrName)
127124
{
128125
int hr = HResults.S_OK;

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ public unsafe partial interface IDacDbiInterface
166166
[PreserveSig]
167167
int GetAppDomainId(ulong vmAppDomain, uint* pRetVal);
168168

169-
[PreserveSig]
170-
int GetAppDomainObject(ulong vmAppDomain, ulong* pRetVal);
171-
172169
[PreserveSig]
173170
int GetAppDomainFullName(ulong vmAppDomain, nint pStrName);
174171

0 commit comments

Comments
 (0)