Skip to content

Fix incorrect codemanager implementation on x86 #115391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2025

Conversation

tommcdon
Copy link
Member

@tommcdon tommcdon commented May 8, 2025

This addresses windows x86 debugger setip issues introduced by #114170

@tommcdon tommcdon added this to the 10.0.0 milestone May 8, 2025
@tommcdon tommcdon self-assigned this May 8, 2025
@Copilot Copilot AI review requested due to automatic review settings May 8, 2025 04:33
@tommcdon tommcdon requested review from davidwrighton and noahfalk May 8, 2025 04:33
Copy link
Contributor

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

Copy link
Contributor

@Copilot Copilot AI left a comment

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 fixes debugger setup issues on Windows x86 by addressing the incorrect implementation of the code manager.

  • Introduces a new DecodeGCHdrInfo method in jitinterface.cpp that uses a relative offset to compute the correct GC header info pointer.
  • Updates all affected call sites in eetwain.cpp to pass the proper structure (using a value instance and its address) and a dwRelOffset parameter.
  • Updates the codeman.h header with the new function prototype to support x86 changes.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/coreclr/vm/jitinterface.cpp Added the new DecodeGCHdrInfo method for proper GC header info decoding
src/coreclr/vm/eetwain.cpp Modified calls to DecodeGCHdrInfo and adjusted usage of the hdrInfo structure
src/coreclr/vm/codeman.h Added the function prototype for DecodeGCHdrInfo
Comments suppressed due to low confidence (1)

src/coreclr/vm/eetwain.cpp:90

  • Verify that the updated API for GetHandlerFrameInfo (which now accepts a pointer to hdrInfo) is consistently implemented across all call sites.
GetHandlerFrameInfo(&hdrInfoBody, ctx->Ebp,

@tommcdon tommcdon requested review from thaystg and hoyosjs May 8, 2025 04:35
@jkotas jkotas requested a review from filipnavara May 8, 2025 05:37
Copy link
Member

@filipnavara filipnavara left a comment

Choose a reason for hiding this comment

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

Thanks! There's one code path that could possibly benefit from the cache optimization (GetAmbientSPFromCrawlFrame -> GetAmbientSP seems to use the same relOffset as the cache in EECodeInfo) but it's not worth the extra trouble, it is only used by debugger.

I'm sorry for breaking this but I assume there're no public tests that would alert me about this, right?

@tommcdon tommcdon force-pushed the dev/tommcdon/fix_x86_codemanager branch from 15b0feb to 297b0e3 Compare May 8, 2025 16:34
@tommcdon
Copy link
Member Author

tommcdon commented May 8, 2025

Thanks! There's one code path that could possibly benefit from the cache optimization (GetAmbientSPFromCrawlFrame -> GetAmbientSP seems to use the same relOffset as the cache in EECodeInfo) but it's not worth the extra trouble, it is only used by debugger.

I've pushed a commit to take advantage of the perf improvement when the relative offset matches the code manager's built-in offset.

I'm sorry for breaking this but I assume there're no public tests that would alert me about this, right?

No worries. You are correct - we have some internal Visual Studio testing that caught the issue.

@tommcdon tommcdon merged commit db0da94 into dotnet:main May 8, 2025
95 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants