Implement CLRDataMethodDefinition IL extent APIs in cDAC#131384
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/tests/UnitTests/IXCLRDataProcessTests.cs:252
- The test currently writes the fat header
CodeSizeusing the target endianness (arch.IsLittleEndian), but IL headers are fixed little-endian (ECMA-335) and the implementation should be reading viaReadLittleEndian. Encoding the header this way can let big-endian tests pass even if the production code is incorrectly using target-endian reads.
secondHeader[codeSizeByteOffset] = FatCodeSize;
- Files reviewed: 4/4 changed files
- Comments generated: 1
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 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.
Copilot's findings
Comments suppressed due to low confidence (2)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataMethodDefinition.cs:422
- StartEnumExtents dereferences
handlebefore validating it. Other similar COM enumeration entrypoints (e.g., ClrDataMethodInstance.StartEnumExtents) explicitly check for null and throw ArgumentNullException to reliably returnE_POINTERwithout relying on null-pointer deref behavior.
try
{
*handle = 0;
TargetPointer code = GetILExtentStart(out uint codeSize);
if (code == TargetPointer.Null)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/IXCLRData.cs:934
- This change introduces a new
publicenum and changes the public field type ofClrDataMethodDefinitionExtent.typefromuinttoCLRDataMethodDefinitionExtentType. That is a source-breaking public surface change for any consumers of the (packable) Legacy assembly. If this API is intended to be public, it should follow the repo’s public API approval process; otherwise consider keeping the field asuint(with a comment or helper cast) or making the enum/internal surface non-public.
public enum CLRDataMethodDefinitionExtentType : uint
{
CLRDATA_METHDEF_IL,
}
public struct ClrDataMethodDefinitionExtent
{
public ClrDataAddress startAddress;
public ClrDataAddress endAddress;
public uint enCVersion;
public CLRDataMethodDefinitionExtentType type;
}
- Files reviewed: 8/8 changed files
- Comments generated: 2
| } | ||
|
|
||
| #if DEBUG | ||
| if (LegacyFallbackHelper.CanFallback() && _legacyImpl is not null) |
There was a problem hiding this comment.
I don't think we normally check this for debug validation, it just controls whether the production code is allowed to fall back. (Same pattern in other DEBUG blocks below)
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/IXCLRData.cs:934
- This change introduces new public API surface in the Legacy COM projections (new public enum
CLRDataMethodDefinitionExtentTypeand changingClrDataMethodDefinitionExtent.typefromuintto that enum). The PR description doesn’t link anapi-approvedissue as required for new public APIs. If this is intended to avoid API review, consider keeping the struct field asuint(matching the prior surface) and using an internal enum/consts for readability, or link the approved API issue.
public enum CLRDataMethodDefinitionExtentType : uint
{
CLRDATA_METHDEF_IL,
}
public struct ClrDataMethodDefinitionExtent
{
public ClrDataAddress startAddress;
public ClrDataAddress endAddress;
public uint enCVersion;
public CLRDataMethodDefinitionExtentType type;
}
- Files reviewed: 8/8 changed files
- Comments generated: 1
| public static class CorDbgHResults | ||
| { | ||
| public const int E_UNEXPECTED = unchecked((int)0x8000FFFF); | ||
| public const int CORDBG_E_NOTREADY = unchecked((int)0x80131c10); | ||
| public const int CORDBG_E_BAD_THREAD_STATE = unchecked((int)0x8013132d); |
Implements IL extent enumeration and representative entry-address lookup for
CLRDataMethodDefinition, replacing legacy fallback behavior.Implementation
StartEnumExtents,EnumExtent,EndEnumExtents, andGetRepresentativeEntryAddress.Validation
Note
This description was generated by GitHub Copilot.