Skip to content

[cDAC] Add stackwalk DAC flags - #131901

Open
rcj1 wants to merge 1 commit into
dotnet:mainfrom
rcj1:stackwalk-stuff
Open

[cDAC] Add stackwalk DAC flags#131901
rcj1 wants to merge 1 commit into
dotnet:mainfrom
rcj1:stackwalk-stuff

Conversation

@rcj1

@rcj1 rcj1 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #112366

Copilot AI review requested due to automatic review settings August 5, 2026 19:55
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the cDAC legacy IXCLRData stack-walk surface to accept flags for IXCLRDataTask.CreateStackWalk, and threads those flags through to ClrDataStackWalk to influence which frames are surfaced during enumeration.

Changes:

  • Change IXCLRDataTask.CreateStackWalk to take a new CLRDataStackWalkFlag enum instead of a raw uint.
  • Add CLRDataStackWalkFlag and plumb the flag type through ClrDataTask and ClrDataStackWalk.
  • Use the provided flags in ClrDataStackWalk to filter which StackWalkState values are considered “legacy visible”.
Show a summary per file
File Description
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/IXCLRData.cs Updates the COM interface signature and introduces CLRDataStackWalkFlag.
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataTask.cs Propagates the new flag type through the task’s CreateStackWalk implementation (including legacy forwarding).
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataStackWalk.cs Stores the flags and applies them when deciding which frames to surface.

Copilot's findings

Suppressed comments (1)

src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataTask.cs:86

  • This PR adds new flag-dependent behavior for IXCLRDataTask.CreateStackWalk, but the cDAC test suite does not currently exercise IXCLRDataStackWalk enumeration with non-zero flags (or validate that the filtered frame set stays in sync with the legacy DAC when _legacyImpl is present). Adding at least one unit/integration test covering the flag behavior would help prevent regressions.
    int IXCLRDataTask.CreateStackWalk(CLRDataStackWalkFlag flags, DacComNullableByRef<IXCLRDataStackWalk> stackWalk)
    {
        Contracts.ThreadData threadData = _target.Contracts.Thread.GetThreadData(_address);
        if (threadData.State.HasFlag(Contracts.ThreadState.Unstarted))
            return HResults.E_FAIL;

        IXCLRDataStackWalk? legacyStackWalk = null;
        if (_legacyImpl is not null)
        {
            DacComNullableByRef<IXCLRDataStackWalk> legacyStackWalkOut = new(isNullRef: false);
            int hr = _legacyImpl.CreateStackWalk(flags, legacyStackWalkOut);
            if (hr < 0)
                return hr;
            legacyStackWalk = legacyStackWalkOut.Interface;
        }

        stackWalk.Interface = new ClrDataStackWalk(_address, flags, _target, legacyStackWalk);
        return HResults.S_OK;
  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support flags in IXCLRDataTask.CreateStackWalk

3 participants