Expand description

An interface to libunwind.

libunwind provides access to the call chain of a process. It supports both local and remote processes.

Examples

Printing a backtrace of the current thread:

use unwind::{Cursor, RegNum, get_context};

get_context!(context);
let mut cursor = Cursor::local(context).unwrap();

loop {
    let ip = cursor.register(RegNum::IP).unwrap();

    match (cursor.procedure_info(), cursor.procedure_name()) {
        (Ok(ref info), Ok(ref name)) if ip == info.start_ip() + name.offset() => {
            println!(
                "{:#016x} - {} ({:#016x}) + {:#x}",
                ip,
                name.name(),
                info.start_ip(),
                name.offset()
            );
        }
        _ => println!("{:#016x} - ????", ip),
    }

    if !cursor.step().unwrap() {
        break;
    }
}

Macros

Creates a Context pinned to the stack.

Structs

A collection of functions used to unwind an arbitrary process.

An address space upon which unwinding can be performed.

A borrowed reference to an AddressSpace.

The byteorder of an address space.

A snapshot of the machine-state of a process.

A cursor into a frame of a stack.

An error returned from libunwind.

Information about a procedure.

The name of a procedure.

An identifier of a processor register.

Type Definitions

The result type returned by functions in this crate.