# Function backtrace::trace [−] [src]

    pub fn trace<F: FnMut(&Frame) -> bool>(cb: F)

Inspects the current call-stack, passing all active frames into the closure provided to calculate a stack trace.

This function is the workhorse of this library in calculating the stack traces for a program. The given closure `cb` is yielded instances of a `Frame` which represent information about that call frame on the stack. The closure is yielded frames in a top-down fashion (most recently called functions first).

The closure's return value is an indication of whether the backtrace should continue. A return value of `false` will terminate the backtrace and return immediately.

Once a `Frame` is acquired you will likely want to call `backtrace::resolve` to convert the `ip` (instruction pointer) or symbol address to a `Symbol` through which the name and/or filename/line number can be learned.

Note that this is a relatively low-level function and if you'd like to, for example, capture a backtrace to be inspected later, then the `Backtrace` type may be more appropriate.

# Example

    extern crate backtrace;

    fn main() {
        backtrace::trace(|frame| {
            // ...

            true // continue the backtrace
        });
    }

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)