6 releases (3 breaking)

0.4.2 Dec 22, 2023
0.4.1 Feb 26, 2022
0.4.0 Nov 4, 2020
0.3.0 Oct 13, 2019
0.1.0 Nov 7, 2017

#695 in Debugging

Download history 1421/week @ 2023-12-23 2804/week @ 2023-12-30 3803/week @ 2024-01-06 3909/week @ 2024-01-13 3951/week @ 2024-01-20 4386/week @ 2024-01-27 4838/week @ 2024-02-03 5083/week @ 2024-02-10 5338/week @ 2024-02-17 4117/week @ 2024-02-24 4615/week @ 2024-03-02 4884/week @ 2024-03-09 5074/week @ 2024-03-16 3693/week @ 2024-03-23 4351/week @ 2024-03-30 3419/week @ 2024-04-06

17,310 downloads per month
Used in 4 crates (2 directly)

MIT/Apache

48KB
1K SLoC

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

~0.3–0.8MB
~20K SLoC