Crate addr2line

source ·
Expand description

This crate provides a cross-platform library and binary for translating addresses into function names, file names and line numbers. Given an address in an executable or an offset in a section of a relocatable object, it uses the debugging information to figure out which file name and line number are associated with it.

When used as a library, files must first be loaded using the object crate. A context can then be created with Context::new. The context caches some of the parsed information so that multiple lookups are efficient. Location information is obtained with Context::find_location or Context::find_location_range. Function information is obtained with Context::find_frames, which returns a frame for each inline function. Each frame contains both name and location.

The crate has an example CLI wrapper around the library which provides some of the functionality of the addr2line command line tool distributed with GNU binutils.

Currently this library only provides information from the DWARF debugging information, which is parsed using gimli. The example CLI wrapper also uses symbol table information provided by the object crate.

Re-exports

pub extern crate gimli;

Structs

The state necessary to perform address to line translation.
A function frame.
An iterator over function frames.
A function name.
A source location.
Iterator over Locations in a range of addresses, returned by Context::find_location_range.

Functions

Demangle a symbol name using the demangling scheme for the given language.
Apply ‘best effort’ demangling of a symbol name.