Function backtracer_core::resolve[][src]

pub fn resolve<F: FnMut(&Symbol)>(
    ctxt: Option<&Context<EndianRcSlice<RunTimeEndian>>>,
    offset: u64,
    addr: *mut u8,
    cb: F
) -> Result<(), Error>
Expand description

Resolve an address to a symbol, passing the symbol to the specified closure.

This function will look up the given address in areas such as the local symbol table, dynamic symbol table, or DWARF debug info (depending on the activated implementation) to find symbols to yield.

The closure may not be called if resolution could not be performed, and it also may be called more than once in the case of inlined functions.

Symbols yielded represent the execution at the specified addr, returning file/line pairs for that address (if available).

Example

extern crate backtrace;

fn main() {
    backtrace::trace(|frame| {
        let ip = frame.ip();

        backtrace::resolve(ip, |symbol| {
            // ...
        });

        false // only look at the top frame
    });
}