[cDAC] Implement SetCompilerFlags for cDAC#127244
Conversation
Replace the legacy-delegation stub with a contract-based implementation that: - Gets the ILoader contract and resolves the assembly pointer to a ModuleHandle - Reads current debugger info bits, clears DACF_ALLOW_JIT_OPTS and DACF_ENC_ENABLED, masks with DACF_CONTROL_FLAGS_MASK - Conditionally ORs in the requested flags - Delegates to SetDebuggerInfoBits which handles EncCapable check, JIT optimization disabled state, and EditAndContinue flag logic - Returns CORDBG_S_NOT_ALL_BITS_SET if EnC was requested but could not be enabled - Includes #if DEBUG legacy validation block Add CORDBG_S_NOT_ALL_BITS_SET constant to CorDbgHResults. Add unit tests covering: both flags set (EnC capable), both flags unset, EnC requested but not capable, and JIT opts toggling. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/0d4cb517-9044-4d94-902e-a91169e2d2f5 Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/0d4cb517-9044-4d94-902e-a91169e2d2f5 Co-authored-by: barosiak <76071368+barosiak@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Implements SetCompilerFlags in the cDAC DacDbiImpl using the ILoader contract to update debugger assembly control flags and adds coverage/tests and a missing success HRESULT constant to match native DAC semantics.
Changes:
- Implement
DacDbiImpl.SetCompilerFlagsviaILoaderand returnCORDBG_S_NOT_ALL_BITS_SETwhen EnC cannot be enabled. - Add
CORDBG_S_NOT_ALL_BITS_SETtoCorDbgHResults. - Add
SetCompilerFlagsTestscovering flag set/unset and EnC capability behavior across architectures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Adds SetCompilerFlags implementation using ILoader and post-write EnC enablement check |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/CorDbHResults.cs | Adds missing CORDBG_S_NOT_ALL_BITS_SET HRESULT constant |
| src/native/managed/cdac/tests/LoaderTests.cs | Adds new test coverage for SetCompilerFlags behavior |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/ba-g unrelated failures and style fix, no need to re-run |
🤖 Copilot Code Review — PR #127244Note This review was generated by Copilot and reflects an automated analysis. Multi-model review used: Claude Opus 4.6 (primary) + Claude Sonnet 4.5 (secondary). A GPT-5.3-Codex agent was also launched but did not complete within the timeout window. Holistic AssessmentMotivation: This PR replaces several legacy DAC delegation stubs in Approach: The approach is sound. Each method follows the cDAC pattern: try-catch for HResult conversion, use of contracts (ILoader, IRuntimeTypeSystem), and Summary: ✅ LGTM. The implementations correctly match their native C++ counterparts. I verified Detailed Findings✅ SetCompilerFlags — Correct match to native logicVerified against
One sub-agent flagged the exception handler overwriting ✅ GetCompilerFlags — Semantics match nativeThe native reads ✅ IsDiagnosticsHiddenOrLCGMethod — Logic correctly handles orderingThe native ✅ IsModuleMapped — Matches native S_FALSE/S_OK semanticsThe native ( ✅ TryGetPEImage refactoring — Clean deduplicationThe extracted ✅ EnumerateThreads signature improvementChanging 💡 CORProfilerPresent — String literals for field names
💡 Test coverage — Minor gaps for non-SetCompilerFlags methodsThe new
|
|
/ba-g unrelated failures and style fix, no need to re-run |
Summary
Implement SetCompilerFlags in cDAC DacDbiImpl using ILoader contract to set debugger assembly control flags.
Changes