MCPcopy Create free account
hub / github.com/aclements/libelfin

github.com/aclements/libelfin @v0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3 ↗ · + Follow
347 symbols 656 edges 29 files 92 documented · 27% updated 2y agov0.3 · 2016-12-03★ 34335 open issues

Browse by type

Functions 229 Types & classes 118
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Libelfin is a from-scratch C++11 library for reading ELF binaries and DWARFv4 debug information.

Quick start

make, and optionally make install. You'll need GCC 4.7 or later.

Features

  • Native C++11 code and interface, designed from scratch to interact well with C++11 features, from range-based for loops to move semantics to enum classes.

  • Libelfin fully implements parsing for Debugging Information Entries (DIEs), the core data structure used by the DWARF format, as well as most DWARFv4 tables.

  • Supports all DWARFv4 DIE value types except location lists and macros.

  • Nearly complete evaluator for DWARFv4 expressions and location descriptions.

  • Complete interpreter for DWARFv4 line tables.

  • Iterators for easily and naturally traversing compilation units, type units, DIE trees, and DIE attribute lists.

  • Every enum value can be pretty-printed.

  • Large collection of type-safe DIE attribute fetchers.

Non-features

Libelfin implements a syntactic layer for DWARF and ELF, but not a semantic layer. Interpreting the information stored in DWARF DIE trees still requires a great deal of understanding of DWARF, but libelfin will make sense of the bytes for you.

Using libelfin

To build against libdwarf++, use, for example

g++ -std=c++11 a.cc $(pkg-config --cflags --libs libdwarf++)

To use a local build of libelfin, set PKG_CONFIG_PATH. For example,

export PKG_CONFIG_PATH=$PWD/elf:$PWD/dwarf

There are various example programs in examples/.

Status

Libelfin is a good start. It's not production-ready and there are many parts of the DWARF specification it does not yet implement, but it's complete enough to be useful for many things and is a good deal more pleasant to use than every other debug info library I've tried.

Core symbols most depended-on inside this repo

Shape

Method 173
Class 85
Function 56
Enum 33

Languages

C++97%
Python2%
C1%

Modules by API surface

dwarf/dwarf++.hh90 symbols
elf/data.hh41 symbols
elf/elf++.hh32 symbols
dwarf/internal.hh24 symbols
dwarf/data.hh19 symbols
dwarf/value.cc14 symbols
elf/elf.cc13 symbols
dwarf/small_vector.hh13 symbols
dwarf/line.cc13 symbols
dwarf/dwarf.cc12 symbols
dwarf/die.cc11 symbols
dwarf/die_str_map.cc9 symbols

For agents

$ claude mcp add libelfin \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page