5 releases (3 breaking)

0.4.1 Feb 26, 2022
0.4.0 Nov 4, 2020
0.3.0 Oct 13, 2019
0.2.0 Nov 20, 2017
0.1.0 Nov 7, 2017

#112 in Debugging

Download history 634/week @ 2022-06-01 430/week @ 2022-06-08 529/week @ 2022-06-15 536/week @ 2022-06-22 685/week @ 2022-06-29 533/week @ 2022-07-06 319/week @ 2022-07-13 413/week @ 2022-07-20 558/week @ 2022-07-27 527/week @ 2022-08-03 418/week @ 2022-08-10 607/week @ 2022-08-17 473/week @ 2022-08-24 545/week @ 2022-08-31 649/week @ 2022-09-07 257/week @ 2022-09-14

2,027 downloads per month
Used in 2 crates (via rstack)

MIT/Apache

44KB
986 lines

rstack

Documentation

Remote stack tracing.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

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

Dependencies

~240–680KB
~16K SLoC