Start DBI changes needed for non-surrogate loading - #131008
Conversation
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This PR begins wiring up the DBI/cDAC stack for non-surrogate loading by (1) standardizing context-buffer alignment handling in the managed cDAC entrypoints, and (2) enabling live-process data targets to expose runtime/contract location plus optional mutability (write + SetThreadContext) through existing COM shapes.
Changes:
- Centralize and reuse a 16-byte alignment requirement for thread-context buffers in
mscordaccore_universalentrypoints and target adapters. - Add managed COM projection for
ICorDebugMutableDataTargetand plumb optional write / SetThreadContext support when available. - Introduce
ICLRContractLocatorin the CLR data IDL/prebuilt headers and implement it (andICLRRuntimeLocator) on the shim live-process data target; linkdbgutilto support symbol lookup.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/mscordaccore_universal/Entrypoints.cs | Reuse a shared context alignment constant; add optional mutable target support; tighten ReadVirtual semantics for full reads. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Add managed ICorDebugMutableDataTarget COM interface definition. |
| src/coreclr/pal/prebuilt/inc/clrdata.h | Add prebuilt COM interface declaration for ICLRContractLocator. |
| src/coreclr/pal/prebuilt/idl/clrdata_i.cpp | Add IID definition for ICLRContractLocator. |
| src/coreclr/inc/clrdata.idl | Define new ICLRContractLocator COM interface in the source IDL. |
| src/coreclr/dlls/mscordbi/CMakeLists.txt | Link dbgutil into mscordbi to support export symbol lookup. |
| src/coreclr/debug/di/shimprocess.cpp | Add shim hook to propagate runtime base to the live data target. |
| src/coreclr/debug/di/shimpriv.h | Declare ShimProcess::SetRuntimeBase. |
| src/coreclr/debug/di/shimdatatarget.h | Extend shim data target to implement ICLRContractLocator/ICLRRuntimeLocator and store runtime base. |
| src/coreclr/debug/di/shimdatatarget.cpp | Implement QI for the new interfaces and resolve the contract descriptor via TryGetSymbol. |
| src/coreclr/debug/di/process.cpp | Ensure the shim live data target receives the runtime base before creating the DAC/DBI interface. |
noahfalk
left a comment
There was a problem hiding this comment.
I think with a small adjustment to the DacDbiInterfaceInstance export function signature a good chunk of the code in this PR can go away.
Enables live debugging through the cDAC-backed DBI. The DacDbiInterfaceInstance export takes a contractDescriptorAddress parameter alongside the runtime base. When creating the DAC/DBI interface, the DBI resolves the runtime's contract descriptor address via TryGetSymbol and passes it to the export. The cdac entrypoint uses that address to build the ContractDescriptorTarget and construct the legacy DacDbiImpl over it, so a live ICorDebug session can be served by the cDAC. The native DAC export forwards the same address into its cDAC bring-up path.
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Return CORDBG_E_READVIRTUAL_FAILURE for an incomplete ReadVirtual and CORDBG_E_TARGET_READONLY when the target does not implement ICorDebugMutableDataTarget, instead of the generic E_FAIL/E_NOTIMPL.
Enables live debugging through the cDAC-backed DBI.
The DacDbiInterfaceInstance export takes a contractDescriptorAddress parameter alongside the runtime base. When creating the DAC/DBI interface, the DBI resolves the runtime's contract descriptor address via TryGetSymbol and passes it to the export.
On the cdac side, the DacDbiInterfaceInstance entrypoint uses that address to build the ContractDescriptorTarget and construct the legacy DacDbiImpl over it, so a live ICorDebug session can be served by the cDAC. The native DAC export forwards the same address into its cDAC bring-up path.