Crate addr2line [] [src]

This crate provides a cross-platform library and binary for translating addresses into 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, executables are loaded using Mapping::new, and users can the use Mapping::locate to find the corresponding file path and line number. If the Mapping was created with with_functions, Mapping::locate may also return information about the function containing the given address. addr2line avoids re-executing work where it can so that looking up multiple addresses for a single file does not require re-parsing the executable's debug symbols. The library makes heavy use of gimli, which provides zero-copy access to the DWARF debugging format used by most modern compilers.

The initial implementation of the library is heavily influenced by the original addr2line example in gimli, which was removed in 5da3e19dd4cfae30b82053868ed7ab3fdd3cf026 in favor of this repository.

This crate also provides a thing CLI wrapper around the library which provides some of the functionality of the addr2line command line tool distributed with GNU binutils. The executable or relocatable object to use is specified with the -e option. The default is the file a.out.



A BufferMapping locates and maintains the state necessary to perform address to line translation for a given buffer containing the executable file data.


The Error type.


A Mapping locates and maintains the state necessary to perform address to line translation.


A builder for configuring a Mapping or BufferMapping.



An error occured while traversing the debug symbols in the provided executable.


The kind of an error.



Additional methods for Result, for easy interaction with this crate.

Type Definitions


Convenient wrapper around std::Result.