From: David Mason Date: Sat, 11 Jul 2020 19:03:57 +0000 (-0700) Subject: Update DacHeapWalker to know about POH in SVR mode (#39139) X-Git-Tag: submit/tizen/20210909.063632~6770 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ea1b9057f3d67201f962fa0a85618b0bbc92f15;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Update DacHeapWalker to know about POH in SVR mode (#39139) * add POH for svr * Use the correct alignment for objects on the POH --- diff --git a/src/coreclr/src/debug/daccess/dacdbiimpl.cpp b/src/coreclr/src/debug/daccess/dacdbiimpl.cpp index 3bcef88..2f34a59 100644 --- a/src/coreclr/src/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/src/debug/daccess/dacdbiimpl.cpp @@ -6380,7 +6380,8 @@ bool DacHeapWalker::GetSize(TADDR tMT, size_t &size) // The size is not guaranteed to be aligned, we have to // do that ourself. - if (mHeaps[mCurrHeap].Segments[mCurrSeg].Generation == 3) + if (mHeaps[mCurrHeap].Segments[mCurrSeg].Generation == 3 + || mHeaps[mCurrHeap].Segments[mCurrSeg].Generation == 4) size = AlignLarge(size); else size = Align(size); diff --git a/src/coreclr/src/debug/daccess/request_svr.cpp b/src/coreclr/src/debug/daccess/request_svr.cpp index e4c2d95..558ac0c 100644 --- a/src/coreclr/src/debug/daccess/request_svr.cpp +++ b/src/coreclr/src/debug/daccess/request_svr.cpp @@ -274,7 +274,8 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount) dac_generation gen0 = *ServerGenerationTableIndex(heap, 0); dac_generation gen1 = *ServerGenerationTableIndex(heap, 1); dac_generation gen2 = *ServerGenerationTableIndex(heap, 2); - dac_generation loh = *ServerGenerationTableIndex(heap, 3); + dac_generation loh = *ServerGenerationTableIndex(heap, 3); + dac_generation poh = *ServerGenerationTableIndex(heap, 4); pHeaps[i].YoungestGenPtr = (CORDB_ADDRESS)gen0.allocation_context.alloc_ptr; pHeaps[i].YoungestGenLimit = (CORDB_ADDRESS)gen0.allocation_context.alloc_limit; @@ -285,6 +286,7 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount) // Segments int count = GetSegmentCount(loh.start_segment); + count += GetSegmentCount(poh.start_segment); count += GetSegmentCount(gen2.start_segment); pHeaps[i].SegmentCount = count; @@ -313,7 +315,6 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount) seg = seg->next; } - // Large object heap segments seg = loh.start_segment; for (; seg && (j < count); ++j) @@ -324,6 +325,17 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount) seg = seg->next; } + + // Pinned object heap segments + seg = poh.start_segment; + for (; seg && (j < count); ++j) + { + pHeaps[i].Segments[j].Generation = 4; + pHeaps[i].Segments[j].Start = (CORDB_ADDRESS)seg->mem; + pHeaps[i].Segments[j].End = (CORDB_ADDRESS)seg->allocated; + + seg = seg->next; + } } return S_OK;