Skip to content
WASM Analyzer LogoWASM Analyzer LogoWASM Analyzer

DWARF debugging information

DWARF debugging information has been available in WebAssembly files for some time now, and this information is of course readily accessible in our WASM Analyzer.

Read on to find out a little bit more about DWARF, and how to place DWARF debugging information in your WebAssembly files.

Intended audience

This article is written for developers, solutions architects and others working with the technical side of WebAssembly.

Before reading this, it is recommended that you have some familiarity with WebAssembly, and, specifically, custom sections.

But, should you be unfamiliar with these concepts you’ll find our own WebAssembly overview, here. Furthermore, Mozilla’s excellent WebAssembly docs are available here, and you can also have a look at the WebAssembly Community Group’s documentation on custom sections, here.


This document aims to give you a brief look into how DWARF debugging information is structured and added into WebAssembly files. It is instended as a companion piece to our documentation about WebAssembly, here, and the WASM Analyzer, which you can read about here.

This article does not delve deeply into the following:

  • general DWARF information
  • DWARF background information
  • WebAssembly


DWARF is a file format that is used by many compilers and debuggers. It is a standardized debugging format that has been around for a long time. You can read more about the DWARF format on the DWARF Debugging Standard Website, here. At the time this text is written, DWARF 5 is the current latest version, and you can read about it on the version 5 section on the DWARF Debugging Standard Website, here.

WebAssembly and DWARF

In WebAssembly, DWARF debugging information can be automatically added to WebAssembly files by certain tool chains or tools that support adding DWARF debugging information to a binary, like the rustc compiler. Other tools, like the Sentry wasm-split tool allow for splitting out DWARF debugging information into its own file, so that developers can use DWARF information to debug a certain build, and then deliver the same build without included DWARF information. When DWARF data is added or linked to a WebAssembly file, it creates opportunities for faster, or more detailed, debugging. As of now, the utility of using DWARF with WebAssembly is somewhat limited, but some support for WebAssembly DWARF debugging already exists in applications like Google Chrome, which you can read about in the chrome dev blog, here and here.

DWARF in custom sections

WebAssembly custom sections used for DWARF information are named to match DWARF sections. Like the code in WebAssembly itself, DWARF information is divided into sections fulfilling various purposes.

The core information used in DWARF is a set of Debugging Information Entries (DIEs), used to create a low level representation of a program. A DIE contains an ID tag, and a set of attributes. One or more entries describe entities in the program. The DIEs reside in the sections debug_info or debug_info.dwo.

The following table describes all possible DWARF sections as of version 5:

.debug_abbrevabbreviation codesAbbreviation codes used in .debug_info section
.debug_abbrev.dwo1abbreviation codesAbbreviation codes used in .debug_info.dwo sectionDWARF v5 and up
.debug_addrrelocated addressesReferences to loadable sectionsDWARF v5 and up
.debug_arangesrangesLookup table for mapping addresses to compilation units
.debug_framecall frame informationCall frame information; Stack unwinding information
.debug_infoDebugging Information Entries (DIEs)2The Core DWARF information section
.debug_info.dwo1Debugging Information Entries (DIEs)2Contains complete compilation unit debug informationDWARF v5 and up
.debug_lineline numbersDescribes mapping from PC values to source locations.
.debug_line.dwo1line numbersDescribes mapping from PC values to source locations.DWARF v5 and up
.debug_locvariable locationsLocation lists for DW_AT_location attributes
.debug_loclists.dwo1variable locationsLocation lists for DW_AT_location attributesDWARF v5 and up
.debug_macinfomacro informationContains macro information in an older format
.debug_macro.dwo1macro informationContains macro information in a more efficient formatDWARF v5 and up
.debug_namesnames of objects and functions, with typesLookup table for global objects, functions and types
.debug_pubnamesnames of objects and functionsLookup table for global objects and functionsnot part of DWARF v5
.debug_pubtypesan index for type namesLookup table for typesnot part of DWARF v5
.debug_rangesrangesRange lists defining what code belongs to which subprograms and compilation units
.debug_rnglistsrangesRange lists defining what code belongs to which subprograms and compilation units in an updated formatDWARF v5 and up
.debug_strdebug stringsContains strings used by sections such as .debug_info
.debug_str_offsetsstring offsetsContains relative offsets into the .debug_str section
.debug_typestype definitions, in the form of type DIEs2Contains definitions for large typesnot part of DWARF v5

1Used for DWARF 5 split DWARF compilation. Split DWARF facilitates faster and more efficient building by splitting off debug information so that it can be skipped by a linker (the program that links together the raw object files a compiler creates).

2A Debugging Information Entry (DIE) has an identification tag and key value pair attributes. A DIE represents something with an identifier in code, like variables, functions, type, procedures, and so on. A DIE can also have subordinate nested DIEs, representing a tree structure.

WebAssembly file may also have a custom section called external_debug_info. If this section exists, it can either contain DWARF debug info, or point to an external file through a UTC-8 encoded URL. The point of having DWARF information in an external file is to speed up network transfers.

You can read more about WebAssembly and DWARF in the DWARF for WebAssembly documentation on GitHub, here.


DWARF is a well-established debugging information format.

In WebAssembly, DWARF information can be added as custom sections. Each custom section should be named after its equivalent DWARF section. Another option is to add a custom section called external_debug_info.DWARF debugging information can either be put in the external_debug_info section, or the section can contain a reference or link to an external file containing DWARF debugging information.

Sources and additional reading