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::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
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.
The Error type.
An error occured while traversing the debug symbols in the provided executable.
The kind of an error.
Additional methods for
Convenient wrapper around