Skip to content

[cDAC] fix some stack walking bugs.#129916

Open
rcj1 wants to merge 7 commits into
dotnet:mainfrom
rcj1:fix-stackwalk
Open

[cDAC] fix some stack walking bugs.#129916
rcj1 wants to merge 7 commits into
dotnet:mainfrom
rcj1:fix-stackwalk

Conversation

@rcj1

@rcj1 rcj1 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
  • Fix a bug in getting the return address from FuncEvalFrames.
  • Fix a bug in state transition from Frame.

Found with internal diagnostics tests.

Copilot AI review requested due to automatic review settings June 26, 2026 23:25
@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.

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.

Pull request overview

This PR updates the cDAC StackWalk contract implementation to more accurately mirror CoreCLR’s frame semantics, specifically around FuncEvalFrame return address reporting and frame-to-native state transitions.

Changes:

  • Add ReturnAddress to the FuncEvalFrame cDAC data contract and VM data descriptor so it can be read directly from FuncEvalFrame::m_ReturnAddress.
  • Update StackWalk frame return-address retrieval for FuncEvalFrame to use the new FuncEvalFrame.ReturnAddress field (and keep returning null for non-hijack eval paths).
  • Adjust StackWalk_1.UpdateState so that when already in StackWalkState.Frame and the current context is unmanaged, the walker stays in Frame state (or completes) instead of transitioning to NativeMarker.
Show a summary per file
File Description
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Frames/FuncEvalFrame.cs Adds ReturnAddress field to the managed cDAC data model for FuncEvalFrame.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/StackWalk_1.cs Fixes state transition logic to avoid incorrect FrameNativeMarker transitions.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/FrameHelpers.cs Uses FuncEvalFrame.ReturnAddress when computing return address (matching VM layout).
src/coreclr/vm/frames.h Exposes FuncEvalFrame::m_ReturnAddress offset via cdac_data<FuncEvalFrame>.
src/coreclr/vm/datadescriptor/datadescriptor.inc Adds the FuncEvalFrame.ReturnAddress data descriptor field.
docs/design/datacontracts/StackWalk.md Documents the new FuncEvalFrame.ReturnAddress descriptor dependency.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 2

Copilot AI review requested due to automatic review settings June 26, 2026 23:30

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's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 4

Comment thread src/coreclr/vm/datadescriptor/datadescriptor.inc
Copilot AI review requested due to automatic review settings June 27, 2026 03:13

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's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 3

Comment thread src/coreclr/vm/datadescriptor/datadescriptor.inc
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 27, 2026 03:25

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's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread src/coreclr/vm/datadescriptor/datadescriptor.inc
Copilot AI review requested due to automatic review settings June 27, 2026 03:31
Comment thread src/coreclr/vm/datadescriptor/datadescriptor.inc

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's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 1

Comment thread src/coreclr/vm/datadescriptor/datadescriptor.inc
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