dbgshim: route live debugging through cDAC-capable DBI first#5940
Open
hoyosjs wants to merge 4 commits into
Open
dbgshim: route live debugging through cDAC-capable DBI first#5940hoyosjs wants to merge 4 commits into
hoyosjs wants to merge 4 commits into
Conversation
- Add a SetCDacLoadPolicy export and process-wide setting lets the live-debugging connection APIs select the cDAC/legacy DAC policy. - Call into the bundled DBI to check whether using cDAC with it suceeded. Each path invokes the DBI with the cDAC first and falls back to the legacy provider/side-by-side path. - Use simple unified helper to ensure cdac errors prevail over non-cdac ones in fallback scenario. - Add SetCDacLoadPolicy test wrapper plus live policy tests for the version3 and RegisterForRuntimeStartup3 paths asserting the cDAC/legacy gating and provider fallback paths.
Contributor
There was a problem hiding this comment.
Pull request overview
Routes dbgshim’s live debugging activation paths through a cDAC-capable DBI first, controlled by a new process-wide cDAC load policy export, with unit tests validating policy gating and fallback behavior.
Changes:
- Add
SetCDacLoadPolicydbgshim export + policy enum, and plumb policy into live-debugging creation APIs. - Attempt activation via bundled DBI+cDAC first, then fall back to library-provider/side-by-side legacy activation with unified HRESULT selection.
- Add managed test wrapper + new unit tests covering policy behavior for
CreateDebuggingInterfaceFromVersion3andRegisterForRuntimeStartup3.
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/tests/DbgShim.UnitTests/DbgShimTests.cs | Adds live policy test matrix and end-to-end tests for Version3 + RuntimeStartup3 policy gating and fallback behavior. |
| src/tests/DbgShim.UnitTests/DbgShimAPI.cs | Adds managed delegate binding and wrapper for SetCDacLoadPolicy export. |
| src/dbgshim/debugshim.h | Moves CDacLoadPolicy to shared header and exposes helpers for bundled cDAC+DBI resolution and activation-result selection. |
| src/dbgshim/debugshim.cpp | Implements bundled cDAC+DBI path resolution helper and shares activation-result selection logic. |
| src/dbgshim/dbgshim.h | Adds include guards, defines CDacLoadPolicy, and declares SetCDacLoadPolicy export. |
| src/dbgshim/dbgshim.cpp | Implements process-wide policy and routes live-debugging creation paths through cDAC-first activation with fallback logic. |
| src/dbgshim/dbgshim.ntdef | Exports SetCDacLoadPolicy on Windows. |
| src/dbgshim/dbgshim_unixexports.src | Exports SetCDacLoadPolicy on Unix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+232
to
+235
| // Policy for the live-debugging paths (RegisterForRuntimeStartup* and | ||
| // CreateDebuggingInterfaceFromVersion*), which don't flow through ICLRDebuggingPolicy. Set via the | ||
| // SetCDacLoadPolicy export. | ||
| static CDacLoadPolicy g_cdacLoadPolicy = CDacLoadPolicy_PreferCDac; |
Comment on lines
+246
to
+251
| SString cdacPath; | ||
| SString dbiPath; | ||
| if (!GetCDacAndDbiPaths(cdacPath, dbiPath)) | ||
| { | ||
| return E_FAIL; | ||
| } |
Comment on lines
281
to
286
| SString dbiModulePath; | ||
| if (!GetDbiPath(dbiModulePath)) | ||
| SString cdacModulePath; | ||
| if (!GetCDacAndDbiPaths(cdacModulePath, dbiModulePath)) | ||
| { | ||
| return E_FAIL; | ||
| } |
| // overrides), returning false if either is missing. | ||
| bool GetCDacAndDbiPaths(SString& cdacPath, SString& dbiPath); | ||
|
|
||
| // Picks the final HRESULT after tthe different activation attempts (cDAC vs. fallback) have completed. |
Comment on lines
+781
to
+784
|
|
||
| Assert.True(wait.WaitOne()); | ||
| AssertResult(DbgShimAPI.UnregisterForRuntimeStartup(unregister)); | ||
| Assert.Null(callbackException); |
noahfalk
approved these changes
Jul 24, 2026
Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
hoyosjs
commented
Jul 25, 2026
hoyosjs
commented
Jul 25, 2026
Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
path.
gating and provider fallback paths.