Skip to content

Commit 9a23f47

Browse files
committed
Let the debugger knows DATAS is on
1 parent 7318855 commit 9a23f47

File tree

11 files changed

+142
-3
lines changed

11 files changed

+142
-3
lines changed

src/coreclr/debug/daccess/daccess.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,6 +3245,10 @@ ClrDataAccess::QueryInterface(THIS_
32453245
{
32463246
ifaceRet = static_cast<ISOSDacInterface15*>(this);
32473247
}
3248+
else if (IsEqualIID(interfaceId, __uuidof(ISOSDacInterface16)))
3249+
{
3250+
ifaceRet = static_cast<ISOSDacInterface16*>(this);
3251+
}
32483252
else
32493253
{
32503254
*iface = NULL;

src/coreclr/debug/daccess/dacimpl.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,8 @@ class ClrDataAccess
817817
public ISOSDacInterface12,
818818
public ISOSDacInterface13,
819819
public ISOSDacInterface14,
820-
public ISOSDacInterface15
820+
public ISOSDacInterface15,
821+
public ISOSDacInterface16
821822
{
822823
public:
823824
ClrDataAccess(ICorDebugDataTarget * pTarget, ICLRDataTarget * pLegacyTarget=0);
@@ -1225,6 +1226,9 @@ class ClrDataAccess
12251226
// ISOSDacInterface15
12261227
virtual HRESULT STDMETHODCALLTYPE GetMethodTableSlotEnumerator(CLRDATA_ADDRESS mt, ISOSMethodEnum **enumerator);
12271228

1229+
// ISOSDacInterface16
1230+
virtual HRESULT STDMETHODCALLTYPE GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode);
1231+
12281232
//
12291233
// ClrDataAccess.
12301234
//

src/coreclr/debug/daccess/request.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,6 +3363,24 @@ ClrDataAccess::GetGCHeapStaticData(struct DacpGcHeapDetails *detailsData)
33633363
return hr;
33643364
}
33653365

3366+
HRESULT
3367+
ClrDataAccess::GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode)
3368+
{
3369+
SOSDacEnter();
3370+
if (IsDatasEnabled())
3371+
{
3372+
*pDynamicAdaptationMode = *g_gcDacGlobals->dynamic_adaptation_mode;
3373+
hr = S_OK;
3374+
}
3375+
else
3376+
{
3377+
*pDynamicAdaptationMode = -1;
3378+
hr = S_FALSE;
3379+
}
3380+
SOSDacLeave();
3381+
return hr;
3382+
}
3383+
33663384
HRESULT
33673385
ClrDataAccess::GetHeapSegmentData(CLRDATA_ADDRESS seg, struct DacpHeapSegmentData *heapSegment)
33683386
{

src/coreclr/debug/daccess/request_common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ inline bool IsBackgroundGCEnabled()
113113
return (g_gcDacGlobals->minor_version_number & 2) == 0;
114114
}
115115

116+
inline bool IsDatasEnabled()
117+
{
118+
return (g_gcDacGlobals->minor_version_number & 4) != 0;
119+
}
120+
116121
// Load an instance of dac_gc_heap for the heap pointed by heap.
117122
// Fields that does not exist in the current gc_heap instance is zero initialized.
118123
// Return the dac_gc_heap object.

src/coreclr/gc/dac_gcheap_fields.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ DEFINE_MISSING_FIELD(freeable_uoh_segment)
5353
DEFINE_ARRAY_FIELD (free_regions, dac_region_free_list, FREE_REGION_KINDS)
5454
#else
5555
DEFINE_MISSING_FIELD(free_regions)
56-
#endif // ALL_FIELDS
56+
#endif // defined(ALL_FIELDS) || defined(USE_REGIONS)

src/coreclr/gc/gc.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53032,6 +53032,7 @@ bool GCHeap::IsConcurrentGCEnabled()
5303253032
void PopulateDacVars(GcDacVars *gcDacVars)
5303353033
{
5303453034
bool v2 = gcDacVars->minor_version_number >= 2;
53035+
bool v4 = gcDacVars->minor_version_number >= 4;
5303553036

5303653037
#define DEFINE_FIELD(field_name, field_type) offsetof(CLASS_NAME, field_name),
5303753038
#define DEFINE_DPTR_FIELD(field_name, field_type) offsetof(CLASS_NAME, field_name),
@@ -53082,6 +53083,9 @@ void PopulateDacVars(GcDacVars *gcDacVars)
5308253083
#ifndef BACKGROUND_GC
5308353084
gcDacVars->minor_version_number |= 2;
5308453085
#endif //!BACKGROUND_GC
53086+
#ifdef DYNAMIC_HEAP_COUNT
53087+
gcDacVars->minor_version_number |= 4;
53088+
#endif //DYNAMIC_HEAP_COUNT
5308553089
gcDacVars->built_with_svr = &g_built_with_svr_gc;
5308653090
gcDacVars->build_variant = &g_build_variant;
5308753091
gcDacVars->gc_structures_invalid_cnt = const_cast<int32_t*>(&GCScan::m_GcStructuresInvalidCnt);
@@ -53157,6 +53161,14 @@ void PopulateDacVars(GcDacVars *gcDacVars)
5315753161
{
5315853162
gcDacVars->bookkeeping_start = &gc_heap::bookkeeping_start;
5315953163
}
53164+
if (v4)
53165+
{
53166+
#ifdef DYNAMIC_HEAP_COUNT
53167+
gcDacVars->dynamic_adaptation_mode = &gc_heap::dynamic_adaptation_mode;
53168+
#else
53169+
gcDacVars->dynamic_adaptation_mode = nullptr;
53170+
#endif //DYNAMIC_HEAP_COUNT
53171+
}
5316053172
}
5316153173

5316253174
int GCHeap::RefreshMemoryLimit()

src/coreclr/gc/gcinterface.dacvars.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ GC_DAC_VAL (int, total_bookkeeping_elements)
8888
GC_DAC_VAL (int, count_free_region_kinds)
8989
GC_DAC_VAL (size_t, card_table_info_size)
9090

91+
// Here is where v5.4 fields starts
92+
GC_DAC_VAR (int, dynamic_adaptation_mode)
93+
9194
#undef GC_DAC_VAR
9295
#undef GC_DAC_ARRAY_VAR
9396
#undef GC_DAC_PTR_VAR

src/coreclr/gc/gcinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// The minor version of the IGCHeap interface. Non-breaking changes are required
1212
// to bump the minor version number. GCs and EEs with minor version number
1313
// mismatches can still interoperate correctly, with some care.
14-
#define GC_INTERFACE_MINOR_VERSION 3
14+
#define GC_INTERFACE_MINOR_VERSION 4
1515

1616
// The major version of the IGCToCLR interface. Breaking changes to this interface
1717
// require bumps in the major version number.

src/coreclr/inc/sospriv.idl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,13 @@ interface ISOSDacInterface15 : IUnknown
562562
{
563563
HRESULT GetMethodTableSlotEnumerator(CLRDATA_ADDRESS mt, ISOSMethodEnum **enumerator);
564564
}
565+
566+
[
567+
object,
568+
local,
569+
uuid(4ba12ff8-daac-4e43-ac56-98cf8d5c595d)
570+
]
571+
interface ISOSDacInterface16 : IUnknown
572+
{
573+
HRESULT GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode);
574+
}

src/coreclr/pal/prebuilt/idl/sospriv_i.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ MIDL_DEFINE_GUID(IID, IID_ISOSMethodEnum,0x3c0fe725,0xc324,0x4a4f,0x81,0x00,0xd3
127127

128128
MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface15,0x7ed81261,0x52a9,0x4a23,0xa3,0x58,0xc3,0x31,0x3d,0xea,0x30,0xa8);
129129

130+
131+
MIDL_DEFINE_GUID(IID, IID_ISOSDacInterface16,0x4ba12ff8,0xdaac,0x4e43,0xac,0x56,0x98,0xcf,0x8d,0x5c,0x59,0x5d);
132+
130133
#undef MIDL_DEFINE_GUID
131134

132135
#ifdef __cplusplus

src/coreclr/pal/prebuilt/inc/sospriv.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,6 +3685,86 @@ EXTERN_C const IID IID_ISOSDacInterface15;
36853685
#endif /* __ISOSDacInterface15_INTERFACE_DEFINED__ */
36863686

36873687

3688+
#ifndef __ISOSDacInterface16_INTERFACE_DEFINED__
3689+
#define __ISOSDacInterface16_INTERFACE_DEFINED__
3690+
3691+
/* interface ISOSDacInterface16 */
3692+
/* [uuid][local][object] */
3693+
3694+
3695+
EXTERN_C const IID IID_ISOSDacInterface16;
3696+
3697+
#if defined(__cplusplus) && !defined(CINTERFACE)
3698+
3699+
MIDL_INTERFACE("4ba12ff8-daac-4e43-ac56-98cf8d5c595d")
3700+
ISOSDacInterface16 : public IUnknown
3701+
{
3702+
public:
3703+
virtual HRESULT STDMETHODCALLTYPE GetGCDynamicAdaptationMode(
3704+
int *pDynamicAdaptationMode) = 0;
3705+
3706+
};
3707+
3708+
3709+
#else /* C style interface */
3710+
3711+
typedef struct ISOSDacInterface16Vtbl
3712+
{
3713+
BEGIN_INTERFACE
3714+
3715+
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
3716+
ISOSDacInterface16 * This,
3717+
/* [in] */ REFIID riid,
3718+
/* [annotation][iid_is][out] */
3719+
_COM_Outptr_ void **ppvObject);
3720+
3721+
ULONG ( STDMETHODCALLTYPE *AddRef )(
3722+
ISOSDacInterface16 * This);
3723+
3724+
ULONG ( STDMETHODCALLTYPE *Release )(
3725+
ISOSDacInterface16 * This);
3726+
3727+
HRESULT ( STDMETHODCALLTYPE *GetGCDynamicAdaptationMode )(
3728+
ISOSDacInterface16 * This,
3729+
int *pDynamicAdaptationMode);
3730+
3731+
END_INTERFACE
3732+
} ISOSDacInterface16Vtbl;
3733+
3734+
interface ISOSDacInterface16
3735+
{
3736+
CONST_VTBL struct ISOSDacInterface16Vtbl *lpVtbl;
3737+
};
3738+
3739+
3740+
3741+
#ifdef COBJMACROS
3742+
3743+
3744+
#define ISOSDacInterface16_QueryInterface(This,riid,ppvObject) \
3745+
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
3746+
3747+
#define ISOSDacInterface16_AddRef(This) \
3748+
( (This)->lpVtbl -> AddRef(This) )
3749+
3750+
#define ISOSDacInterface16_Release(This) \
3751+
( (This)->lpVtbl -> Release(This) )
3752+
3753+
3754+
#define ISOSDacInterface16_GetGCDynamicAdaptationMode(This,pDynamicAdaptationMode) \
3755+
( (This)->lpVtbl -> GetGCDynamicAdaptationMode(This,pDynamicAdaptationMode) )
3756+
3757+
#endif /* COBJMACROS */
3758+
3759+
3760+
#endif /* C style interface */
3761+
3762+
3763+
3764+
3765+
#endif /* __ISOSDacInterface16_INTERFACE_DEFINED__ */
3766+
3767+
36883768
/* Additional Prototypes for ALL interfaces */
36893769

36903770
/* end of Additional Prototypes */

0 commit comments

Comments
 (0)