Skip to content

Commit 9e2f58d

Browse files
committed
Adjust aarch64 error
1 parent aabdb23 commit 9e2f58d

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

crash-handler/src/linux/state.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{Error, Signal};
2-
use std::{mem, ops::DerefMut, ptr};
2+
use std::{mem, ptr};
33

44
// std::cmp::max is not const :(
55
const fn get_stack_size() -> usize {
@@ -438,6 +438,8 @@ impl HandlerInner {
438438
let mut cc = CRASH_CONTEXT.lock();
439439

440440
{
441+
use std::ops::DerefMut;
442+
#[allow(clippy::explicit_deref_methods)]
441443
ptr::write_bytes(cc.deref_mut(), 0, 1);
442444
debug_print!("zeroed crashctx");
443445

minidumper-test/src/lib.rs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ pub fn assert_minidump(md_buf: &[u8], signal: Signal) {
315315
($expected:pat) => {
316316
assert!(
317317
matches!(crash_reason, $expected),
318-
"crash reason: {:?}",
319-
crash_reason
318+
"crash reason: {crash_reason:?}",
320319
);
321320
};
322321
}
@@ -336,14 +335,27 @@ pub fn assert_minidump(md_buf: &[u8], signal: Signal) {
336335
));
337336
}
338337
Signal::Fpe => {
339-
verify!(CrashReason::LinuxSigfpe(
340-
errors::ExceptionCodeLinuxSigfpeKind::FPE_INTDIV
341-
));
338+
if cfg!(not(any(target_arch = "aarch64", target_arch = "arm"))) {
339+
verify!(CrashReason::LinuxSigfpe(
340+
errors::ExceptionCodeLinuxSigfpeKind::FPE_INTDIV
341+
));
342+
} else {
343+
verify!(CrashReason::LinuxGeneral(
344+
errors::ExceptionCodeLinux::SIGFPE,
345+
4294967290
346+
));
347+
}
342348
}
343349
Signal::Illegal => {
344-
verify!(CrashReason::LinuxSigill(
345-
errors::ExceptionCodeLinuxSigillKind::ILL_ILLOPN
346-
));
350+
if cfg!(not(any(target_arch = "aarch64", target_arch = "arm"))) {
351+
verify!(CrashReason::LinuxSigill(
352+
errors::ExceptionCodeLinuxSigillKind::ILL_ILLOPN
353+
));
354+
} else {
355+
verify!(CrashReason::LinuxSigill(
356+
errors::ExceptionCodeLinuxSigillKind::ILL_ILLOPC
357+
));
358+
}
347359
}
348360
Signal::Segv => {
349361
verify!(CrashReason::LinuxSigsegv(
@@ -362,10 +374,16 @@ pub fn assert_minidump(md_buf: &[u8], signal: Signal) {
362374
));
363375
}
364376
Signal::Trap => {
365-
verify!(CrashReason::LinuxGeneral(
366-
errors::ExceptionCodeLinux::SIGTRAP,
367-
_
368-
));
377+
if cfg!(not(any(target_arch = "aarch64", target_arch = "arm"))) {
378+
verify!(CrashReason::LinuxGeneral(
379+
errors::ExceptionCodeLinux::SIGTRAP,
380+
_
381+
));
382+
} else {
383+
verify!(CrashReason::LinuxSigtrap(
384+
errors::ExceptionCodeLinuxSigtrapKind::TRAP_BRKPT
385+
));
386+
}
369387
}
370388
#[cfg(windows)]
371389
Signal::Purecall | Signal::InvalidParameter | Signal::HeapCorruption => {

0 commit comments

Comments
 (0)