[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. |
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
This comment has been minimized.
This comment has been minimized.
|
Test helpers tbd in #126595 |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
🤖 Copilot Code Review — PR #126794Note This review was generated by Copilot (Claude Opus 4.6) with additional analysis from Claude Sonnet 4.5. Holistic AssessmentMotivation: This PR implements debugger attach flag methods ( Approach: The change systematically threads Summary: Detailed Findings
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/coreclr/debug/di/process.cpp:8386
CordbProcess::UnrecoverableErrorno longer setsm_unrecoverableErrorfor legal fatal errors (e.g.,CORDBG_E_INCOMPATIBLE_PROTOCOL), because the condition changed from effectively "all except CORDBG_E_CANNOT_DEBUG_FIBER_PROCESS" to only!IsLegalFatalError(errorHR). This is a behavior change beyond removing fiber-mode handling and may leave the process in a non-zombie state after an unrecoverable condition. Consider restoring the previous intent (e.g., setm_unrecoverableErrorfor legal fatal errors too, or otherwise document/handle why legal fatal errors should avoid zombie state).
CONSISTENCY_CHECK_MSGF(IsLegalFatalError(errorHR), ("Unrecoverable internal error: hr=0x%08x!", errorHR));
if (!IsLegalFatalError(errorHR))
{
// This will throw everything into a Zombie state. The ATT_ macros will check this and fail immediately.
m_unrecoverableError = true;
//
// Mark the process as no longer synchronized.
//
Lock();
SetSynchronized(false);
IncStopCount();
Unlock();
}
|
/ba-g wasm |
MarkDebuggerAttachPendingandMarkDebuggerAttachedin cDACDacDbiImplby adding correspondingDebugger_1contract APIs and wiring them to target-memory writes of debugger control flags.