Skip to content

Commit 2db84b9

Browse files
committed
Try something: do not call the previous hook
1 parent 2544cbf commit 2db84b9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

libdd-crashtracker/src/collector/crash_handler.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn register_panic_hook() -> anyhow::Result<()> {
107107
}
108108
}
109109
}
110-
call_previous_panic_hook(panic_info);
110+
//call_previous_panic_hook(panic_info);
111111
}));
112112
Ok(())
113113
}
@@ -120,6 +120,7 @@ pub fn register_panic_hook() -> anyhow::Result<()> {
120120
/// SAFETY:
121121
/// Crash-tracking functions are not guaranteed to be reentrant.
122122
/// No other crash-handler functions should be called concurrently.
123+
#[allow(dead_code)]
123124
fn call_previous_panic_hook(panic_info: &PanicHookInfo<'_>) {
124125
let old_hook_ptr = PREVIOUS_PANIC_HOOK.load(SeqCst);
125126
if !old_hook_ptr.is_null() {

libdd-crashtracker/src/crash_info/builder.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,25 @@ mod tests {
453453
assert_eq!(crash_ping.metadata(), &metadata);
454454
assert!(crash_ping.message().contains("crash processing started"));
455455
}
456+
457+
#[test]
458+
fn test_crash_info_builder_to_crash_ping_with_message() {
459+
let sig_info = SigInfo::test_instance(42);
460+
let metadata = Metadata::test_instance(1);
461+
let message = "test message";
462+
463+
let mut crash_info_builder = CrashInfoBuilder::new();
464+
crash_info_builder.with_sig_info(sig_info.clone()).unwrap();
465+
crash_info_builder.with_metadata(metadata.clone()).unwrap();
466+
crash_info_builder.with_kind(ErrorKind::Panic).unwrap();
467+
crash_info_builder.with_message(message.to_string()).unwrap();
468+
469+
let crash_ping = crash_info_builder.build_crash_ping().unwrap();
470+
471+
assert!(!crash_ping.crash_uuid().is_empty());
472+
assert!(Uuid::parse_str(crash_ping.crash_uuid()).is_ok());
473+
assert_eq!(crash_ping.siginfo(), Some(&sig_info));
474+
assert_eq!(crash_ping.metadata(), &metadata);
475+
assert!(crash_ping.message().contains("crash processing started - test message"));
476+
}
456477
}

0 commit comments

Comments
 (0)