Skip to content

Restore E_NOTIMPL fallback in DacDbiInterfaceImpl::GetContext#128499

Open
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/fix-getcontext-enotimpl-fallback
Open

Restore E_NOTIMPL fallback in DacDbiInterfaceImpl::GetContext#128499
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/fix-getcontext-enotimpl-fallback

Conversation

@tommcdon
Copy link
Copy Markdown
Member

On platforms where ICorDebugDataTarget::GetThreadContext returns E_NOTIMPL, restore the fallback that walks the thread's Frame chain to reconstruct a register context from REGDISPLAY. This is needed for managed debugging stack walks on non-Windows platforms.

The fallback was removed in 5391e9e.

Found using internal Visual Studio testing

On platforms where ICorDebugDataTarget::GetThreadContext returns
E_NOTIMPL, restore the fallback that walks the thread's Frame chain
to reconstruct a register context from REGDISPLAY. This is needed
for managed debugging stack walks on non-Windows platforms.

The fallback was inadvertently removed in 5391e9e.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tommcdon tommcdon added this to the 11.0.0 milestone May 22, 2026
@tommcdon tommcdon requested a review from rcj1 May 22, 2026 18:37
@tommcdon tommcdon self-assigned this May 22, 2026
Copilot AI review requested due to automatic review settings May 22, 2026 18:37
@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.

@tommcdon
Copy link
Copy Markdown
Member Author

cc @janvorli

Copy link
Copy Markdown
Contributor

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 updates CoreCLR’s DAC/DBI implementation of DacDbiInterfaceImpl::GetContext to handle data targets that return E_NOTIMPL from ICorDebugDataTarget::GetThreadContext by falling back to reconstructing a usable register context from the thread’s frame chain.

Changes:

  • Stop throwing on GetThreadContext returning E_NOTIMPL; instead, walk Thread’s Frame chain and use UpdateRegDisplay + UpdateContextFromRegDisp to synthesize a context suitable for managed stack walking.
  • Add a FEATURE_INTERPRETER fast-path to synthesize context from InterpreterFrame via SetContextToInterpMethodContextFrame.
  • Zero the output context when no suitable managed frame context can be reconstructed.

Comment thread src/coreclr/debug/daccess/dacdbiimpl.cpp
Comment thread src/coreclr/debug/daccess/dacdbiimpl.cpp
Copy link
Copy Markdown
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

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.

3 participants