libdd_crashtracker/crash_info/
ucontext.rs1use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
10pub struct Ucontext {
11 pub arch: String,
13 pub registers: HashMap<String, String>,
15 #[serde(default, skip_serializing_if = "Option::is_none")]
18 pub raw: Option<String>,
19}
20
21#[cfg(test)]
22impl Ucontext {
23 pub fn test_instance(_seed: u64) -> Self {
24 Self {
25 arch: "x86_64".to_string(),
26 registers: HashMap::from([
27 ("rip".to_string(), "0x00007f7e11d3a2b0".to_string()),
28 ("rsp".to_string(), "0x00007f7e11d3a2b0".to_string()),
29 ("rbp".to_string(), "0x00007f7e11d3a2b0".to_string()),
30 ("rax".to_string(), "0x00007f7e11d3a2b0".to_string()),
31 ("rbx".to_string(), "0x00007f7e11d3a2b0".to_string()),
32 ("rcx".to_string(), "0x00007f7e11d3a2b0".to_string()),
33 ]),
34 raw: Some("ucontext_t { uc_flags: 7, uc_link: 0x0, uc_stack: stack_t { ss_sp: 0x713fa26f1000, ss_flags: 0, ss_size: 65536 } }".to_string()),
35 }
36 }
37}