Emit DWARFv5
The GHC manual states that GHC emits DWARFv4 information. DWARFv5, stabilised in 2017, includes several new features relevant to Haskell:
- Haskell language code
- A new DIE,
DW_TAG_call_site
, and related attributes and expressions, which can include tail call and tail recursion information - A new attribute,
DW_AT_noreturn
, which would be useful for CPS'd code
There is some minor incompatibility between DWARFv4 and DWARFv5, but it's probably worth the effort to greatly increase the quality of the debug information. For starters, it seems that the DW_TAG_call_site
information could be emitted without having to make the migration changes.
An example of gdb
support for this is here: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Tail-Call-Frames.html