Skip to content

Commit 956aba4

Browse files
rcj1Rachel Jarvi
andauthored
adding GetDomainFromContext cDAC API (#117517)
Co-authored-by: Rachel Jarvi <[email protected]>
1 parent e717202 commit 956aba4

File tree

1 file changed

+25
-1
lines changed
  • src/native/managed/cdac/mscordaccore_universal/Legacy

1 file changed

+25
-1
lines changed

src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,31 @@ int ISOSDacInterface.GetCodeHeapList(ClrDataAddress jitManager, uint count, void
242242
int ISOSDacInterface.GetDacModuleHandle(void* phModule)
243243
=> _legacyImpl is not null ? _legacyImpl.GetDacModuleHandle(phModule) : HResults.E_NOTIMPL;
244244
int ISOSDacInterface.GetDomainFromContext(ClrDataAddress context, ClrDataAddress* domain)
245-
=> _legacyImpl is not null ? _legacyImpl.GetDomainFromContext(context, domain) : HResults.E_NOTIMPL;
245+
{
246+
int hr = HResults.S_OK;
247+
if (context == 0 || domain == null)
248+
{
249+
return HResults.E_INVALIDARG;
250+
}
251+
try
252+
{
253+
*domain = context;
254+
}
255+
catch (System.Exception ex)
256+
{
257+
hr = ex.HResult;
258+
}
259+
#if DEBUG
260+
if (_legacyImpl is not null)
261+
{
262+
ClrDataAddress domainLocal;
263+
int hrLocal = _legacyImpl.GetDomainFromContext(context, &domainLocal);
264+
Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
265+
Debug.Assert(domainLocal == context, $"cDAC: {context:x}, DAC: {domainLocal:x}");
266+
}
267+
#endif
268+
return hr;
269+
}
246270
int ISOSDacInterface.GetDomainLocalModuleData(ClrDataAddress addr, void* data)
247271
{
248272
// CoreCLR does not use domain local modules anymore

0 commit comments

Comments
 (0)