Struct addr2line::Mapping
[−]
[src]
pub struct Mapping { /* fields omitted */ }
A Mapping
locates and maintains the state necessary to perform address to line translation.
Constructing a Mapping
is somewhat costly, so users should aim to re-use created Mapping
s
when performing lookups for many addresses over the same executable.
Methods
impl Mapping
[src]
fn with_functions(file_path: &Path) -> Result<Mapping>
Construct a new Mapping
from the debug symbols in the given executable.
The target file will be memmap'd, and then gimli
is used to parse out the necessary debug
symbols, without copying data when possible.
The returned Mapping
will also include debug information for functions, enabling
Mapping::locate()
to also indicate what function a given address appears in. This comes
at some parsing and lookup cost.
fn new(file_path: &Path) -> Result<Mapping>
Construct a new Mapping
from the debug symbols in the given executable.
The target file will be memmap'd, and then gimli
is used to parse out the necessary debug
symbols, without copying data when possible.
Note that this constructor will not include function mapping information, and thus
Mapping::locate()
will always return None
for the function mapping of addresses.
fn locate(&self,
addr: u64)
-> Result<Option<(PathBuf, Option<u64>, Option<Cow<str>>)>>
addr: u64)
-> Result<Option<(PathBuf, Option<u64>, Option<Cow<str>>)>>
Locate the source file and line corresponding to the given virtual memory address.
If the Mapping
was constructed with with_functions
, information about the containing
function may also be returned when available.