Skip to content

Fix target pointer size handling in DBI - #132756

Open
barosiak wants to merge 6 commits into
dotnet:mainfrom
barosiak:barosiak/fix-dbi-target-pointer-size
Open

barosiak wants to merge 6 commits into
dotnet:mainfrom
barosiak:barosiak/fix-dbi-target-pointer-size

Conversation

@barosiak

@barosiak barosiak commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix DBI target-size assumptions in value handling, registers, and stack reads. This does not provide complete cross-bitness support, host-sized frame identities remain a limitation for 32-bit debuggers inspecting 64-bit targets.
Follow-up to #130935

Changes

  • Use target-sized references/native integers and fixed-width register transport; propagate sizing failures before value construction.
  • Reject overflowing native-sized SOS outputs and retain cross-architecture contexts in the dump enumerator.
  • Add native regressions and actual x86 managed test execution in diagnostics CI.

@barosiak
barosiak requested a review from rcj1 August 25, 2026 18:19
@barosiak barosiak self-assigned this Aug 25, 2026
@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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@barosiak barosiak reopened this Oct 21, 2026
@rcj1

rcj1 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Please rebase on main, I merged

@barosiak
barosiak force-pushed the barosiak/fix-dbi-target-pointer-size branch from ae910f7 to 7dcce44 Compare November 10, 2026 00:33
@barosiak
barosiak marked this pull request as ready for review November 11, 2026 20:51
@barosiak
barosiak requested a balanced review from Copilot November 11, 2026 20:51
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 6 pipeline(s).
9 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 dotnet deleted a comment from rcj1 Nov 11, 2026
@steveisok
steveisok requested a review from a team November 11, 2026 20:53

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.

🔵 Needs a closer look

The changes span native DBI value lifetimes, register write-back, and cross-bitness decoding, but Windows x86/x64 execution and real-dump validation were unavailable, leaving end-to-end debugger correctness unverified.

No open issues 🎉

What changed in this PR

Updates CoreCLR’s debugger interface (DBI) and cDAC to distinguish target pointer width from host width, following #130935. This improves cross-bitness handling without removing the remaining host-sized frame-identity limitation.

Changes:

  • Uses target-sized values and stack reads, fixed-width register transport, and preconstruction size-error propagation.
  • Rejects overflowing caller-native SOS outputs and retains cross-architecture dump contexts by default.
  • Adds native and managed regression coverage, including x86 test execution in diagnostics CI.
File Description
src/​native/​managed/​cdac/​tests/​UnitTests/​ObjectiveCMarshalTests.cs Adds tagged-memory size overflow tests.
src/​native/​managed/​cdac/​tests/​UnitTests/​LoaderTests.cs Adds loader-heap size overflow tests.
src/​native/​managed/​cdac/​tests/​UnitTests/​GCTests.cs Tests GC output overflow and all-or-nothing publication.
src/​native/​managed/​cdac/​tests/​UnitTests/​DacDbiImplTests.cs Tests register transport across target architectures.
src/​native/​managed/​cdac/​README.md Documents cross-bitness boundaries and x86 testing.
src/​native/​managed/​cdac/​mscordaccore_enummemory/​mscordaccore_enummemory.csproj Retains all target contexts by default.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Legacy/​SOSDacImpl.cs Checks native-sized conversions before publishing outputs.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Legacy/​Dbi/​IDacDbiInterface.cs Uses fixed-width register write inputs.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Legacy/​Dbi/​DacDbiImpl.cs Updates register inputs and catches context-selection failures.
src/​coreclr/​dlls/​mscordbi/​CMakeLists.txt Adds the opt-in Windows native test target.
src/​coreclr/​debug/​inc/​dacdbiinterface.h Defines fixed-width register write transport.
src/​coreclr/​debug/​di/​valuehome.cpp Uses target widths for register, memory, and reference homes.
src/​coreclr/​debug/​di/​tests/​value_tests.cpp Adds native value, register, and failure-path regressions.
src/​coreclr/​debug/​di/​tests/​README.md Documents native test setup and execution.
src/​coreclr/​debug/​di/​tests/​genmockdac.py Generates mock DAC methods and return-type metadata.
src/​coreclr/​debug/​di/​tests/​CMakeLists.txt Builds and registers native regression cases.
src/​coreclr/​debug/​di/​rstype.cpp Makes sizing and return eligibility target-dependent.
src/​coreclr/​debug/​di/​rsthread.cpp Updates frame reads, register values, and value construction.
src/​coreclr/​debug/​di/​rsstackwalk.cpp Preserves the full ambient stack address.
src/​coreclr/​debug/​di/​rspriv.h Aligns declarations with explicit sizes and fixed-width values.
src/​coreclr/​debug/​di/​divalue.cpp Uses target-sized references and resolves sizes before construction.
src/​coreclr/​debug/​daccess/​dacdbiimpl.h Updates the native register-write declaration.
src/​coreclr/​debug/​daccess/​dacdbiimpl.cpp Updates the native register-write implementation signature.
eng/​pipelines/​runtime-diagnostics.yml Adds x86 managed execution and native DBI test steps.

Review effort: Balanced

@barosiak
barosiak requested review from jkotas and a balanced review from Copilot November 12, 2026 20:43

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.

🟡 Changes recommended

An x86 debugger inspecting a 64-bit target admits floating-point register-pair structs without the required decoder, allowing assignments to report success while silently skipping floating-point register writes.

1 open issue

Review effort: Balanced

Comment thread src/coreclr/debug/di/rstype.cpp Resolved

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.

I think testing of the DBI belongs in the internal diagnostics repo. Whatever method works for you testing locally is fine, but I don't think we should check this in.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Makes sense, will move them.

Comment thread src/coreclr/debug/di/divalue.cpp Resolved
Comment thread src/coreclr/debug/di/divalue.cpp Resolved

This branch has not been deployed

No deployments
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.

4 participants