[cDAC] Implement GetManagedStoppedContext for cDAC#128865
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
Ports the DAC GetManagedStoppedContext implementation to the cDAC managed DBI layer, exposes the InteropDebuggingHijacked field on the Thread descriptor, and adds mock infrastructure plus tests covering each branch (hijacked, filter-context, redirected-thread, no-context).
Changes:
- Implement
GetManagedStoppedContextinDacDbiImplmirroring native logic (hijacked → null; else filter context; elseRedirectedThreadFrame::TargetContextPtr), with#if DEBUGlegacy parity validation. - Add
InteropDebuggingHijackedto the Thread data descriptor on both native (threads.h,datadescriptor.inc) and managed (Data/Thread.cs,MockDescriptors.Thread.cs) sides, plus docs. - Add
MockResumableFrameandAddRedirectedThreadFramehelpers; new[Theory]tests covering all four code paths.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/coreclr/vm/threads.h |
Expose m_fInteropDebuggingHijacked offset via cdac_data<Thread>. |
src/coreclr/vm/datadescriptor/datadescriptor.inc |
Register Thread.InteropDebuggingHijacked (T_UINT32). |
src/native/managed/cdac/.../Data/Thread.cs |
Add InteropDebuggingHijacked [Field]. |
src/native/managed/cdac/.../Dbi/DacDbiImpl.cs |
Port GetManagedStoppedContext from native DAC with debug-time legacy validation. |
src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.Thread.cs |
Add layout/property for InteropDebuggingHijacked; expose DebuggerFilterContext. |
src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.Frame.cs |
Add MockResumableFrame, RedirectedThreadFrameIdentifierValue, AddRedirectedThreadFrame. |
src/native/managed/cdac/tests/DacDbiImplTests.cs |
Add four [Theory] tests covering the implementation's branches. |
docs/design/datacontracts/Thread.md |
Document new InteropDebuggingHijacked field. |
There was a problem hiding this comment.
We should not be doing all these field reads outside of the contract APIs. The idea is that the contract encapsulate the important concepts about runtime structures, and that the consumers - the DacDbi and SOS APIs, for example - can put them together without looking at the offsets and other implementation details of the runtime. For example you could have a Thread API GetRedirectedContext to get the redirected context (or NULL if it doesn't exist), and an API IsInteropDebuggingHijacked
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
noahfalk
left a comment
There was a problem hiding this comment.
This looks good to me, either with the current API shape or if we merge more of it into ThreadData.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
Implement GetManagedStoppedContext in the cDAC DBI layer, porting the logic from the native DAC. Add the InteropDebuggingHijacked field to the Thread data descriptor.
Changes