[][src]Crate unwind

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};

Cursor::local(|mut cursor| {
    loop {
        let ip = cursor.register(RegNum::IP)?;

        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()? {
            break;
        }
    }

    Ok(())
}).unwrap();

Structs

Accessors

A collection of functions used to unwind an arbitrary process.

AddressSpace

An address space upon which unwinding can be performed.

AddressSpaceRef

A borrowed reference to an AddressSpace.

Byteorder

The byteorder of an address space.

Cursor

A cursor into a frame of a stack.

Error

An error returned from libunwind.

PTraceState

The unwind state used by the ptrace accessors.

PTraceStateRef

A borrowed reference to a PTraceState.

ProcedureInfo

Information about a procedure.

ProcedureName

The name of a procedure.

RegNum

An identifier of a processor register.

Type Definitions

Result

The result type returned by functions in this crate.