[cDAC] Implement MarkDebuggerAttach* DacDbi APIs#126794
[cDAC] Implement MarkDebuggerAttach* DacDbi APIs#126794
Conversation
…DacDbi Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/3f4fdba8-737a-48ee-b4de-df5fc4139ae0 Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/3f4fdba8-737a-48ee-b4de-df5fc4139ae0
There was a problem hiding this comment.
Pull request overview
This PR extends the cDAC Debugger contract and the legacy DacDbiImpl surface to support MarkDebuggerAttachPending / MarkDebuggerAttached by writing the appropriate bits into g_CORDebuggerControlFlags, and adds unit test coverage plus documentation updates.
Changes:
- Added
IDebugger.MarkDebuggerAttachPending()andIDebugger.MarkDebuggerAttached(bool)APIs and implemented them inDebugger_1via target-memory writes. - Updated
DacDbiImplto call the cDAC contract implementations (with DEBUG-only legacy cross-validation). - Exposed
g_CORDebuggerControlFlagsvia the CoreCLR data descriptor and added tests/docs for the new flag semantics.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DebuggerTests.cs | Adds test target plumbing + new unit tests validating control-flag writes. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements the two DBI methods by calling the cDAC Debugger contract and translating errors to HRESULTs. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Debugger_1.cs | Adds the flag enum and implements the two new attach APIs by updating CORDebuggerControlFlags. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Constants.cs | Introduces the new Globals.CORDebuggerControlFlags name constant. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IDebugger.cs | Extends the contract interface with the two new methods. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Exposes g_CORDebuggerControlFlags and adjusts Debugger global gating. |
| src/coreclr/inc/cordbpriv.h | Adds cDAC dependency annotations to DBCF_PENDING_ATTACH / DBCF_ATTACHED. |
| docs/design/datacontracts/Debugger.md | Documents the new APIs, global dependency, and flag behavior. |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs
Show resolved
Hide resolved
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs
Show resolved
Hide resolved
...tive/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Debugger_1.cs
Show resolved
Hide resolved
...ve/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IDebugger.cs
Show resolved
Hide resolved
...tive/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Debugger_1.cs
Show resolved
Hide resolved
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs
Show resolved
Hide resolved
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
🤖 Copilot Code Review — PR #126794Note This review was AI-generated by GitHub Copilot using multi-model analysis (Claude Opus 4.6 primary, Claude Sonnet 4 secondary). Holistic AssessmentMotivation: The PR adds Approach: The implementation faithfully mirrors the native C++ Summary: Detailed Findings❌ Unit Tests Will Fail —
|
|
Test helpers tbd in #126595 |
| DBCF_ATTACHED = 0x0200, | ||
| DBCF_PENDING_ATTACH = 0x0100, // [cDAC] [Debugger] : Contract depends on this value. | ||
| DBCF_ATTACHED = 0x0200, // [cDAC] [Debugger] : Contract depends on this value. | ||
| DBCF_FIBERMODE = 0x0400 |
There was a problem hiding this comment.
DBCF_FIBERMODE and m_bHostingInFiber can be deleted - dead code
Implements
MarkDebuggerAttachPendingandMarkDebuggerAttachedin cDACDacDbiImplby adding correspondingDebugger_1contract APIs and wiring them to target-memory writes of debugger control flags.The change ensures these methods update
g_CORDebuggerControlFlags(usingDBCF_PENDING_ATTACH/DBCF_ATTACHED).Contract/API surface
IDebugger.MarkDebuggerAttachPending()IDebugger.MarkDebuggerAttached(bool fAttached)Contracts/Debugger_1.cswith a private flag enum mirroring native valuesDBI implementation
DacDbiImpl.cswith cDAC-backed implementationsGlobal exposure + native dependency annotation
g_CORDebuggerControlFlagsvia VM data descriptor (CORDebuggerControlFlags)Constants.GlobalsDebuggerControlFlagvalues incordbpriv.hwith[cDAC] [Debugger]dependency commentsDocumentation + tests
docs/design/datacontracts/Debugger.mdwith new APIs, enum dependency, and correct global usageDebuggerTeststo validate flag write semantics againstCORDebuggerControlFlags