Introduction
DWARF is the debug information format of Linux, the BSDs, macOS and most other systems
outside Windows. It is normally stored in sections of the program’s own
ELF or object files. With split DWARF, chosen with the
compiler option -gsplit-dwarf in GCC and Clang, most of it goes instead
into a .dwo file (“DWARF object”) beside each object file. The linker
then has far less to copy, which makes large programs much quicker to link.
For shipping, the dwp tool packs a program’s .dwo files
into one .dwp file (“DWARF package”). Split DWARF began as a GCC
extension and became part of the standard in DWARF version 5.
Structure
A .dwo file is itself an ELF file whose sections carry the DWARF data,
with names ending in .dwo: .debug_info.dwo for the
description of types, functions and variables, .debug_abbrev.dwo,
.debug_str.dwo, .debug_line.dwo and others. The object file
keeps a small skeleton unit that names the .dwo file and holds a 64-bit
ID; the debugger uses the name to find the file and the ID to check that it matches.
A .dwp file adds index sections that map each ID to its data.
The sections and units page gives every section,
the skeleton and split unit headers and attributes, and the tables they index; the
package file page the .dwp index
layout; and tags, attributes and forms every
DWARF 5 code a .dwo may hold.
Not described
Known, not yet covered
- Reference: from DWARF 5, the address range table header (7.21; its text was read, a table is not written), the type-signature computation (7.32) and DWARF versions 2 to 4. The codes page lists expression operations, base types, languages, line number registers and codes, macro codes, call frame instructions and CIE and FDE layouts, and the
.debug_namesname index. - Reference: GNU’s pre-DWARF 5
.debug_loc.dwoentry kinds, which the pages mark unconfirmed; GNU extension tags and attributes beyond those LLVM’sDwarf.deflists. - Viewer: there is no viewer for .dwo or .dwp files yet.
Links
Software
- GCC – the GNU compiler collection, which writes them with
-gsplit-dwarf(Linux, Windows, macOS) - Clang – the LLVM C and C++ compiler, which writes them with
-gsplit-dwarf(Linux, Windows, macOS) - GDB – the GNU debugger, which reads split DWARF (Linux, macOS, Windows)
- LLDB – the LLVM debugger, which reads split DWARF (Linux, macOS, Windows)
- LLVM – compiler toolkit with
llvm-dwarfdumpandllvm-dwp(Linux, macOS, Windows)
Developers
Reference
- DWARF Debugging Information Format – the standard, from version 5 including split DWARF