Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change generation for NonGC objects for debugger #89927

Merged
merged 7 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6743,7 +6743,7 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
seg = gen2.start_segment;
for (; seg && (i < count); ++i)
{
pHeaps[0].Segments[i].Generation = 2;
pHeaps[0].Segments[i].Generation = seg->flags & HEAP_SEGMENT_FLAGS_READONLY ? CorDebug_NonGC : CorDebug_Gen2;
pHeaps[0].Segments[i].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;

Expand All @@ -6752,7 +6752,7 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
seg = gen1.start_segment;
for (; seg && (i < count); ++i)
{
pHeaps[0].Segments[i].Generation = 1;
pHeaps[0].Segments[i].Generation = CorDebug_Gen1;
pHeaps[0].Segments[i].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;

Expand All @@ -6771,7 +6771,7 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
{
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;
}
pHeaps[0].Segments[i].Generation = 0;
pHeaps[0].Segments[i].Generation = CorDebug_Gen0;

seg = seg->next;
}
Expand All @@ -6785,13 +6785,13 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
if (seg.GetAddr() == (TADDR)*g_gcDacGlobals->ephemeral_heap_segment)
{
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)*g_gcDacGlobals->alloc_allocated;
pHeaps[0].Segments[i].Generation = 1;
pHeaps[0].Segments[i].Generation = CorDebug_Gen1;
pHeaps[0].EphemeralSegment = i;
}
else
{
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;
pHeaps[0].Segments[i].Generation = 2;
pHeaps[0].Segments[i].Generation = seg->flags & HEAP_SEGMENT_FLAGS_READONLY ? CorDebug_NonGC : CorDebug_Gen2;
}

seg = seg->next;
Expand All @@ -6802,7 +6802,7 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
seg = loh.start_segment;
for (; seg && (i < count); ++i)
{
pHeaps[0].Segments[i].Generation = 3;
pHeaps[0].Segments[i].Generation = CorDebug_LOH;
pHeaps[0].Segments[i].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;

Expand All @@ -6813,7 +6813,7 @@ HRESULT DacHeapWalker::InitHeapDataWks(HeapData *&pHeaps, size_t &pCount)
seg = poh.start_segment;
for (; seg && (i < count); ++i)
{
pHeaps[0].Segments[i].Generation = 4;
pHeaps[0].Segments[i].Generation = CorDebug_POH;
pHeaps[0].Segments[i].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[0].Segments[i].End = (CORDB_ADDRESS)seg->allocated;

Expand Down Expand Up @@ -6995,13 +6995,13 @@ HRESULT DacDbiInterfaceImpl::GetHeapSegments(OUT DacDbiArrayList<COR_SEGMENT> *p
}
else
{
// Otherwise, we have a gen2 or gen3 (LOH) segment
// Otherwise, we have a gen2, POH, LOH or NonGC
_ASSERTE(curr < total);
COR_SEGMENT &seg = (*pSegments)[curr++];
seg.start = heaps[i].Segments[j].Start;
seg.end = heaps[i].Segments[j].End;

_ASSERTE(heaps[i].Segments[j].Generation <= CorDebug_POH);
_ASSERTE(heaps[i].Segments[j].Generation <= CorDebug_NonGC);
seg.type = (CorDebugGenerationTypes)heaps[i].Segments[j].Generation;
seg.heap = (ULONG)i;
}
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/debug/daccess/request_svr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
seg = gen2.start_segment;
for (; seg && (j < count); ++j)
{
pHeaps[i].Segments[j].Generation = 2;
pHeaps[i].Segments[j].Generation = seg->flags & HEAP_SEGMENT_FLAGS_READONLY ? CorDebug_NonGC : CorDebug_Gen2;;
pHeaps[i].Segments[j].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated;

Expand All @@ -386,7 +386,7 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
seg = gen1.start_segment;
for (; seg && (j < count); ++j)
{
pHeaps[i].Segments[j].Generation = 1;
pHeaps[i].Segments[j].Generation = CorDebug_Gen1;
pHeaps[i].Segments[j].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated;

Expand All @@ -400,12 +400,12 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
{
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)pHeap->alloc_allocated;
pHeaps[i].EphemeralSegment = j;
pHeaps[i].Segments[j].Generation = 0;
pHeaps[i].Segments[j].Generation = CorDebug_Gen0;
}
else
{
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated;
pHeaps[i].Segments[j].Generation = 2;
pHeaps[i].Segments[j].Generation = seg->flags & HEAP_SEGMENT_FLAGS_READONLY ? CorDebug_NonGC : CorDebug_Gen2;;
}

seg = seg->next;
Expand All @@ -421,12 +421,12 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
{
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)pHeap->alloc_allocated;
pHeaps[i].EphemeralSegment = j;
pHeaps[i].Segments[j].Generation = 1;
pHeaps[i].Segments[j].Generation = CorDebug_Gen1;
}
else
{
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated;
pHeaps[i].Segments[j].Generation = 2;
pHeaps[i].Segments[j].Generation = seg->flags & HEAP_SEGMENT_FLAGS_READONLY ? CorDebug_NonGC : CorDebug_Gen2;;
}

seg = seg->next;
Expand All @@ -437,7 +437,7 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
seg = loh.start_segment;
for (; seg && (j < count); ++j)
{
pHeaps[i].Segments[j].Generation = 3;
pHeaps[i].Segments[j].Generation = CorDebug_LOH;
pHeaps[i].Segments[j].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated;

Expand All @@ -448,7 +448,7 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
seg = poh.start_segment;
for (; seg && (j < count); ++j)
{
pHeaps[i].Segments[j].Generation = 4;
pHeaps[i].Segments[j].Generation = CorDebug_POH;
pHeaps[i].Segments[j].Start = (CORDB_ADDRESS)seg->mem;
pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated;

Expand Down
1 change: 1 addition & 0 deletions src/coreclr/inc/cordebug.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,7 @@ typedef enum CorDebugGenerationTypes
CorDebug_Gen2 = 2,
CorDebug_LOH = 3,
CorDebug_POH = 4,
CorDebug_NonGC = 0x7FFFFFFF,
} CorDebugGenerationTypes;

typedef struct _COR_SEGMENT
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/pal/prebuilt/inc/cordebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -6538,7 +6538,8 @@ enum CorDebugGenerationTypes
CorDebug_Gen1 = 1,
CorDebug_Gen2 = 2,
CorDebug_LOH = 3,
CorDebug_POH = 4
CorDebug_POH = 4,
CorDebug_NonGC = 0x7FFFFFFF
} CorDebugGenerationTypes;

typedef struct _COR_SEGMENT
Expand Down
Loading