[cDAC] Implement GetILCodeVersionNodeData in DacDbi#129448
Conversation
… m_dwCodegenFlags Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
Adds cDAC exposure for instrumented IL offset mappings and wires that into the legacy DacDbi GetILCodeVersionNodeData flow, including CoreCLR data-descriptor plumbing and unit test coverage.
Changes:
- Add
InstrumentedILOffsetMappingto the CoreCLR cDAC data descriptor set and contracts, and expose it offILCodeVersionNode. - Introduce
ICodeVersions.TryGetInstrumentedILMap(...)and implement it inCodeVersions_1. - Implement
DacDbiImpl.GetILCodeVersionNodeDataand add new unit tests/mocks for the new mapping data.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/UnitTests/MockDescriptors/MockDescriptors.CodeVersions.cs | Extends mock layouts/builders to represent instrumented IL map data on IL code version nodes. |
| src/native/managed/cdac/tests/UnitTests/DacDbiImplTests.cs | Adds a unit test validating GetILCodeVersionNodeData populates IL + instrumented map outputs. |
| src/native/managed/cdac/tests/UnitTests/CodeVersionsTests.cs | Adds contract-level tests for TryGetInstrumentedILMap (explicit + synthetic). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Updates DacDbiSharedReJitInfo managed struct layout to match native changes (removes unused fields). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetILCodeVersionNodeData using cDAC contracts and instrumented IL map query. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/DataType.cs | Adds InstrumentedILOffsetMapping to the contract DataType enum. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/InstrumentedILOffsetMapping.cs | New data contract type representing the embedded mapping (count + pointer). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/ILCodeVersionNode.cs | Exposes the embedded mapping address via [FieldAddress] InstrumentedILMap. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/CodeVersions_1.cs | Implements TryGetInstrumentedILMap by reading the embedded mapping. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ICodeVersions.cs | Adds new contract API TryGetInstrumentedILMap(...). |
| src/coreclr/vm/ilinstrumentation.h | Changes mapping count storage to UINT and adds cdac_data<> descriptor offsets. |
| src/coreclr/vm/ilinstrumentation.cpp | Updates SetMappingInfo/GetCount signatures to UINT. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Adds cDAC type/fields for InstrumentedILOffsetMapping and embeds it in ILCodeVersionNode. |
| src/coreclr/vm/codeversion.h | Updates SetInstrumentedILMap signatures to UINT and adds cDAC offset for embedded mapping. |
| src/coreclr/vm/codeversion.cpp | Updates SetInstrumentedILMap implementations to use UINT. |
| src/coreclr/debug/inc/dacdbistructures.h | Removes unused fields from native DacSharedReJitInfo structure. |
| src/coreclr/debug/ee/functioninfo.cpp | Updates DebuggerMethodInfo::SetInstrumentedILMap count parameter to UINT. |
| src/coreclr/debug/ee/debugger.h | Updates SetInstrumentedILMap declaration to UINT. |
| src/coreclr/debug/daccess/dacdbiimpl.cpp | Stops populating removed DacSharedReJitInfo fields; keeps IL + instrumented map outputs. |
| docs/design/datacontracts/CodeVersions.md | Documents the new API and new data descriptors involved in the mapping. |
Copilot's findings
- Files reviewed: 20/20 changed files
- Comments generated: 6
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| // The InstrumentedILOffsetMapping is embedded within the ILCodeVersionNode. | ||
| TargetPointer mappingAddress = AsNode(ilCodeVersionHandle).InstrumentedILMap; | ||
| Data.InstrumentedILOffsetMapping mapping = _target.ProcessedData.GetOrAdd<Data.InstrumentedILOffsetMapping>(mappingAddress); | ||
|
|
||
| mapEntryCount = mapping.Count; | ||
| mapEntries = mapping.Map; | ||
| return true; | ||
| } |
| TargetPointer mappingAddress = ilCodeVersionHandle.ILCodeVersionNode + /* ILCodeVersionNode::InstrumentedILMap offset */; | ||
| mapEntryCount = target.Read<uint>(mappingAddress + /* InstrumentedILOffsetMapping::Count offset */); | ||
| mapEntries = target.ReadPointer(mappingAddress + /* InstrumentedILOffsetMapping::Map offset */); | ||
| return true; |
| public virtual TargetPointer GetIL(ILCodeVersionHandle ilCodeVersionHandle) => throw new NotImplementedException(); | ||
| public virtual bool HasDefaultIL(ILCodeVersionHandle ilCodeVersionHandle) => throw new NotImplementedException(); | ||
| public virtual bool TryGetInstrumentedILMap(ILCodeVersionHandle ilCodeVersionHandle, out uint mapEntryCount, out TargetPointer mapEntries) => throw new NotImplementedException(); | ||
|
|
This comment has been minimized.
This comment has been minimized.
Copilot Code ReviewHolistic AssessmentMotivation: This PR implements Approach: Sound and well-structured. The latest commit (8cfa8fc) simplifies the implementation by using Summary: ✅ LGTM. The implementation correctly mirrors native DAC behavior, the latest simplification follows idiomatic cDAC patterns, struct layout changes are consistent across native/managed boundaries, and tests provide good coverage. Detailed FindingsDetailed Findings✅ Latest commit simplification is correctThe change from ✅ Native behavior fidelity
✅ Data descriptor registration
✅
|
TryGetInstrumentedILMap(ILCodeVersionHandle ilCodeVersionHandle, out uint mapEntryCount, out TargetPointer mapEntries)GetILCodeVersionNodeData