Skip to content

Hide remaining managed EH helpers from the debugger stack - #131446

Open
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/eh-helpers-stacktracehidden
Open

Hide remaining managed EH helpers from the debugger stack#131446
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/eh-helpers-stacktracehidden

Conversation

@tommcdon

Copy link
Copy Markdown
Member

After #130646 replaced DAC-side frame filtering with attribute-based hiding, managed exception-handling helpers that were previously hidden by class-wide DBI filtering now appear in the logical call stack (mdbg where, current-location, and stepping) on arm64/interpreter configurations. #130646 annotated most of these helpers but missed a few:

  • System.Runtime.EH.AppendExceptionStackFrameViaClasslib
  • System.Runtime.EH.UpdateStackTrace
  • System.Runtime.StackFrameIterator.Next (all three overloads)

Annotate each with both [StackTraceHidden] and [DebuggerHidden], matching the convention already used by every other annotated helper in this shared code (the 8 EH.* throw/dispatch helpers, StackFrameIterator.Init, and System.Environment.CallEntryPoint).

Validated on x64 and arm64: StackWalking.ExceptionStack/BigStackTest and the Exceptions suite (DivZeroTest, FirstChanceSuppressTest, ReflectionTest, TooManyTest) pass.

After dotnet#130646 replaced DAC-side frame filtering with attribute-based hiding,
managed exception-handling helpers that were previously hidden by class-wide DBI
filtering now appear in the logical call stack (mdbg `where`, current-location,
and stepping) on arm64/interpreter configurations. dotnet#130646 annotated most of
these helpers but missed a few:

- System.Runtime.EH.AppendExceptionStackFrameViaClasslib
- System.Runtime.EH.UpdateStackTrace
- System.Runtime.StackFrameIterator.Next (all three overloads)

Annotate each with both [StackTraceHidden] and [DebuggerHidden], matching the
convention already used by every other annotated helper in this shared code
(the 8 EH.* throw/dispatch helpers, StackFrameIterator.Init, and
System.Environment.CallEntryPoint).

Validated on x64 and arm64: StackWalking.ExceptionStack/BigStackTest and the
Exceptions suite (DivZeroTest, FirstChanceSuppressTest, ReflectionTest,
TooManyTest) pass.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9db6edb0-ab23-43c8-9a18-192885f442a0
@tommcdon
tommcdon requested a review from rcj1 July 28, 2026 00:49
Copilot AI review requested due to automatic review settings July 28, 2026 00:49
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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: @agocke, @dotnet/ilc-contrib
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 NativeAOT runtime’s managed exception-handling and stack-walking helpers to be hidden from debugger logical call stacks by consistently applying the same hiding attributes already used for similar helpers in Runtime.Base.

Changes:

  • Add [StackTraceHidden] and [DebuggerHidden] to all three System.Runtime.StackFrameIterator.Next overloads.
  • Add [StackTraceHidden] and [DebuggerHidden] to System.Runtime.EH.AppendExceptionStackFrameViaClasslib and System.Runtime.EH.UpdateStackTrace.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/StackFrameIterator.cs Annotates Next overloads to keep stack-walk iteration helpers out of debugger logical stacks, matching existing Init conventions.
src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs Annotates remaining EH stack-trace construction helpers to avoid surfacing internal runtime frames in logical call stacks.

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.

3 participants