Enable cDAC-only dump analysis mode and add CI test legs#5755
Draft
max-charlamb wants to merge 8 commits intodotnet:mainfrom
Draft
Enable cDAC-only dump analysis mode and add CI test legs#5755max-charlamb wants to merge 8 commits intodotnet:mainfrom
max-charlamb wants to merge 8 commits intodotnet:mainfrom
Conversation
65cd2f6 to
bd67374
Compare
When ForceUseContractReader is set: - RuntimeWrapper.GetClrDataProcess() tries cDAC even when caller doesn't pass UseCDac flag, and skips legacy DAC fallback. - DumpTargetFactory.OpenDump() allows cross-platform dump analysis since the cDAC is a host-native NativeAOT binary. - Runtime.GetLibraryPath() skips platform filter for cDAC discovery. - Runtime.GetLocalPath() falls back to RuntimeModuleDirectory for cDAC, enabling user-provided paths via setclrpath. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The testsoscdac.cmd/sh scripts filtered tests by CDACCompatible category, but no tests were ever marked with this trait. Replace with the new SOS_TEST_CDAC environment variable approach that enables cDAC-only mode for all dotnet-dump tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- SOSRunner sends 'runtimes --forceusecdac' to dotnet-dump when SOS_TEST_CDAC is set, enabling cDAC-only mode for dump tests. - build.yml gains a useCdac parameter that passes -useCdac to the build script, setting SOS_TEST_CDAC=true. - Add Windows_cDAC (build+test) and Ubuntu_22_04_cDAC (test-only) CI legs running Release x64 with cDAC-only mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bd67374 to
9251418
Compare
- Skip live and native debugger (cdb/lldb) tests in cDAC mode; only run dotnet-dump dump analysis path where forceusecdac is supported - Wire up PackageWithCDac=true when -useCdac is passed so the cDAC transport NuGet package is downloaded and mscordaccore_universal is included in dotnet-dump publish output - When native build is skipped (test-only legs), run native-prereqs separately to download the cDAC transport package - Add RID subdirectory resolution for cDAC path lookup since sos-packaging.props places native binaries under win-x64/ etc. - Add shared framework directory fallback for cDAC path resolution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add SEH protection around FormatGeneratedException calls to prevent access violations in GetLineByOffset from terminating the entire PrintException command. When running with the cDAC in no-fallback mode, some IXCLRDataProcess methods may AV instead of returning error codes. Also add pointer validation in GetStackTraceArray to reject known-invalid stack trace pointers (e.g. 0xFFFFFFFFFFFFFFFF) before dereferencing them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When running with the cDAC in no-fallback mode, the notification callback chain (OnModuleLoaded, OnCodeGenerated, etc.) may encounter null pointers in contract data, causing access violations. Wrap the call in SEH to prevent the AV from terminating the SOSHandleCLRN command. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add SafeGetExceptionData and SafeFormatException SEH wrappers to protect against access violations when the cDAC reads uninitialized exception fields (e.g., _stackTrace containing 0xFFFFFFFFFFFFFFFF at exception creation time). This prevents SOS from crashing in dotnet-dump when running without legacy DAC fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When SafeFormatException catches an access violation from the cDAC, the NativeAOT runtime may be left in a corrupted state. Previously, PrintException would continue calling into the cDAC for nested exception info (GetCurrentManagedThread, Thread.Request), causing a cascading unhandled AV that crashed the entire debugger extension. Now check SafeFormatException's return value and bail out early if it failed, preventing the cascading crash. Co-authored-by: Copilot <223556219+Copilot@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.
Summary
Enable SOS to load and operate on dumps using only the cDAC (no legacy DAC dependency). This enables cross-platform dump analysis and provides CI coverage for cDAC-only mode.
Changes
Commit 1: Enable cDAC-only dump analysis mode
When
ForceUseContractReaderis set (viaruntimes --forceusecdac):UseCDacflag, and skips legacy DAC fallbackDebugLibraryKind.CDacRuntimeModuleDirectoryfor cDAC, enabling user-provided paths viasetclrpathCommit 2: Remove outdated CDACCompatible test scripts
The
testsoscdac.cmd/shscripts filtered byCDACCompatiblecategory, but no tests were ever marked with this trait.Commit 3: Add cDAC-only CI test legs
runtimes --forceusecdacto dotnet-dump whenSOS_TEST_CDACis setbuild.ymlgains auseCdacparameter that passes-useCdacto the build scriptTesting
Verified locally with
dotnet-dump analyzeusing cDAC-only mode against runtime cDAC dump test fixtures:clrstack— full managed stack trace ✅threads— lists all threads ✅dumpheap -stat— graceful error (cDAC feature gap in ClrMD, tracked separately) ✅Related
ICLRContractLocatornot exposed inDacDataTargetCOM.ComputeVtables)