Skip to content

[cDAC] Handle interior pointer resolution in GcScanContext #125728

@max-charlamb

Description

@max-charlamb

Summary

The cDAC's GcScanContext in GcScanContext.cs currently throws NotImplementedException when encountering interior pointers (GC_CALL_INTERIOR flag) with ResolveInteriorPointers set to true.

Current Behavior

Both GCEnumCallback and GCReportCallback methods contain:

if (flags.HasFlag(GcScanFlags.GC_CALL_INTERIOR) && ResolveInteriorPointers)
{
    // TODO(stackref): handle interior pointers
    throw new NotImplementedException();
}

Expected Behavior

When an interior pointer is reported (e.g., pointing to the middle of an object), the cDAC should resolve it to the containing object's base address, matching the behavior of the native DAC's GcStackReferenceData reporting.

This is not currently hit in the common EnumerateStackRefs path because ResolveInteriorPointers defaults to false, but it could be needed by future consumers or when the cDAC is used for SOS scenarios that require resolved object addresses.

Context

This was identified during review of PR #125505 (cDAC stack reference walking). The relevant code is at:

  • src/native/managed/cdac/.../Contracts/StackWalk/GC/GcScanContext.cs lines 48-52, 81-85

cc @maxcharlamb

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions