minidump

Crates.iominidump
lib.rsminidump
version
sourcesrc
created_at2017-12-21 15:39:49.996398
updated_at2024-12-04 15:18:10.060806
descriptionA parser for the minidump format.
homepagehttps://github.com/rust-minidump/rust-minidump
repositoryhttps://github.com/rust-minidump/rust-minidump
max_upload_size
id43846
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
owners (github:rust-minidump:owners)

documentation

README

minidump

crates.io

Basic parsing of the minidump format.

If you want richer analysis of the minidump (such as stackwalking and symbolication), use minidump-processor.

Usage

The primary API for this library is the Minidump struct, which can be instantiated by calling the Minidump::read or Minidump::read_path methods.

Succesfully parsing a Minidump struct means the minidump has a minimally valid header and stream directory. Individual streams are only parsed when they're requested.

Although you may enumerate the streams in a minidump with methods like Minidump::all_streams, this is only really useful for debugging. Instead you should statically request streams with Minidump::get_stream.

Depending on what analysis you're trying to perform, you may:

  • Consider it an error for a stream to be missing (using ? or unwrap)
  • Branch on the presence of stream to conditionally refine your analysis
  • Use a stream's Default implementation to get an "empty" instance (with unwrap_or_default)
use minidump::*;

fn main() -> Result<(), Error> {
    // Read the minidump from a file
    let mut dump = minidump::Minidump::read_path("../testdata/test.dmp")?;

    // Statically request (and require) several streams we care about:
    let system_info = dump.get_stream::<MinidumpSystemInfo>()?;
    let exception = dump.get_stream::<MinidumpException>()?;

    // Combine the contents of the streams to perform more refined analysis
    let crash_reason = exception.get_crash_reason(system_info.os, system_info.cpu);

    // Conditionally analyze a stream
    if let Ok(threads) = dump.get_stream::<MinidumpThreadList>() {
        // Use `Default` to try to make progress when a stream is missing.
        // This is especially natural for MinidumpMemoryList because
        // everything needs to handle memory lookups failing anyway.
        let mem = dump.get_memory().unwrap_or_default();

        for thread in &threads.threads {
            let stack = thread.stack_memory(&mem);
            // ...
        }
    }
    Ok(())
}
Commit count: 1088

cargo fmt