skillfed

dwarf-debug-format

Master DWARF debug format fundamentals—the sections that store type, variable, and function metadata in ELF binaries. Learn to inspect debug info with dwarfdump and readelf, work with split DWARF (.dwo files) to reduce linker overhead, configure debuginfod for remote symbol servers, and navigate how LTO and stripping affect debug information.

dwarf-debug-format helps you inspect and understand DWARF debug information in binaries using tools like dwarfdump and readelf.

AI-generated summary based on this skill's SKILL.md

148 19 MIT updated by mohitmishra786

Install

mohitmishra786/low-level-dev-skills/dwarf-debug-format · repository language: JavaScript

git clone https://github.com/mohitmishra786/low-level-dev-skills
cp -r low-level-dev-skills/skills/debuggers/dwarf-debug-format ~/.claude/skills/dwarf-debug-format
npx skillfed install mohitmishra786/low-level-dev-skills/dwarf-debug-format

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I inspect DWARF debug info in a binary?

dwarf-debug-format provides multiple tools to inspect DWARF sections. Use `dwarfdump` to dump the full DWARF tree with DIE (Debugging Information Entry) structures, or `readelf -w` for a simpler overview of debug sections. `llvm-dwarfdump` offers LLVM-specific output. These tools parse .debug_info, .debug_line, .debug_str, and other DWARF sections embedded in ELF binaries, showing you type definitions, variable locations, and function metadata.

What are DWARF sections in ELF binaries?

dwarf-debug-format organizes debug metadata into named sections: .debug_info contains DIE trees with types and variables; .debug_line maps instructions to source lines; .debug_str stores string constants; .debug_loc and .debug_ranges describe variable locations and address ranges; .debug_aranges indexes compilation units by address. Together they enable debuggers to correlate running code back to source, show variable values, and set breakpoints accurately.

How do split DWARF and .dwo files optimize builds?

dwarf-debug-format's split DWARF workflow separates debug info into .dwo (DWARF object) files per compilation unit, keeping linker input smaller and faster. Compile with `-gsplit-dwarf` to generate .dwo files alongside object files. Use `dwp` to merge them into a single .dwp package for deployment, or keep .dwo files alongside binaries. This reduces link-time memory and I/O while preserving full debug capability.

How does debuginfod setup work for remote symbol resolution?

dwarf-debug-format integrates with debuginfod to fetch debug symbols from remote servers automatically. Set the `DEBUGINFOD_URLS` environment variable to point to debuginfod instances (e.g., Fedora or Ubuntu servers). GDB and other debuggers query these URLs by build-id when local symbols are missing, downloading .debug files on demand. This eliminates manual symbol management and works across distributions.

How do LTO and stripping impact debug information?

dwarf-debug-format debug info is affected by both optimizations. Link-Time Optimization (LTO) can inline and reorder code, making DWARF location expressions complex; thin LTO preserves more debug fidelity than full LTO. Stripping with `strip --strip-debug` removes all DWARF sections; use `strip --only-keep-debug` to extract them into separate .gnu_debuglink files for later attachment.

What should I do if GDB reports no debugging symbols found?

dwarf-debug-format troubleshooting: verify the binary wasn't stripped with `readelf -S` (check for .debug_info). If stripped, look for a .gnu_debuglink section pointing to a separate debug file. Configure debuginfod via `DEBUGINFOD_URLS` to auto-fetch symbols. Recompile with `-g` flag and avoid `-s` or `strip` during build. Use `file` command to confirm debug sections exist.

SKILL.md

rendered from the published skill — quoted content, verbatim

DWARF Debug Format

Purpose

Guide agents through understanding and working with DWARF debug information: the key DWARF sections, using dwarfdump and readelf for inspection, split DWARF (.dwo files), debuginfod for remote symbol servers, and how LTO and stripping affect debug info.

Triggers

  • "What are the DWARF sections in an ELF binary?"
  • "How do I inspect DWARF debug info in a binary?"
  • "How does split DWARF work?"
  • "How do I set up debuginfod for automatic debug symbols?"
  • "Why does GDB say 'no debugging symbols found'?"
  • "How does LTO affect DWARF debug information?"

Workflow

1. DWARF sections overview

```bash

Show all sections in a binary (including DWARF)

readelf -S prog | grep ".debug"

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
skills/debuggers/dwarf-debug-format/SKILL.md

Related skills

Tags

debug-symbol-inspection binary-introspection compiler-optimization-debugging remote-symbol-resolution debug-info-distribution linker-performance source-level-debugging executable-metadata