[cDAC] Implement DacDbi GetVarArgSig API#128106
Draft
Copilot wants to merge 5 commits into
Draft
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the cDAC Signature contract and CoreCLR data descriptors to support DAC/DBI vararg cookie decoding (arg base + raw signature pointer/length), and wires that through the managed legacy DACDBI implementation, with accompanying documentation and unit tests.
Changes:
- Extend
ISignatureand implement vararg cookie helpers inSignature_1(GetVarArgArgsBase,GetVarArgSignature). - Introduce a new
VASigCookiedata descriptor (native) and a managed reader type to exposesizeOfArgsand the embeddedSignaturepointer/length. - Update the legacy
DacDbiImpl.GetVarArgSigto use the new contract APIs and add docs/tests.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/SignatureTests.cs | Adds unit tests for vararg cookie signature/arg-base APIs and error paths. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetVarArgSig via cDAC Signature contract (with DEBUG cross-validation). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/VASigCookie.cs | Adds managed data reader for the VASigCookie descriptor fields. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Signature/Signature_1.cs | Implements the new vararg cookie APIs on the v1 Signature contract. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/DataType.cs | Adds DataType.VASigCookie. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ISignature.cs | Adds new public members to ISignature. |
| src/coreclr/vm/siginfo.hpp | Grants cDAC data access to Signature’s private fields for cookie decoding. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Adds the VASigCookie native data descriptor definition. |
| src/coreclr/vm/ceeload.h | Adds cdac_data<VASigCookie> offsets to reach Signature’s pointer/length. |
| docs/design/datacontracts/Signature.md | Documents new APIs, new data descriptor, and vararg cookie decoding behavior. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/DataType.cs:183
- DataType is a public enum with implicit sequential values. Inserting VASigCookie here will shift the numeric values of all subsequent members (the GC Data Types), which is a breaking change for any consumers persisting/casting these values or for any protocol that relies on stable IDs. Prefer appending new members at the end, or assigning an explicit value to the new member (and/or explicitly pinning the existing values) to avoid renumbering.
ComInterfaceEntry,
InternalComInterfaceDispatch,
AuxiliarySymbolInfo,
VASigCookie,
CodeRangeMapRangeList,
/* GC Data Types */
GCHeap,
- Files reviewed: 10/10 changed files
- Comments generated: 4
Comment on lines
+55
to
+72
| TargetPointer ISignature.GetVarArgArgsBase(TargetPointer vaSigCookieAddr) | ||
| { | ||
| if (vaSigCookieAddr == TargetPointer.Null) | ||
| throw new ArgumentException("VASigCookie address must be non-null.", nameof(vaSigCookieAddr)); | ||
| // Compute the address of the first argument. On x86 the args are pushed below the cookie | ||
| // pointer (stack grows down on the args walk), so the first argument lies at | ||
| // vaSigCookieAddr + sizeOfArgs. | ||
| // On all other platforms the first argument follows the cookie pointer in memory | ||
| // (stack grows up on the args walk), so its address is at | ||
| // vaSigCookieAddr + sizeof(VASigCookie*). | ||
| if (_target.Contracts.RuntimeInfo.GetTargetArchitecture() == RuntimeInfoArchitecture.X86) | ||
| { | ||
| Data.VASigCookie cookie = GetCookie(vaSigCookieAddr); | ||
| return new TargetPointer(vaSigCookieAddr.Value + cookie.SizeOfArgs); | ||
| } | ||
|
|
||
| return new TargetPointer(vaSigCookieAddr.Value + (ulong)_target.PointerSize); | ||
| } |
Comment on lines
+80
to
+83
| signatureAddress = cookie.SignaturePointer; | ||
| signatureLength = cookie.SignatureLength; | ||
| Debug.Assert(signatureAddress != TargetPointer.Null || signatureLength == 0, | ||
| "VASigCookie has a non-zero signature length but a null signature pointer."); |
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.
Adding Signature cDAC APIs