[][src]Function backtrace::resolve

pub fn resolve<F: FnMut(&Symbol)>(addr: *mut c_void, cb: F)

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).

Note that if you have a Frame then it's recommended to use the resolve_frame function instead of this one.

Required features

This function requires the std feature of the backtrace crate to be enabled, and the std feature is enabled by default.

Example

extern crate backtrace;

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

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

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