Crate addr2line

source ·
Expand description

addr2line provides a cross-platform library for retrieving per-address debug information from files with DWARF debug information. Given an address, it can return the file name, line number, and function name associated with that address, as well as the inline call stack leading to that address.

At the lowest level, the library uses a Context to cache parsed information so that multiple lookups are efficient. To create a Context, you first need to open and parse the file using an object file parser such as object, create a gimli::Dwarf, and finally call Context::from_dwarf.

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 library also provides a Loader which internally memory maps the files, uses the object crate to do the parsing, and creates a Context. The Context is not exposed, but the Loader provides the same functionality via Loader::find_location, Loader::find_location_range, and Loader::find_frames. The Loader also provides Loader::find_symbol to use the symbol table instead of DWARF debugging information. The Loader will load Mach-O dSYM files and split DWARF files as needed.

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



  • The state necessary to perform address to line translation.
  • A function frame.
  • An iterator over function frames.
  • A function name.
  • A loader for the DWARF data required for a Context.
  • A source location.
  • Iterator over Locations in a range of addresses, returned by Context::find_location_range.
  • This struct contains the information needed to find split DWARF data and to produce a gimli::Dwarf<R> for it.


  • Operations that consult debug information may require additional files to be loaded if split DWARF is being used. This enum returns the result of the operation in the Output variant, or information about the split DWARF that is required and a continuation to invoke once it is available in the Load variant.


  • This trait represents a partially complete operation that can be resumed once a load of needed split DWARF data is completed or abandoned by the API consumer.


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

Type Aliases§