[cDAC] Implement DacDbi heap walking#128463
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR extends the cDAC-based DacDbi implementation to support GC heap walking, adds GC contract helpers needed to mirror the native DAC walking logic (object-size alignment and allocation-context skipping), and refactors the native DAC heap walker to advance to the next valid segment/object on corruption while still signaling partial-heap results via E_FAIL.
Changes:
- Implement
CreateHeapWalk,WalkHeap, andDeleteHeapWalkin the managed (cDAC)DacDbiImpl, including a linear read cache and per-segment enumeration. - Add
IGC.GetPotentialNextObjectAddressandIGC.AlignObjectSize(and implement them inGC_1) to support heap-walk stepping/alignment parity with native. - Refactor native
DacHeapWalkerto advance to the next valid object/segment after corruption and fix allocation-context bookkeeping.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Adds managed heap-walk handle lifecycle + iterator-based walking with a small page cache and alloc-context handling. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/GC/GC_1.cs | Implements contract helpers for alloc-context skipping and SOH/LOH/POH alignment needed by the walker. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IGC.cs | Extends the IGC contract interface with two new helper methods used by heap walking. |
| src/coreclr/debug/daccess/dacimpl.h | Updates DacHeapWalker private method naming to match the new “advance to next valid object” behavior. |
| src/coreclr/debug/daccess/dacdbiimpl.cpp | Reworks heap-walk advancement logic to skip corrupt segments cleanly (while surfacing partial-heap) and fixes global alloc context counting. |
| docs/design/datacontracts/GC.md | Documents the new IGC APIs and the intended algorithms for stepping/alignment. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 8
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
max-charlamb
left a comment
There was a problem hiding this comment.
It'd be good to add at least a single dump test verifying that we can successfully get the Heap items.
Sure, we can at least verify a handful of items. A more thorough validation against the legacy with all the heap items is done in the internal tests. This test won’t really be useful for diagnosing partial failure, as we can’t know a priori everything on the heap, but if it completely fails then it would be a signal. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
/ba-g timeout |
|
@janvorli - fyi for contracts relating to GC |
Uh oh!
There was an error while loading. Please reload this page.