DWARF5 and GNU Extensions: Mapping Binary to Source in Modern Debugging

Added:

DWARF's Purpose
Design Goals & Extensions
Combining Object Files
Debug Info Duplication
Type Deduplication
Indirection Strategies
Split DWARF in Action
Managing Split Files
Advanced DWARF Tools
Compression & Support

DWARF's Purpose

0:00
Playing Section
  • 1

    DWARF offers more than binary-to-source mapping, including types, variables, and scopes.

  • 2

    Provides location descriptors and unwind information for debugging and inspection.

  • 3

    Aims for implementation independence, though it requires some architectural knowledge.

Fundamental understanding of the compilation pipeline (compilation, assembly, linking) and how source code is translated into executable binaries.
Basic familiarity with standard debugging tools (such as GDB or LLDB) and the concept of mapping machine instructions back to source code lines.
Concept of symbol tables and standard binary file formats, specifically the Executable and Linkable Format (ELF).
General awareness of the DWARF debug format's purpose and its role in representing program scope, types, and variables.
Advanced debugging of optimized code, focusing on how debuggers reconstruct the state of variables inlined or optimized out by compilers.
Deep dive into DWARF5 accelerator tables (e.g., .debug_names) to analyze and optimize debugger startup times and symbol lookup speeds.
Implementation of Split DWARF (using the -gsplit-dwarf compiler flag) to manage and distribute build artifacts in large-scale software projects.
Comparative analysis of DWARF with alternative debug and type info formats, such as CTF (Compact Type Format) and BTF (BPF Type Format) in kernel development.
172 views3likes42:10@UnofficialFOSDEMStreamdumpOriginal Release: 2018-02-03

DWARF5 is a new debugging standard that incorporates GNU extensions to better map binary constructs created by optimizing compilers back to original source code while reducing debugging information size. The standard uses multiple strategies including separate .debug files, .gnu_debuglink, build-ids, compressed ELF sections, debug types in ELF COMDAT sections, DWARF Compressor DWZ, .multi files, DWARF Supplementary Object Files, GNU Debug Fission, split-dwarf .dwo files, and DWARF Package Files .dwp files. The basic structure of Debug Information Entries (DIEs) with attributes per compile unit remains fundamentally unchanged from DWARF version 2, but the hierarchy of representation and where bits are stored has become much more complex, making it no longer possible to simply index DWARF descriptions through offsets.