Skip to content

Commit b131b6d

Browse files
authored
adding GetOtherNotificationFlags cDAC API (#117616)
* adding GetOtherNotificationFlags cDAC API * adding .md file for globals
1 parent 822cb27 commit b131b6d

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Debug Interface Globals
2+
3+
The following document lists the global variables that are used directly in the debug interface managed code (SOSDacImpl.cs, etc.)
4+
5+
Global variables used
6+
| Global Name | Type | Purpose |
7+
| --- | --- | --- |
8+
| StringMethodTable | TargetPointer | Identify where the string MethodTable exists |
9+
| ObjectMethodTable | TargetPointer | Identify where the object MethodTable exists |
10+
| SystemDomain | TargetPointer | Identify where the SystemDomain exists |
11+
| DirectorySeparator | TargetPointer | Identify where the directory separator exists |
12+
| FeatureCOMInterop | TargetPointer | Identify where the flag for FeatureCOMInterop exists |
13+
| StressLog | TargetPointer | Identify where the StressLog exists |
14+
| AppDomain | TargetPointer | Identify where the AppDomain exists |
15+
| ObjectArrayMethodTable | TargetPointer | Identify where the ObjectArrayMethodTable exists |
16+
| ExceptionMethodTable | TargetPointer | Identify where the ExceptionMethodTable exists |
17+
| FreeObjectMethodTable | TargetPointer | Identify where the FreeObjectMethodTable exists |
18+
| SOSBreakingChangeVersion | TargetPointer | Identify where the SOSBreakingChangeVersion exists |
19+
| DacNotificationFlags | TargetPointer | Identify where the DacNotificationFlags exists |
20+
| MaxClrNotificationArgs | uint32 | Identify the maximum number of CLR notification arguments |
21+
| ClrNotificationArguments | TargetPointer | Identify where the ClrNotificationArguments exists |
22+
| DefaultADID | uint | Identify the default AppDomain ID |

src/coreclr/debug/runtimeinfo/datadescriptor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,7 @@ CDAC_GLOBAL_POINTER(StringMethodTable, &::g_pStringClass)
968968
CDAC_GLOBAL_POINTER(SyncTableEntries, &::g_pSyncTable)
969969
CDAC_GLOBAL_POINTER(MiniMetaDataBuffAddress, &::g_MiniMetaDataBuffAddress)
970970
CDAC_GLOBAL_POINTER(MiniMetaDataBuffMaxSize, &::g_MiniMetaDataBuffMaxSize)
971+
CDAC_GLOBAL_POINTER(DacNotificationFlags, &::g_dacNotificationFlags)
971972
CDAC_GLOBAL_POINTER(OffsetOfCurrentThreadInfo, &::g_offsetOfCurrentThreadInfo)
972973
#ifdef TARGET_WINDOWS
973974
CDAC_GLOBAL_POINTER(TlsIndexBase, &::_tls_index)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static class Globals
2727

2828
public const string MiniMetaDataBuffAddress = nameof(MiniMetaDataBuffAddress);
2929
public const string MiniMetaDataBuffMaxSize = nameof(MiniMetaDataBuffMaxSize);
30+
public const string DacNotificationFlags = nameof(DacNotificationFlags);
3031
public const string OffsetOfCurrentThreadInfo = nameof(OffsetOfCurrentThreadInfo);
3132
public const string TlsIndexBase = nameof(TlsIndexBase);
3233

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Runtime.InteropServices;
66
using System.Runtime.InteropServices.Marshalling;
7+
using System.Diagnostics;
78

89
namespace Microsoft.Diagnostics.DataContractReader.Legacy;
910

@@ -210,8 +211,27 @@ int IXCLRDataProcess.SetCodeNotifications(
210211
=> _legacyProcess is not null ? _legacyProcess.SetCodeNotifications(numTokens, mods, singleMod, tokens, flags, singleFlags) : HResults.E_NOTIMPL;
211212

212213
int IXCLRDataProcess.GetOtherNotificationFlags(uint* flags)
213-
=> _legacyProcess is not null ? _legacyProcess.GetOtherNotificationFlags(flags) : HResults.E_NOTIMPL;
214-
214+
{
215+
int hr = HResults.S_OK;
216+
try
217+
{
218+
*flags = _target.Read<uint>(_target.ReadGlobalPointer(Constants.Globals.DacNotificationFlags));
219+
}
220+
catch (System.Exception ex)
221+
{
222+
hr = ex.HResult;
223+
}
224+
#if DEBUG
225+
if (_legacyProcess is not null)
226+
{
227+
uint flagsLocal;
228+
int hrLocal = _legacyProcess.GetOtherNotificationFlags(&flagsLocal);
229+
Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
230+
Debug.Assert(*flags == flagsLocal);
231+
}
232+
#endif
233+
return hr;
234+
}
215235
int IXCLRDataProcess.SetOtherNotificationFlags(uint flags)
216236
=> _legacyProcess is not null ? _legacyProcess.SetOtherNotificationFlags(flags) : HResults.E_NOTIMPL;
217237

0 commit comments

Comments
 (0)