10个版本 (6个重大变更)

0.22.0 2024年7月3日
0.21.1 2024年3月1日
0.19.1 2023年11月2日
0.17.0 2023年5月17日

#339调试

Download history 2368/week @ 2024-04-15 1678/week @ 2024-04-22 2545/week @ 2024-04-29 1535/week @ 2024-05-06 2125/week @ 2024-05-13 2305/week @ 2024-05-20 1553/week @ 2024-05-27 2471/week @ 2024-06-03 1919/week @ 2024-06-10 1977/week @ 2024-06-17 1564/week @ 2024-06-24 1281/week @ 2024-07-01 1887/week @ 2024-07-08 1765/week @ 2024-07-15 1825/week @ 2024-07-22 1704/week @ 2024-07-29

7,288 每月下载量
用于 6 个crate(5个直接使用)

MIT 许可证

1.5MB
25K SLoC

minidump-unwind

crates.io

一个用于从minidump文件中展开和生成堆栈跟踪的库。此crate提供了用于生成minidump中线程的符号化堆栈跟踪的API。主要入口点是 walk_stack 函数。

如果您想访问minidump内容的高级访问,请使用 minidump crate。

如果您想在此crate之上构建高级功能,请参阅 minidump-processor

示例用法

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

依赖项

~7–22MB
~404K SLoC