Skip to content

[cDAC] Tolerate missing WKS card-table slot in reduced dumps - #132938

Open
steveisok wants to merge 1 commit into
dotnet:mainfrom
steveisok:steveisok-cdac-card-table-resilience
Open

[cDAC] Tolerate missing WKS card-table slot in reduced dumps#132938
steveisok wants to merge 1 commit into
dotnet:mainfrom
steveisok:steveisok-cdac-card-table-resilience

Conversation

@steveisok

Copy link
Copy Markdown
Member

Windows CDB /mw single-file dumps can omit the workstation GC card-table pointer slot while retaining the GC data needed for heap walking. Treat that slot as optional and report a null card table when unreadable, allowing IGC.GetHeapData and GetGCHeapStaticData to continue returning valid heap and generation data.

Also narrows debug cross-validation for this known mismatch and adds coverage for readable and missing card-table slots.

Tests: GCTests (36 passed)

Note

This pull request description was generated with GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9a58113d-e1d8-4ed2-9113-9f1de69cd49e
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@steveisok
steveisok requested a review from a team August 30, 2026 01:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

Review tier: Lite
Findings: None

What changed in this PR

This PR updates the cDAC GC workstation heap contract to treat the GCHeapCardTable global slot as optional when the slot’s target memory can’t be read, returning a null card table pointer while still providing valid heap and generation data.

Changes:

  • Make GCHeapWKS.CardTable resilient to an unreadable card-table slot by using TryReadPointer and falling back to TargetPointer.Null.
  • Relax DEBUG cross-validation in SOSDacImpl.GetGCHeapStaticData to tolerate a zero card table when the legacy DAC still reports a non-zero value.
  • Add unit test coverage for both readable and unreadable card-table slot scenarios, including validating GetGCHeapStaticData output.
File Description
src/​native/​managed/​cdac/​tests/​UnitTests/​GCTests.cs Adds tests for readable vs unreadable workstation card-table slot, and validates GetGCHeapStaticData returns a null card table without breaking generation data.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Legacy/​SOSDacImpl.cs Narrows DEBUG-only cross-validation to allow card_table == 0 for reduced-dump scenarios in GetGCHeapStaticData.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​GC/​GCHeapWKS.cs Switches card-table read to TryReadPointer with a TargetPointer.Null fallback to tolerate unreadable target memory.

@rcj1

rcj1 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

I don't think this is the root cause of the issue; rather, we are trying to read memory at gc_heap::card_table which we do not preserve in a dump. g_card_table, however, is preserved but cDAC is not reading from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants