
Dwarf Expert
- 3.8k installs
- 6.3k repo stars
- Updated July 27, 2026
- trailofbits/skills
Technical expertise in DWARF debug format standards (v3-v5), debug info parsing, validation workflows, and code that interacts with DWARF data structures.
About
dwarf-expert provides technical knowledge for analyzing DWARF debug files and understanding the DWARF standard across versions 3, 4, and 5. Developers use this skill when parsing debug information from compiled binaries, validating DWARF data integrity with llvm-dwarfdump, or writing code that interacts with DWARF data structures. Key workflows include using dwarfdump or readelf to extract debug sections, running structural validation on binaries before distribution, comparing debug info quality across builds with --statistics output, leveraging DWARF parsing libraries (libdwarf, pyelftools, gimli), and reviewing code that handles DWARF data. The skill covers answering DWARF standard questions by referencing dwarfstd.org and LLVM's reference implementation, but excludes v1/v2 analysis, general ELF parsing, runtime debugging, and compiler-specific DWARF generation issues. Verify DWARF structural integrity and detect malformed debug info using llvm-dwarfdump --verify with detailed error reporting.
- Verify DWARF structural integrity and detect malformed debug info using llvm-dwarfdump --verify with detailed error repo
- Parse and dump DWARF DIE nodes with dwarfdump for complex debug information inspection and search
- Write, modify, and review code using DWARF parsing libraries (libdwarf, pyelftools, gimli, LLVM DebugInfo)
- Compare debug info quality across compiler versions and optimization levels using --statistics metrics
- Reference authoritative sources: DWARF standard (dwarfstd.org), LLVM DebugInfo implementation, and libdwarf for correctn
Dwarf Expert by the numbers
- 3,806 all-time installs (skills.sh)
- +121 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #21 of 610 Debugging skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
dwarf-expert capabilities & compatibility
- Capabilities
- verify dwarf structural integrity in binaries · parse and dump dwarf die nodes with dwarfdump · answer dwarf standard specification questions · review code that handles dwarf data · compare debug info quality metrics across builds · reference llvm and libdwarf implementations
- Use cases
- debugging · code review · testing
- Platforms
- macOS · Linux · Windows
- Runs
- Runs locally
What dwarf-expert says it does
Provides expertise for analyzing DWARF debug files and understanding the DWARF debug format/standard (v3-v5).
npx skills add https://github.com/trailofbits/skills --skill dwarf-expertAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 3.8k |
|---|---|
| repo stars | ★ 6.3k |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 27, 2026 |
| Repository | trailofbits/skills ↗ |
What it does
Parse, validate, and analyze DWARF debug information (v3-v5) in compiled binaries using command-line tools and code libraries.
Who is it for?
Verifying compiled binaries have valid debug info, parsing debug symbols from ELF files, writing DWARF parsers, debugging debugger issues, comparing debug quality across builds.
Skip if: DWARF v1/v2 analysis, general ELF parsing without debug concerns, runtime executable debugging, binary reverse engineering, compiler DWARF generation problems.
When should I use this skill?
Understanding DWARF information, interacting with DWARF files, answering DWARF-related questions, parsing DWARF data in code, verifying debug info integrity.
What you get
Analyze DWARF sections, validate debug info integrity, parse DIE nodes, write correct DWARF-handling code, and answer DWARF standard questions.
- DWARF section analysis
- Validated binary debug info
- DWARF parsing code
By the numbers
- Supports DWARF versions 3, 4, 5
- Covers llvm-dwarfdump, dwarfdump, readelf, and three major parsing libraries
Files
Overview
This skill provides technical knowledge and expertise about the DWARF standard and how to interact with DWARF files. Tasks include answering questions about the DWARF standard, providing examples of various DWARF features, parsing and/or creating DWARF files, and writing/modifying/analyzing code that interacts with DWARF data.
When to Use This Skill
- Understanding or parsing DWARF debug information from compiled binaries
- Answering questions about the DWARF standard (v3, v4, v5)
- Writing or reviewing code that interacts with DWARF data
- Using
dwarfdumporreadelfto extract debug information - Verifying DWARF data integrity with
llvm-dwarfdump --verify - Working with DWARF parsing libraries (libdwarf, pyelftools, gimli, etc.)
When NOT to Use This Skill
- DWARF v1/v2 Analysis: Expertise limited to versions 3, 4, and 5.
- General ELF Parsing: Use standard ELF tools if DWARF data isn't needed.
- Executable Debugging: Use dedicated debugging tools (gdb, lldb, etc) for debugging executable code/runtime behavior.
- Binary Reverse Engineering: Use dedicated RE tools (Ghidra, IDA) unless specifically analyzing DWARF sections.
- Compiler Debugging: DWARF generation issues are compiler-specific, not covered here.
Authoritative Sources
When specific DWARF standard information is needed, use these authoritative sources:
1. Official DWARF Standards (dwarfstd.org): Use web search to find specific sections of the official DWARF specification at dwarfstd.org. Search queries like "DWARF5 DW_TAG_subprogram attributes site:dwarfstd.org" are effective.
2. LLVM DWARF Implementation: The LLVM project's DWARF handling code at llvm/lib/DebugInfo/DWARF/ serves as a reliable reference implementation. Key files include:
DWARFDie.cpp- DIE handling and attribute accessDWARFUnit.cpp- Compilation unit parsingDWARFDebugLine.cpp- Line number informationDWARFVerifier.cpp- Validation logic
3. libdwarf: The reference C implementation at github.com/davea42/libdwarf-code provides detailed handling of DWARF data structures.
Verification Workflows
Use llvm-dwarfdump verification options to validate DWARF data integrity:
Structural Validation
# Verify DWARF structure (compile units, DIE relationships, address ranges)
llvm-dwarfdump --verify <binary>
# Detailed error output with summary
llvm-dwarfdump --verify --error-display=full <binary>
# Machine-readable JSON error summary
llvm-dwarfdump --verify --verify-json=errors.json <binary>Quality Metrics
# Output debug info quality metrics as JSON
llvm-dwarfdump --statistics <binary>The --statistics output helps compare debug info quality across compiler versions and optimization levels.
Common Verification Patterns
- After compilation: Verify binaries have valid DWARF before distribution
- Comparing builds: Use
--statisticsto detect debug info quality regressions - Debugging debuggers: Identify malformed DWARF causing debugger issues
- DWARF tool development: Validate parser output against known-good binaries
Parsing DWARF Debug Information
readelf
ELF files can be parsed via the readelf command ({baseDir}/reference/readelf.md). Use this for general ELF information, but prefer dwarfdump for DWARF-specific parsing.
dwarfdump
DWARF files can be parsed via the dwarfdump command, which is more effective at parsing and displaying complex DWARF information than readelf and should be used for most DWARF parsing tasks ({baseDir}/reference/dwarfdump.md).
Working With Code
This skill supports writing, modifying, and reviewing code that interacts with DWARF data. This may involve code that parses DWARF debug data from scratch or code that leverages libraries to parse and interact with DWARF data ({baseDir}/reference/coding.md).
Choosing Your Approach
┌─ Need to verify DWARF data integrity?
│ └─ Use `llvm-dwarfdump --verify` (see Verification Workflows above)
├─ Need to answer questions about the DWARF standard?
│ └─ Search dwarfstd.org or reference LLVM/libdwarf source
├─ Need simple section dump or general ELF info?
│ └─ Use `readelf` ({baseDir}/reference/readelf.md)
├─ Need to parse, search, and/or dump DWARF DIE nodes?
│ └─ Use `dwarfdump` ({baseDir}/reference/dwarfdump.md)
└─ Need to write, modify, or review code that interacts with DWARF data?
└─ Refer to the coding reference ({baseDir}/reference/coding.md)interface:
icon_small: "assets/trail-of-bits-mark.svg"
icon_large: "assets/trail-of-bits-mark.svg"
brand_color: "#D83A34"
<svg xmlns="http://www.w3.org/2000/svg" width="94" height="56" fill="none" viewBox="0 0 94 56"><path fill="#F0F4F7" d="m34.04 54.662-7.61-4.147L24.593 56l9.433-1.335c-.029 0-.043 0 .014-.003"/><path fill="#F0F4F7" d="m34.039 54.662-.014.003c.035 0 .096-.003.014-.003m26.191-2.67 6.124-1.804 2.301-7.26-5.655.387zM74.805 5.478l-4.68-3.035-2.62 8.332 5.15 1.548zM43.224 3.532s3.172.973 4.423 1.328l4.508 1.335L52.234 0l-7.928 1.576zm-31.473 23.14 5.566.014 1.982-6.216-5.06-1.342c-.538 1.708-1.94 5.837-2.488 7.544M1.394 20.896l4.164 4.338 2.398-7.696-5.11-1.357zm88.205 24.841c-.086-2.18-.692-2.894-1.978-4.232l-6.71.447c1.871 1.175 3.018 2.63 3.255 4.583.261 2.145-2.068 4.623-4.322 4.623-1.258 0-1.885-.987-1.885-2.12.035-.845.333-1.942.777-2.673h-5.691c-.444 1.136-.813 2.418-.813 3.625 0 4.136 3.659 5.197 7.131 5.197 3.62 0 6.616-.696 8.501-4.03.85-1.505 1.806-3.663 1.735-5.42M18.804.56 1.362.576 0 4.86l6.394-.007-3.161 9.962 5.114 1.356 3.551-11.322 5.544-.007z"/><path fill="#F0F4F7" d="M20.707 15.898c.628-.04 1.258-.04 1.886-.04 1.035-.003 2.587.072 2.587 1.499.004.987-.366 2.233-.66 3.184-.551 1.942-1.214 3.88-1.325 5.858l5.727-.007c-.151-3.185 1.842-5.968 1.838-9.117 0-2.123-1.627-2.964-3.512-3.294l.552-.075c4.103-.554 6.39-3.738 6.386-7.729-.004-4.423-3.738-5.666-7.544-5.662l-6.576.007c-1.87 5.751-3.645 11.534-5.462 17.31l5.057 1.339zM24.245 4.58l1.849-.004c1.369 0 2.734.327 2.738 1.939.003 1.977-1.437 5.31-3.803 5.31l-3.031.004zm11.959 21.883 2.949-5.531 7.06-.008-.215 5.564 5.544-.004.441-18.94-4.763-1.43a89 89 0 0 0-.677 10.71h-.036l-5.322.004c1.914-3.586 3.749-7.2 5.4-10.906L42.77 4.775 30.437 26.466zm39.249-.036 1.402-4.214-7.43.01 2.753-8.612-5.15-1.548-4.584 14.375zm-34.411 1.658h-7.28l-6.834 21.18 8.698 4.694c5.208-.196 8.856-4.012 8.856-9.252 0-2.013-1.258-3.586-3.215-4.136 3.846-.877 6.319-3.33 6.319-7.356-.004-3.923-3.072-5.13-6.544-5.13m-2.993 20.318c-1.036 1.537-2.143 1.647-3.881 1.647h-2.254l2.476-7.611c1.81.07 5.024-.366 5.024 2.268 0 1.168-.698 2.744-1.365 3.696m-.444-9.667h-2.072l2.18-6.7c1.626.075 4.694-.436 4.694 2.053.04 2.928-1.846 4.647-4.802 4.647M58.67 9.582l-5.522 18.29-4.878 14.836 5.856-.447 4.23-13.2h.006l5.713-17.878c-.796-.22-3.964-1.228-5.404-1.601m2.738 18.542-1.37 4.278h6.398l-2.993 9.525 5.584-.38 2.913-9.145h5.541l1.37-4.278zm25.351-.259c-5.726 0-9.127 3.951-9.127 9.444.007.798.727 2.765 2.2 3.422l6.888-.462c-1.172-.98-3.243-3.29-3.243-4.519 0-1.686.95-3.891 2.91-3.891 1.33 0 2.143.366 2.143 1.793 0 .916-.444 1.757-.702 2.638h5.322c.333-.77.849-2.528.849-3.334.004-3.994-3.913-5.09-7.24-5.09m-63.15.372c-2.605 0-2.978 1.906-3.623 3.93-.215.728-.623 1.615-.623 2.379 0 1.47 1.315 1.75 2.537 1.75 1.494.01 2.29-.487 2.82-1.878.362-.952 1.305-3.568 1.305-4.488 0-1.303-1.326-1.693-2.416-1.693m.728 1.87c0 .328-.373 1.392-.498 1.765l-.577 1.782c-.226.675-.498 1.449-1.359 1.449-.487 0-.802-.28-.802-.785 0-.653.509-1.864.724-2.538.215-.671.498-2.01 1.247-2.269.168-.056.351-.078.534-.078.34 0 .749.302.749.664zm5.902 2.674.394-1.292H28.37l.613-1.928h2.38l.42-1.292h-4.126l-2.48 7.924h1.735l1.075-3.412z"/></svg>
Writing, Modifying, or Reviewing Code That Interacts With DWARF Data.
You may be tasked with writing, modifying, or reviewing code that handles, parses, or otherwise interacts with DWARF data.
General Guidelines
- Rely on Authoritative Sources: For ground-truth information about DWARF sections, DIE nodes, and attributes, use web search for dwarfstd.org specifications or reference LLVM/libdwarf source code implementations.
- Using DWARF Expertise: Use your DWARF-specific expertise to work with code that interacts with DWARF data, but do NOT use it when working with unrelated code.
Writing Code
- Prefer Python for Scripting: Prefer to use Python for simpler DWARF code (such as scripts that filter for specific DIE nodes) unless another language is specified.
- Leverage Existing Libraries: Prefer to use existing libraries to parse/handle DWARF data if they exist for the selected language (see
Common DWARF Libraries). - Refer to Library Documentation: If using a library, refer to it's documentation as needed (both in-code and online references if available).
Modifying Code
- Follow Existing Styles: Adhere to existing code styles, formatting, naming conventions, etc wherever possible.
- Group Changes: Perform logically related changes together and separate out unrelated groups of changes into individual steps.
- Describe Changes: Clearly describe the purpose of each group of changes and what each individual change achieves to the user.
- Advise on Complex Changes: Suggest especially large or complex changes to the user before making them. For example, if a significant amount of code needs to be added or modified to handle a particular type of DIE node or attribute.
Reviewing Code
- Only Suggest Changes: Suggest changes or advise on refactors but do NOT modify the code.
- Consider Edge Cases: Consider edge cases that may be unhandled, such as special DIE node types, abstract base DIE nodes, specification DIE nodes, optional attributes, etc.
Common DWARF Libraries
There are a number of libraries that can be leveraged to parse and interact with DWARF data. Prefer to use these when writing new code (if the chosen language has a compatible library).
| Library | Language | URL | Notes |
|---|---|---|---|
libdwarf | C/C++ | https://github.com/davea42/libdwarf-code | Offers a simpler, lower-level interface. Used to implement dwarfdump. |
pyelftools | Python | https://github.com/eliben/pyelftools | Also supports parsing of ELF files in general. |
gimli | Rust | https://github.com/gimli-rs/gimli | Designed for performant access to DWARF data. May require other dependencies (such as object) to open and parse entire DWARF files. |
debug/dwarf | Go | https://github.com/golang/go/tree/master/src/debug/dwarf | Standard library built-in. |
LibObjectFile | .NET | https://github.com/xoofx/LibObjectFile | Also supports interfacing with object files (ELF, PE/COFF, etc) in general. |
Parsing DWARF Files With dwarfdump
dwarfdump is a utility used to parse and dump DWARF information from DWARF files. It can be used to dump individual DWARF sections, display DIE node trees (both parents and children), search for DIE nodes by name or address, and verify that DWARF files are well-formed.
dwarfdump vs llvm-dwarfdump
Two slightly different flavors of the dwarfdump utility exist:
- libdwarf's implementation, typically called
dwarfdump - LLVM's implementation, typically called
llvm-dwarfdump
Both can be used interchangeably, albeit with slightly different command-line options. Both accept options to modify the dumped output and the path to the object file containing the DWARF information to dump. The actual dwarfdump command my refer to either of the utilities depending on the system; Use dwarfdump --version to determine which implementation is used.
Commonly Used Options for LLVM dwarfdump
These options are specific to LLVM's implementation of dwarfdump.
dwarfdump --version: Display version information. Use to determine whether the system uses libdwarf's or LLVM's implementation.dwarfdump --help: Display available options.dwarfdump --all: Dump all DWARF sections.dwarfdump --<debug_section>: Dump a particular DWARF section (e.g.--debug-addr,--debug-names, etc). Can be specified multiple times to dump multiple sections.dwarfdump --show-children [--recurse-depth=<n>]: Show a debug info entry's children when selectively printing entries. Optionally, provide--recurse-depthto limit the depth of children to diplay. Use in cases where information about parent DIE nodes is especially relevant or requested. Commonly used when displaying DIE nodes for functions and data types as child DIE nodes contain info about parameters, local variables, structure members, etc.dwarfdump --show-parents [--parent-recurse-depth=<n>]: Show a debug info entry's parents when selectively printing entries. Optionally provide--parent-recurse-depthto limit the depth of parents to display. Use in cases where information about parent DIE nodes is especially relevant or requested.dwarfdump --show-form: Show DWARF form types after the DWARF attribute types. Use to display more verbose DWARF information about the type of DWARF attributes.dwarfdump --find=<pattern>: Search for an exact match of the given name in the accelerator tables. This will not perform an exhaustive search over all DIE node. Use as an initial lookup for DIE nodes with specific names, but fall back to using--name <pattern>to perform an exhaustive search iffinddoes not find any DIE nodes with the given name.dwarfdump --name <pattern> [--ignore-case] [--regex]: Search for any DIE nodes whose name matches the given pattern. Optionally use--ignore-caseto perform a case-insensitive search and/or--regexto interpret the pattern as a regex for more complex searches. Performs an exhaustive search over all DIE nodes. Use to perform exhaustive lookup for exact name matches where--find=<pattern>fails or to search for more complex name via regex.dwarfdump --lookup=<address>: Find the DIE node at a specific address. Use to search for specific DIE nodes when their address is known, such as when gathering information about a DIE node referenced by some previously dumped DIE node.dwarfdump --verify: Verify a DWARF file. Use to check whether a DWARF file is well-formed.dwarfdump --verbose: Print more low-level encoding details. Use in cases where extra information is helpful for debugging.
Verification Options (llvm-dwarfdump)
These options are useful for validating DWARF data integrity:
llvm-dwarfdump --verify <binary>: Verify DWARF structure including compile unit chains, DIE relationships, and address ranges.llvm-dwarfdump --verify --error-display=<mode>: Control verification output detail. Modes:quiet(errors only),summary,details,full(errors with summary).llvm-dwarfdump --verify --verify-json=<path>: Output JSON-formatted error summary to file. Useful for CI integration.llvm-dwarfdump --statistics <binary>: Output debug info quality metrics as single-line JSON. Useful for comparing builds.llvm-dwarfdump --verify --quiet: Run verification without output to stdout (exit code indicates success/failure).
Searching DIE Nodes
In many cases it is necessary to search for specific DIE nodes (and their children and/or parents).
Simple Search
For simple cases such as name matches or exact address matches, prefer using dwarfdump with --lookup, --find, or --name.
Complex Search
In more complex cases cases, it may be necessary to perform custom searching over the output. For example, finding all DWARF parameter DIE nodes that have a particular type necessitates manually searching the dwarfdump output. In cases such a these, follow these steps:
| Step | Description | Example |
|---|---|---|
| Initial Filtering | Dump the entire DWARF file and use filtering tools, such as grep, to perform more complex filtering of the data. | `dwarfdump <file> \ |
| Get DIE Address | Get the address of any DIE node that match the search. This may require refinining the previous command to print more than just the matching line, such as using the grep -B <n> option to print n lines before the matching one to get the line with the address. | `dwarfdump <file> \ |
| Refine Filtering | Additional filtering may be required to narrow the search to DIE nodes of the desired type. In this case, additional filtering tools can be used to narrow the search further. | `dwarfdump <file> \ |
| Print Complete DWARF Info | Use dwarfdump --lookup=<address> (potentially with --show-children and/or --show-parents) for each matching DIE node's address to print information about them in a uniform format. |
Scripted Search
Sometimes, searching with filtering tools is too complex or produces inconsistent or incomplete results. In highly complex cases, such as searching for DIE nodes with multiple exact attribute values. In these cases, it is easiest to write a Python script leveraging the pyelftools package to parse and search DWARF files. Resort to this only if the filtering approach fails or becomes to complex.
Parsing ELF Files With readelf
readelf is a utility used to parse and dump ELF information from ELF files. It can be used to dump various ELF sections including DWARF sections.
Commonly Used Options
readelf --help: Display available options.readelf --debug-dump [debug_section]: Dump a particular DWARF section (e.g.addr,pubnames, etc). Can be specified multiple times to dump multiple sections.readelf --dwarf-depth=N: Do not display DIEs at depth N or greater.readelf --dwarf-start=N: Display DIE nodes starting at offset N.
Related skills
Forks & variants (1)
Dwarf Expert has 1 known copy in the catalog totaling 1 installs. They canonicalize to this original listing.
- sickn33 - 1 installs
How it compares
Pick dwarf-expert for interactive secure-coding guidance during smart-contract development; pick a dedicated scanner skill when you only need automated pre-deployment findings.
FAQ
When should I use dwarfdump vs readelf?
Use readelf for general ELF info; use dwarfdump for DWARF-specific parsing and dumping DIE nodes - dwarfdump is more effective at displaying complex DWARF information.
How do I verify DWARF data before shipping binaries?
Run llvm-dwarfdump --verify <binary> to check structural validity (compile units, DIE relationships, address ranges) and detect issues that cause debugger failures.
What DWARF versions does this skill support?
Expertise covers DWARF v3, v4, and v5. DWARF v1/v2 analysis is out of scope. Reference dwarfstd.org for official specification sections.
Is Dwarf Expert safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.