minidump_processor/
lib.rs1#![cfg_attr(
20 feature = "http",
21 doc = r##"
22```rust
23use minidump::Minidump;
24use minidump_processor::ProcessorOptions;
25use minidump_unwind::{http_symbol_supplier, Symbolizer};
26use serde_json::Value;
27
28#[tokio::main]
29async fn main() -> Result<(), ()> {
30 // Read the minidump
31 let dump = Minidump::read_path("../testdata/test.dmp").map_err(|_| ())?;
32
33 // Configure the symbolizer and processor
34 let symbols_urls = vec![String::from("https://symbols.totallyrealwebsite.org")];
35 let symbols_paths = vec![];
36 let mut symbols_cache = std::env::temp_dir();
37 symbols_cache.push("minidump-cache");
38 let symbols_tmp = std::env::temp_dir();
39 let timeout = std::time::Duration::from_secs(1000);
40
41 // Use ProcessorOptions for detailed configuration
42 let options = ProcessorOptions::default();
43
44 // Specify a symbol supplier (here we're using the most powerful one, the http supplier)
45 let provider = Symbolizer::new(http_symbol_supplier(
46 symbols_paths,
47 symbols_urls,
48 symbols_cache,
49 symbols_tmp,
50 timeout,
51 ));
52
53 let state = minidump_processor::process_minidump_with_options(&dump, &provider, options)
54 .await
55 .map_err(|_| ())?;
56
57 // Write the JSON output to an arbitrary writer (here, a Vec).
58 let mut json_output = Vec::new();
59 state.print_json(&mut json_output, false).map_err(|_| ())?;
60
61 // Now parse it (here parsed into an arbitrary JSON Object for max flexibility).
62 let json: Value = serde_json::from_slice(&json_output).map_err(|_| ())?;
63
64 // Now read whatever values you want out of it
65 if let Some(Value::Number(pid)) = json.get("pid") {
66 println!("pid: {}", pid);
67 }
68
69 Ok(())
70}
71```
72"##
73)]
74#![doc = include_str!("../json-schema.md")]
81
82#[cfg(all(doctest, feature = "http"))]
83doc_comment::doctest!("../README.md");
84
85mod arg_recovery;
86mod evil;
87mod op_analysis;
88mod process_state;
89mod processor;
90
91pub use crate::process_state::*;
92pub use crate::processor::*;