Stream: git-wasmtime

Topic: wasmtime / issue #1036 DWARF line table support


view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2025 at 16:49):

fitzgen closed issue #1036:

DWARF line table support may be a good way to get started with the broader topic of producing debug info, as it's relatively straightforward, and quite valuable.

Briefly surveying the landscape, the three main options appear to be:

(There is also the dwarf crate has rudimentary support for writing, though not yet writing .debug_line sections. Judging by this comment, it seems no longer maintained, in favor of gimli.)

Regardless of how we implement it, the code for consuming cretonne IR and emitting DWARF should be in a new crate, as other users of the cretonne-codegen crate won't need it. It will need to emit the binary data for the section, plus relocation records telling the linker where to fix up program addresses.

The first step is to write a minimal .debug_info section, containing a DW_TAG_compile_unit, and a DW_TAG_subprogram entry for each function. Chapter 2 "General Description" of the dwarf spec defines the overall structure of these. I also recommend either the dwarfdump utility and/or readelf --debug-dump=info,lines for examining DWARF output from other compilers to get a sense of what this needs to look like. Then, we can implement the line table. Section 6.2 "Line Number Information" defines the line table format. I'll flesh out these steps more when we're ready; right now I'm just sketching out the major areas that would be covered.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2025 at 16:49):

fitzgen commented on issue #1036:

This has been implemented at some point in the last seven years.


Last updated: Dec 06 2025 at 07:03 UTC