/// The full context for a Linux/Android crash #[repr(C)] #[derive(Clone)] pubstruct CrashContext { /// Crashing thread context. /// /// Note that we use [`crate::ucontext_t`] instead of [`libc::ucontext_t`] /// as libc's differs between glibc and musl <https://github.com/rust-lang/libc/pull/1646> /// even though the ucontext_t received from a signal will be the same /// regardless of the libc implementation used as it is only arch specific /// and not libc specific /// /// Note that we hide `ucontext_t::uc_link` as it is a pointer and thus can't /// be accessed in a process other than the one the `CrashContext` was created /// in. This is a just a self-reference so is not useful in practice. /// /// Note that the same applies to [`mcontext_t::fpregs`], but since that points /// to floating point registers and _is_ interesting to read in another process, /// those registers available as [`Self::float_state`], except on the `arm` /// architecture since they aren't part of `mcontext_t` at all. pub context: ucontext_t, /// State of floating point registers. /// /// This isn't part of the user ABI for Linux arm #[cfg(not(target_arch = "arm"))] pub float_state: fpregset_t, /// The signal info for the crash pub siginfo: libc::signalfd_siginfo, /// The id of the crashing process pub pid: libc::pid_t, /// The id of the crashing thread pub tid: libc::pid_t,
}
// Note you might see this defined in C with `unsigned long` or // `unsigned long long` and think, WTF, those aren't the same! Except // `long` means either 32-bit _or_ 64-bit depending on the data model, // and the default data model for C/C++ is LP64 which means long is // 64-bit. I had forgotten what a trash type long was. #[repr(C)] #[derive(Clone)] #[doc(hidden)] pubstruct mcontext_t { // Note in the kernel this is just part of regs which is length 32 pub fault_address: u64, pub regs: [u64; 31], pub sp: u64, pub pc: u64, pub pstate: u64, // Note that u128 is ABI safe on aarch64, this is actually a // `long double` in C which Rust doesn't have native support pub __reserved: [u128; 256],
}
/// Magic value written by the kernel and our custom getcontext #[doc(hidden)] pubconst FPSIMD_MAGIC: u32 = 0x46508001;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.