Repository navigation
Fix x86 Debugger_STRData layout and ESP adjustment in cDAC DBI - #130275
Merged
tommcdon merged 3 commits intoJul 10, 2026
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes cDAC DBI interop correctness by updating stack-walk-related structures and signatures to respect host pointer size and native anonymous-union layout, and by tightening x86 stack-walk state tracking to avoid reusing stale stack parameter sizes.
Changes:
- Updated
Debugger_STRData/Debugger_JITFuncDatato usenuintfor host-pointer-sized fields and modeled the native anonymous union via a nested explicit-layout union. - Updated
DacDbiImplto use the new union member (u.stubFrame) and adjustedParseContinuationto use a pointer-sized diagnostic IP (nuint*). - Reset
LastFramelessStackParameterSizewhen transitioning through native-frame states to avoid incorrect x86 ESP adjustments across consecutive native markers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Corrects interop struct layouts and pointer-sized fields; updates ParseContinuation signature to match native PCODE*. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Adapts implementation to new Debugger_STRData union shape and pointer-sized diagnostic IP handling. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/StackWalk_1.cs | Prevents stale x86 stack-parameter-size reuse across native-marker transitions during stack walks. |
max-charlamb
reviewed
Jul 7, 2026
rcj1
reviewed
Jul 7, 2026
rcj1
reviewed
Jul 8, 2026
rcj1
reviewed
Jul 8, 2026
…n overrun, and GetStackWalkCurrentContext ESP On x86 the cDAC DBI path had three defects that broke ICorDebug attach and async stackwalks when DOTNET_ENABLE_CDAC=1: - Debugger_STRData.fp was a host-sized FramePointer (4 bytes on x86) while the managed cDAC treats it as a fixed-width value. Normalize fp to CORDB_ADDRESS so the native mscordbi consumer and the managed cDAC agree on struct layout; the RS converts to/from FramePointer at the boundary. ctx stays a host-sized pointer. Fixes the internal-frames (GetActiveInternalFrames) attach hang. - ParseContinuation declared pDiagnosticIP as PCODE* (4 bytes on x86) while the managed cDAC writes 8 bytes, overrunning the caller's stack. Change the native signature to CORDB_ADDRESS* to match. - GetStackWalkCurrentContext applied an x86 callee-popped-args adjustment that the native implementation does not: native builds the returned context from REGDISPLAY->pCurrentContext, and the M2U adjustment writes only REGDISPLAY->SP, not pCurrentContext->Esp. Return the raw context and remove the now-dead X86ESPIgnoresCalleePoppedArgs mechanism. Co-authored-by: Copilot <[email protected]>
tommcdon
force-pushed
the
dev/tommcdon/cdac-dbi-x86-stackwalk
branch
from
July 9, 2026 14:51
879eb71 to
7b2d291
Compare
…inuation outputs - Remove the StackwalkFlag.X86ESPIgnoresCalleePoppedArgs description from the StackWalk data contract doc to match its removal from the implementation. - Initialize ParseContinuation out parameters (pDiagnosticIP, pNextContinuation, pState) on the numFound < 3 / E_FAIL failure path so callers never observe uninitialized values. Co-authored-by: Copilot <[email protected]>
Remove the lone inline // FramePointer (CORDB_ADDRESS) comment on Debugger_JITFuncData.fpParentOrSelf; it was the only annotated field among otherwise-bare members and stood out. Co-authored-by: Copilot <[email protected]>
Open
3 tasks
max-charlamb
approved these changes
Jul 10, 2026
Member
Author
|
/ba-g failures are unrelated |
tommcdon
enabled auto-merge (squash)
July 10, 2026 18:17
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
Standardizes DBI stack-frame/continuation structures on fixed-width `CORDB_ADDRESS` making the 32-bit DBI compatible with the CDAC - `Debugger_STRData.fp`/`ctx`, `fpParentOrSelf`, and `GetFramePointer` → `CORDB_ADDRESS`/`ulong` - `ParseContinuation` `pDiagnosticIP` → `CORDB_ADDRESS*` - Removed now dead `X86ESPIgnoresCalleePoppedArgs` mechanism - Zero `ctx` for `cStubFrame` entries --------- Co-authored-by: Copilot <[email protected]>
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.
Standardizes DBI stack-frame/continuation structures on fixed-width
CORDB_ADDRESSmaking the 32-bit DBI compatible with the CDACDebugger_STRData.fp/ctx,fpParentOrSelf, andGetFramePointer→CORDB_ADDRESS/ulongParseContinuationpDiagnosticIP→CORDB_ADDRESS*X86ESPIgnoresCalleePoppedArgsmechanismctxforcStubFrameentries