Skip to content

Fix NativeAOT DWARF for EH regions and funclets - #137511

Merged
jkotas merged 7 commits into
dotnet:mainfrom
am11:dwarf-eh-nesting
Nov 16, 2026
Merged

jkotas merged 7 commits into
dotnet:mainfrom
am11:dwarf-eh-nesting

Conversation

@am11

@am11 am11 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

EH regions were emitted as a flat list of sibling DW_TAG_try_block and DW_TAG_catch_block entries. Nested try regions, and try regions inside handlers, then overlapped their siblings, which is what llvm-dwarfdump --verify reported as "DIEs have overlapping address ranges" in il.cpp. Emit each try region as a child of the innermost region that contains it instead. Handlers are funclets with their own subprograms, so a catch entry can't follow its try block as a sibling (DWARF 5 §3.8) and DW_TAG_catch_block is no longer emitted.

Methods with funclets were also described by a single subprogram that covered the main body and all funclets, although each funclet has its own FDE. lldb picks the unwind plan from the FDE at the start of the enclosing function, so it unwound funclet frames with the main body's CFI and could not get past them. It also merges adjacent DW_AT_ranges entries, so emit one subprogram per FDE range instead, all carrying the method's variables. Funclet subprograms are named <method>$funcletN, like the outlined .cold parts clang emits, so that breakpoints on the method resolve to its entry only in both gdb and lldb.

The DwarfDump smoke test now requires zero errors in il.cpp.

Fixes #90209

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

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix remaining Native AOT Linux DWARF errors

4 participants