minidump-unwind

Crates.iominidump-unwind
lib.rsminidump-unwind
version
sourcesrc
created_at2023-05-17 09:25:37.387426
updated_at2024-12-04 15:18:28.863163
descriptionA library for producing stack traces from minidump files.
homepagehttps://github.com/rust-minidump/rust-minidump
repositoryhttps://github.com/rust-minidump/rust-minidump
max_upload_size
id866807
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Gabriele Svelto (gabrielesvelto)

documentation

README

minidump-unwind

crates.io

A library for unwinding and producing stack traces from minidump files. This crate provides APIs for producing symbolicated stack traces for the threads in a minidump. The primary entrypoint is the walk_stack function.

If you want lower-level access to the minidump's contents, use the minidump crate.

If you want higher-level functionality build on top of this crate, see minidump-processor.

Example Usage

use minidump::{
    Minidump, MinidumpException, MinidumpMiscInfo, MinidumpModuleList, MinidumpSystemInfo,
    UnifiedMemoryList
};
use minidump_unwind::{CallStack, http_symbol_supplier, Symbolizer, SystemInfo, walk_stack};

#[tokio::main]
async fn main() {
    // Read the minidump
    let dump = Minidump::read_path("../testdata/test.dmp").unwrap();

    // Configure the symbolizer and processor
    let symbols_urls = vec![String::from("https://symbols.totallyrealwebsite.org")];
    let symbols_paths = vec![];
    let mut symbols_cache = std::env::temp_dir();
    symbols_cache.push("minidump-cache");
    let symbols_tmp = std::env::temp_dir();
    let timeout = std::time::Duration::from_secs(1000);

    // Specify a symbol supplier (here we're using the most powerful one, the http supplier)
    let provider = Symbolizer::new(http_symbol_supplier(
        symbols_paths,
        symbols_urls,
        symbols_cache,
        symbols_tmp,
        timeout,
    ));

    let system_info: MinidumpSystemInfo = dump.get_stream().unwrap();
    let misc_info: Option<MinidumpMiscInfo> = dump.get_stream().ok();
    let modules: MinidumpModuleList = dump.get_stream().unwrap();
    let exception: MinidumpException = dump.get_stream().unwrap();
    let exception_context = exception.context(&system_info, misc_info.as_ref()).unwrap();
    let memory_list = dump.get_stream().map(UnifiedMemoryList::Memory)
        .or_else(|_| dump.get_stream().map(UnifiedMemoryList::Memory64))
        .unwrap();

    let stack_memory = memory_list.memory_at_address(exception_context.get_stack_pointer());

    let mut stack = CallStack::with_context(exception_context.into_owned());

    walk_stack(
        0,
        (),
        &mut stack,
        stack_memory,
        &modules,
        &SystemInfo {
            os: system_info.os,
            os_version: None,
            os_build: None,
            cpu: system_info.cpu,
            cpu_info: system_info.cpu_info().map(|info| info.into_owned()),
            cpu_microcode_version: None,
            cpu_count: 1,
        },
        &provider,
    ).await;

    for frame in stack.frames {
        println!("{:?}", frame);
    }
}
Commit count: 1088

cargo fmt