Skip to content

Commit

Permalink
Actually fix issue #21484 reported by the customer. (dotnet#21850)
Browse files Browse the repository at this point in the history
GC heap globals like ephemeral_heap_segment and finalize_queue are
null/invalid for a server GC. Add a check to skip the workstation GC
memory enumeration if server. The server memory enumeration already
skips if workstation GC.
  • Loading branch information
mikem8361 authored and Sergey Andreenko committed Jan 8, 2019
1 parent a675032 commit 948c7a7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2787,11 +2787,14 @@ ClrDataAccess::GetGCHeapStaticData(struct DacpGcHeapDetails *detailsData)
detailsData->generation_table[i].allocContextLimit = (CLRDATA_ADDRESS)alloc_context->alloc_limit;
}

DPTR(dac_finalize_queue) fq = Dereference(g_gcDacGlobals->finalize_queue);
DPTR(uint8_t*) fillPointersTable = dac_cast<TADDR>(fq) + offsetof(dac_finalize_queue, m_FillPointers);
for (unsigned int i = 0; i<(*g_gcDacGlobals->max_gen + 2 + dac_finalize_queue::ExtraSegCount); i++)
if (g_gcDacGlobals->finalize_queue.IsValid())
{
detailsData->finalization_fill_pointers[i] = (CLRDATA_ADDRESS)*TableIndex(fillPointersTable, i, sizeof(uint8_t*));
DPTR(dac_finalize_queue) fq = Dereference(g_gcDacGlobals->finalize_queue);
DPTR(uint8_t*) fillPointersTable = dac_cast<TADDR>(fq) + offsetof(dac_finalize_queue, m_FillPointers);
for (unsigned int i = 0; i<(*g_gcDacGlobals->max_gen + 2 + dac_finalize_queue::ExtraSegCount); i++)
{
detailsData->finalization_fill_pointers[i] = (CLRDATA_ADDRESS)*TableIndex(fillPointersTable, i, sizeof(uint8_t*));
}
}

SOSDacLeave();
Expand Down Expand Up @@ -3760,6 +3763,12 @@ ClrDataAccess::EnumWksGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
{
SUPPORTS_DAC;

#ifdef FEATURE_SVR_GC
// If server GC, skip enumeration
if (g_gcDacGlobals->g_heaps != nullptr)
return;
#endif

Dereference(g_gcDacGlobals->ephemeral_heap_segment).EnumMem();
g_gcDacGlobals->alloc_allocated.EnumMem();
g_gcDacGlobals->gc_structures_invalid_cnt.EnumMem();
Expand All @@ -3781,7 +3790,6 @@ ClrDataAccess::EnumWksGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
while (seg)
{
DacEnumMemoryRegion(dac_cast<TADDR>(seg), sizeof(dac_heap_segment));

seg = seg->next;
}
}
Expand Down

0 comments on commit 948c7a7

Please sign in to comment.