Support for write_crash on netbsd (#788)

This commit is contained in:
David CARLIER 2022-09-27 22:37:50 +01:00 committed by GitHub
parent 6dc7cc2f59
commit be0ae3a55e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -387,12 +387,28 @@ fn write_crash<W: Write>(
Ok(()) Ok(())
} }
#[cfg(all(target_os = "netbsd", target_arch = "x86_64"))]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
ucontext: &ucontext_t,
) -> Result<(), std::io::Error> {
writeln!(
writer,
"Received signal {} at {:#016x}, fault address: {:#016x}",
signal, ucontext.uc_mcontext.__gregs[21], ucontext.uc_mcontext.__gregs[16]
)?;
Ok(())
}
#[cfg(not(any( #[cfg(not(any(
target_vendor = "apple", target_vendor = "apple",
target_os = "linux", target_os = "linux",
target_os = "android", target_os = "android",
target_os = "freebsd", target_os = "freebsd",
target_os = "openbsd" target_os = "openbsd",
target_os = "netbsd"
)))] )))]
fn write_crash<W: Write>( fn write_crash<W: Write>(
writer: &mut BufWriter<W>, writer: &mut BufWriter<W>,