Start DBI changes needed for non-surrogate loading#131008
Draft
hoyosjs wants to merge 1 commit into
Draft
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. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
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. |
Comment on lines
458
to
+462
| uint bytesRead; | ||
| return dataTarget.ReadVirtual(address, bufferPtr, (uint)buffer.Length, &bytesRead); | ||
| int hr = dataTarget.ReadVirtual(address, bufferPtr, (uint)buffer.Length, &bytesRead); | ||
| return hr >= 0 && bytesRead != (uint)buffer.Length | ||
| ? HResults.E_FAIL | ||
| : hr; |
Comment on lines
+467
to
+472
| if (mutableDataTarget is null) | ||
| return HResults.E_NOTIMPL; | ||
|
|
||
| fixed (byte* bufferPtr = buffer) | ||
| { | ||
| return mutableDataTarget.WriteVirtual(address, bufferPtr, (uint)buffer.Length); |
Comment on lines
+507
to
+515
| if (mutableDataTarget is null) | ||
| return HResults.E_NOTIMPL; | ||
|
|
||
| fixed (byte* contextPtr = context) | ||
| { | ||
| if (((nuint)contextPtr & (ContextAlignment - 1)) == 0) | ||
| { | ||
| return mutableDataTarget.SetThreadContext(threadId, (uint)context.Length, contextPtr); | ||
| } |
Comment on lines
+111
to
+116
| HRESULT STDMETHODCALLTYPE ShimDataTarget::GetContractDescriptor(CLRDATA_ADDRESS * contractAddress) | ||
| { | ||
| if (contractAddress == NULL || m_runtimeBase == 0) | ||
| { | ||
| return E_INVALIDARG; | ||
| } |
Comment on lines
+132
to
+137
| HRESULT STDMETHODCALLTYPE ShimDataTarget::GetRuntimeBase(CLRDATA_ADDRESS * baseAddress) | ||
| { | ||
| if (baseAddress == NULL || m_runtimeBase == 0) | ||
| { | ||
| return E_INVALIDARG; | ||
| } |
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.
No description provided.