Skip to content

Commit d7ad371

Browse files
committed
Ignore float state for now
1 parent 4dd9ee0 commit d7ad371

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

.github/workflows/rust-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ jobs:
4747
- uses: Swatinem/rust-cache@v2
4848
- run: cargo fetch
4949
- name: cargo test build
50-
run: cargo build --tests
50+
run: cargo build --tests --all-features
5151
- name: cargo test
52-
run: cargo test
52+
run: cargo test --all-features
5353

5454
build-android:
5555
name: Build sources

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ debug = 2
1313

1414
[workspace.dependencies]
1515
cfg-if = "1.0"
16-
crash-context = "0.6"
16+
crash-context = { version = "0.6", path = "crash-context" }
1717
libc = "0.2"
1818
mach2 = "0.4"
1919
parking_lot = "0.12"

crash-handler/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use error::Error;
99
#[macro_export]
1010
macro_rules! debug_print {
1111
($s:literal) => {
12-
let cstr = concat!($s, "\n");
12+
let cstr = concat!(file!(), ":", line!(), " ", $s, "\n");
1313
$crate::write_stderr(cstr);
1414
};
1515
}

crash-handler/src/linux/state.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,31 +430,37 @@ impl HandlerInner {
430430
// that we require
431431
let nix_info = &*((info as *const libc::siginfo_t).cast::<libc::signalfd_siginfo>());
432432

433+
debug_print!("acquired siginfo");
434+
433435
// Allow ourselves to be dumped, if that is what the user handler wishes to do
434436
let _set_dumpable = SetDumpable::new(self.dump_process);
437+
debug_print!("set dumpable");
435438
let mut crash_ctx = CRASH_CONTEXT.lock();
436439

437440
{
438441
*crash_ctx = mem::MaybeUninit::zeroed();
442+
debug_print!("zeroed crashctx");
439443
let cc = &mut *crash_ctx.as_mut_ptr();
440444

441445
ptr::copy_nonoverlapping(nix_info, &mut cc.siginfo, 1);
446+
debug_print!("copied siginfo");
442447

443448
let uc_ptr = &*(uc as *const libc::c_void).cast::<crash_context::ucontext_t>();
444449
ptr::copy_nonoverlapping(uc_ptr, &mut cc.context, 1);
450+
debug_print!("copied context");
445451

446452
cfg_if::cfg_if! {
447453
if #[cfg(target_arch = "aarch64")] {
448-
let fp_ptr = uc_ptr.uc_mcontext.__reserved.as_ptr().cast::<crash_context::fpsimd_context>();
454+
// let fp_ptr = uc_ptr.uc_mcontext.__reserved.as_ptr().cast::<crash_context::fpsimd_context>();
449455

450-
if (*fp_ptr).head.magic == crash_context::FPSIMD_MAGIC {
451-
ptr::copy_nonoverlapping(fp_ptr, &mut cc.float_state, 1);
452-
}
456+
// if (*fp_ptr).head.magic == crash_context::FPSIMD_MAGIC {
457+
// ptr::copy_nonoverlapping(fp_ptr, &mut cc.float_state, 1);
458+
// }
453459
} else if #[cfg(not(target_arch = "arm"))] {
454-
if !uc_ptr.uc_mcontext.fpregs.is_null() {
455-
ptr::copy_nonoverlapping(uc_ptr.uc_mcontext.fpregs, ((&mut cc.float_state) as *mut crash_context::fpregset_t).cast(), 1);
460+
// if !uc_ptr.uc_mcontext.fpregs.is_null() {
461+
// ptr::copy_nonoverlapping(uc_ptr.uc_mcontext.fpregs, ((&mut cc.float_state) as *mut crash_context::fpregset_t).cast(), 1);
456462

457-
}
463+
// }
458464
}
459465
}
460466

minidumper/src/ipc/server.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,17 @@ impl Server {
453453
) -> Result<LoopAction, Error> {
454454
let (mut minidump_file, minidump_path) = handler.create_minidump_file()?;
455455

456+
#[allow(unsafe_code)]
457+
let crash_context = minidump_writer::crash_context::CrashContext {
458+
inner: unsafe { std::mem::transmute_copy(&crash_context) },
459+
};
460+
456461
cfg_if::cfg_if! {
457462
if #[cfg(any(target_os = "linux", target_os = "android"))] {
458463
let mut writer =
459-
minidump_writer::minidump_writer::MinidumpWriter::new(crash_context.pid, crash_context.tid);
460-
writer.set_crash_context(minidump_writer::crash_context::CrashContext { inner: crash_context });
464+
minidump_writer::minidump_writer::MinidumpWriter::new(crash_context.inner.pid, crash_context.inner.tid);
465+
466+
writer.set_crash_context(crash_context);
461467
} else if #[cfg(target_os = "windows")] {
462468
// SAFETY: Unfortunately this is a bit dangerous since we are relying on the crashing process
463469
// to still be alive and still have the interior pointers in the crash context still at the

0 commit comments

Comments
 (0)