dwarf-expert
Provides expertise for analyzing DWARF debug files and understanding the DWARF debug format/standard (v3-v5). Triggers when understanding DWARF information, interacting with DWARF files, answering DWARF-related questions, or working with code that parses DWARF data.
About this skill
This skill equips an AI agent with comprehensive technical knowledge and expertise concerning the DWARF (Debugging With Arbitrary Record Formats) debug standard, covering versions 3 through 5. It enables the agent to analyze DWARF debug files, interpret DWARF information, and interact with the format effectively. Key capabilities include answering complex questions about the DWARF standard, providing examples of various DWARF features, assisting with parsing and/or creating DWARF files, and supporting the development, modification, or analysis of code that processes DWARF data. It's an invaluable tool for developers working on low-level system debugging, compilers, linkers, and reverse engineering.
Best use case
Debugging compiled binaries, reverse engineering, low-level program analysis, compiler and linker development, toolchain support, understanding memory layouts, optimizing debug information, and stack unwinding.
Provides expertise for analyzing DWARF debug files and understanding the DWARF debug format/standard (v3-v5). Triggers when understanding DWARF information, interacting with DWARF files, answering DWARF-related questions, or working with code that parses DWARF data.
Clear and accurate explanations of DWARF concepts, parsed DWARF data structures from files, code examples for DWARF interaction, troubleshooting guidance for DWARF-related issues, or assistance in interpreting complex debug information from binaries, leading to better understanding and resolution of low-level software problems.
Practical example
Example input
Explain the structure of a DWARF .debug_info section and how to find the source file and line number for a specific program counter address using DWARF v4. Then, use available tools to demonstrate how I'd extract this for an executable named `my_program`.
Example output
The `.debug_info` section contains Compilation Units (CUs), each describing a source file. Within a CU, Debugging Information Entries (DIEs) form a hierarchical tree representing types, variables, functions, and lexical blocks. Each DIE has a tag (e.g., `DW_TAG_compile_unit`, `DW_TAG_subprogram`) and attributes (e.g., `DW_AT_name`, `DW_AT_decl_file`, `DW_AT_low_pc`, `DW_AT_high_pc`). To find source info for a PC in DWARF v4: 1. **Locate the PC range:** Identify the `DW_TAG_subprogram` (function) or `DW_TAG_lexical_block` (scope) DIE that encloses your Program Counter (PC) address using `DW_AT_low_pc` and `DW_AT_high_pc` or `DW_AT_ranges` attributes. 2. **Consult `.debug_line`:** Once the relevant DIE is found, determine its associated `DW_AT_stmt_list` which points to an entry in the `.debug_line` section. The `.debug_line` section contains a state machine program that maps PC addresses to source file and line numbers. **Demonstration for `my_program` (hypothetical agent action):** *Agent:* I will use `Read` and `Bash` to examine the DWARF sections of `my_program`. First, I'll use `objdump -Wi my_program` to get a high-level view, and then `readelf --debug-dump=line my_program` for line information if needed. If I had a specific PC address, I'd then `Grep` for it in the detailed output. *Agent Output:* (Example of interpreted output) `... <0x12345678>:` ` DW_TAG_subprogram` ` DW_AT_name : "main"` ` DW_AT_decl_file : 1 (/home/user/src/my_program.c)` ` DW_AT_decl_line : 10` ` DW_AT_low_pc : 0x401200` ` DW_AT_high_pc : 0x401250` *(Interpretation):* "Based on the DWARF information, the address 0x12345678 falls within the `main` function, which is declared in `/home/user/src/my_program.c` at line 10. Further detailed line information would be available in the `.debug_line` section for precise PC-to-line mapping."
When to use this skill
- When you need to understand symbol tables, stack traces, variable locations, or type information in compiled code. When investigating crashes, memory corruption, or undefined behavior in C/C++/Rust applications. When writing, debugging, or analyzing tools that process debug information. When generating or interpreting DWARF sections in executable files or shared libraries. When querying specific details about how source code maps to machine code.
When not to use this skill
- For high-level language debugging where DWARF is not the underlying debug format (e.g., purely managed code without native compilation). For general programming tasks unrelated to compiled code, debug information, or low-level binary analysis. For tasks that do not involve system-level debugging or reverse engineering compiled software.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/dwarf-expert/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How dwarf-expert Compares
| Feature / Agent | dwarf-expert | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
Provides expertise for analyzing DWARF debug files and understanding the DWARF debug format/standard (v3-v5). Triggers when understanding DWARF information, interacting with DWARF files, answering DWARF-related questions, or working with code that parses DWARF data.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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 `dwarfdump` or `readelf` to 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 access
- `DWARFUnit.cpp` - Compilation unit parsing
- `DWARFDebugLine.cpp` - Line number information
- `DWARFVerifier.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
```bash
# 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
```bash
# 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 `--statistics` to 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)
```Related Skills
mermaid-expert
Create Mermaid diagrams for flowcharts, sequences, ERDs, and architectures. Masters syntax for all diagram types and styling.
drizzle-orm-expert
Expert in Drizzle ORM for TypeScript — schema design, relational queries, migrations, and serverless database integration. Use when building type-safe database layers with Drizzle.
n8n-expression-syntax
Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, or working with webhook data in workflows.
mcp-builder-ms
Use this skill when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
makepad-deployment
CRITICAL: Use for Makepad packaging and deployment. Triggers on: deploy, package, APK, IPA, 打包, 部署, cargo-packager, cargo-makepad, WASM, Android, iOS, distribution, installer, .deb, .dmg, .nsis, GitHub Actions, CI, action, marketplace
macos-menubar-tuist-app
Build, refactor, or review SwiftUI macOS menubar apps that use Tuist.
kaizen
Guide for continuous improvement, error proofing, and standardization. Use this skill when the user wants to improve code quality, refactor, or discuss process improvements.
issues
Interact with GitHub issues - create, list, and view issues.
hugging-face-tool-builder
Your purpose is now is to create reusable command line scripts and utilities for using the Hugging Face API, allowing chaining, piping and intermediate processing where helpful. You can access the API directly, as well as use the hf command line tool.
git-pushing
Stage all changes, create a conventional commit, and push to the remote branch. Use when explicitly asks to push changes ("push this", "commit and push"), mentions saving work to remote ("save to github", "push to remote"), or completes a feature and wants to share it.
git-hooks-automation
Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint. Automate code quality gates, formatting, linting, and commit message enforcement before code reaches CI.
gh-review-requests
Fetch unread GitHub notifications for open PRs where review is requested from a specified team or opened by a team member. Use when asked to "find PRs I need to review", "show my review requests", "what needs my review", "fetch GitHub review requests", or "check team review queue".