Repository navigation
[cDAC] Encapsulate loader heap block traversal - #130729
Merged
max-charlamb merged 1 commit intoJul 16, 2026
Merged
max-charlamb merged 1 commit into
max-charlamb merged 1 commit into
Conversation
Co-authored-by: Copilot <[email protected]> Copilot-Session: f2aa5dc4-0c99-43f0-af14-734143849c4a
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
Encapsulates loader heap block traversal inside the cDAC Loader contract by replacing the raw “linked-list pointer chasing” APIs with a single block enumeration API that exposes only block address + size. This reduces the amount of target-memory traversal logic (and related invariants like cycle detection) that each consumer needs to reimplement.
Changes:
- Replaces
GetFirstLoaderHeapBlock/GetLoaderHeapBlockData(LoaderHeapBlockData) withEnumerateLoaderHeapBlocksreturningLoaderHeapBlock(Address, Size). - Updates the
Loader_1contract implementation to perform traversal + cycle detection internally. - Updates legacy SOS traversal and unit tests, and refreshes Loader contract documentation accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ILoader.cs | Replaces the loader-heap block API surface with EnumerateLoaderHeapBlocks + LoaderHeapBlock. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Loader_1.cs | Implements EnumerateLoaderHeapBlocks with internal traversal and cycle detection. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs | Switches TraverseLoaderHeapCore to consume EnumerateLoaderHeapBlocks while preserving HRESULT mapping/limits. |
| src/native/managed/cdac/tests/UnitTests/LoaderTests.cs | Updates VirtCallStubHeap traversal unit tests to mock the new enumeration API. |
| src/native/managed/cdac/tests/UnitTests/LoaderHeapTests.cs | Updates loader heap traversal tests and adds a cyclic-heap coverage case for the new enumerator. |
| docs/design/datacontracts/Loader.md | Updates the contract spec/signature and algorithm snippet to match the new enumeration API. |
max-charlamb
marked this pull request as ready for review
July 15, 2026 00:59
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
max-charlamb
enabled auto-merge (squash)
July 15, 2026 01:14
rcj1
approved these changes
Jul 15, 2026
Member
Author
|
/ba-g tests pass, build analysis stuck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EnumerateLoaderHeapBlocksreturning only address and size.S_FALSEbehavior, and invalid-memory error mapping.This gives consumers the loader-heap data they need without exposing traversal pointers or requiring them to chase target-memory links.
Validation
dotnet build src\native\managed\cdac\cdac.slnx -c Debug -p:UseSharedCompilation=false /nr:falsedotnet test src\native\managed\cdac\tests\UnitTests\Microsoft.Diagnostics.DataContractReader.Tests.csproj -c Debug --no-build(2701 passed, 16 skipped)LoaderHeapTestsandLoaderTestsrun (224 passed)Note
This PR was generated with the assistance of GitHub Copilot.