Struct ExceptionInfo

Source
pub struct ExceptionInfo<'a>(/* private fields */);
Expand description

Information about an exception.

Implementations§

Source§

impl ExceptionInfo<'_>

Source

pub unsafe fn new<'a>( signo: c_int, siginfo: *mut siginfo_t, context: *mut c_void, ) -> ExceptionInfo<'a>

Construct from arguments passed to a POSIX signal handler.

§Safety

The caller must ensure the validity of the pointers and limit the lifetime of the ExceptionInfo structure to that of the pointers. On platforms which have a ucontext_t type, context must point to one or else be NULL.

Source

pub fn into_owned(self) -> ExceptionInfo<'static>

Converts self into a representation which owns its storage.

Source

pub fn signo_raw(&self) -> c_int

Returns the raw signal number which was passed to the signal handler.

Source

pub fn signinfo_raw(&self) -> &siginfo_t

Returns a reference to the raw siginfo_t structure which was passed to the signal handler.

Source

pub fn context(&self) -> *mut c_void

Returns the context pointer which was passed to the signal handler.

Source

pub fn signo(&self) -> Signo

Returns the type of signal which triggered this exception.

Source

pub fn addr(&self) -> *mut c_void

Returns the address of the memory access which triggered the exception.

Source

pub fn signal(&self) -> Result<Signal, UnsupportedSignalError>

Returns the type of signal which triggered this exception along with its associated subtype.

This method is guaranteed to succeed when called on an ExceptionInfo which was passed to a registered hook by a signal handler which was installed by this crate.

Source

pub fn addr_lsb(&self) -> Option<c_short>

For SIGBUS signals of subtype MCEERR_AO or MCEERR_AR, this returns an indication the least significant bit of the reported address and therefore the extent of the corruption. For example, if a full page is corrupted, this returns log2(sysconf(_SC_PAGESIZE)).

For all other signals and subtypes, this returns None.

Source

pub fn lower(&self) -> Option<*mut c_void>

For SIGSEGV signals of subtype BNDERR, this returns the lower bound of the failed bounds check. Otherwise it returns None.

Source

pub fn upper(&self) -> Option<*mut c_void>

For SIGSEGV signals of subtype BNDERR, this returns the upper bound of the failed bounds check. Otherwise it returns None.

Source

pub fn pkey(&self) -> Option<c_int>

For SIGSEGV signals of subtype PKUERR, this returns the protection key on the page table entry (PTE) which caused the exception.

Source

pub fn sp(&self) -> *mut c_void

Returns the contents of the stack pointer register at the time of the exception.

Not supported on all platforms. If unsupported, returns null. Adding support for new platforms is usually straightforward; please file an issue if you want something added.

Source

pub fn ip(&self) -> *mut c_void

Returns the address of the instruction which triggered the exception.

Not supported on all platforms. If unsupported, returns null. Adding support for new platforms is usually straightforward; please file an issue if you want something added.

Source

pub fn symbol_address(&self) -> *mut c_void

Returns the starting symbol address of the function which triggered the exception.

Not supported on all platforms. If unsupported, returns null. Adding support for new platforms is usually straightforward; please file an issue if you want something added.

Trait Implementations§

Source§

impl<'a> Clone for ExceptionInfo<'a>

Source§

fn clone(&self) -> ExceptionInfo<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ExceptionInfo<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ExceptionInfo<'_>> for ExtExceptionInfo

Source§

fn from(info: ExceptionInfo<'_>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for ExceptionInfo<'a>

§

impl<'a> RefUnwindSafe for ExceptionInfo<'a>

§

impl<'a> !Send for ExceptionInfo<'a>

§

impl<'a> !Sync for ExceptionInfo<'a>

§

impl<'a> Unpin for ExceptionInfo<'a>

§

impl<'a> UnwindSafe for ExceptionInfo<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.