Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4522c6d

Browse files
authored
update DacHeapWalker to know about POH, which will start returning POH segments and objects in ICorDebug (dotnet#38146)
1 parent 8b67e34 commit 4522c6d

File tree

3 files changed

+7173
-7157
lines changed

3 files changed

+7173
-7157
lines changed

src/coreclr/src/debug/daccess/dacdbiimpl.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6604,6 +6604,8 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
66046604
dac_generation gen1 = *GenerationTableIndex(g_gcDacGlobals->generation_table, 1);
66056605
dac_generation gen2 = *GenerationTableIndex(g_gcDacGlobals->generation_table, 2);
66066606
dac_generation loh = *GenerationTableIndex(g_gcDacGlobals->generation_table, 3);
6607+
dac_generation poh = *GenerationTableIndex(g_gcDacGlobals->generation_table, 4);
6608+
66076609
pHeaps[0].YoungestGenPtr = (CORDB_ADDRESS)gen0.allocation_context.alloc_ptr;
66086610
pHeaps[0].YoungestGenLimit = (CORDB_ADDRESS)gen0.allocation_context.alloc_limit;
66096611

@@ -6613,6 +6615,7 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
66136615

66146616
// Segments
66156617
int count = GetSegmentCount(loh.start_segment);
6618+
count += GetSegmentCount(poh.start_segment);
66166619
count += GetSegmentCount(gen2.start_segment);
66176620

66186621
pHeaps[0].SegmentCount = count;
@@ -6652,6 +6655,17 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
66526655
seg = seg->next;
66536656
}
66546657

6658+
// Pinned object heap segments
6659+
seg = poh.start_segment;
6660+
for (; seg && (i < count); ++i)
6661+
{
6662+
pHeaps[0].Segments[i].Generation = 4;
6663+
pHeaps[0].Segments[i].Start = (CORDB_ADDRESS)seg->mem;
6664+
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;
6665+
6666+
seg = seg->next;
6667+
}
6668+
66556669
return S_OK;
66566670
}
66576671

@@ -6815,7 +6829,7 @@ HRESULT DacDbiInterfaceImpl::GetHeapSegments(OUT DacDbiArrayList<COR_SEGMENT> *p
68156829
seg.start = heaps[i].Segments[j].Start;
68166830
seg.end = heaps[i].Segments[j].End;
68176831

6818-
_ASSERTE(heaps[i].Segments[j].Generation <= CorDebug_LOH);
6832+
_ASSERTE(heaps[i].Segments[j].Generation <= CorDebug_POH);
68196833
seg.type = (CorDebugGenerationTypes)heaps[i].Segments[j].Generation;
68206834
seg.heap = (ULONG)i;
68216835
}

src/coreclr/src/inc/cordebug.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,7 @@ typedef enum CorDebugGenerationTypes
25072507
CorDebug_Gen1 = 1,
25082508
CorDebug_Gen2 = 2,
25092509
CorDebug_LOH = 3,
2510+
CorDebug_POH = 4,
25102511
} CorDebugGenerationTypes;
25112512

25122513
typedef struct _COR_SEGMENT

0 commit comments

Comments
 (0)