pub struct ExceptionInfo<'a>(/* private fields */);
Expand description
Information about an exception.
Implementations§
Source§impl ExceptionInfo<'_>
impl ExceptionInfo<'_>
Sourcepub unsafe fn new<'a>(
signo: c_int,
siginfo: *mut siginfo_t,
context: *mut c_void,
) -> ExceptionInfo<'a>
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.
Sourcepub fn into_owned(self) -> ExceptionInfo<'static>
pub fn into_owned(self) -> ExceptionInfo<'static>
Converts self
into a representation which owns its storage.
Sourcepub fn signo_raw(&self) -> c_int
pub fn signo_raw(&self) -> c_int
Returns the raw signal number which was passed to the signal handler.
Sourcepub fn signinfo_raw(&self) -> &siginfo_t
pub fn signinfo_raw(&self) -> &siginfo_t
Returns a reference to the raw siginfo_t
structure which was passed to
the signal handler.
Sourcepub fn context(&self) -> *mut c_void
pub fn context(&self) -> *mut c_void
Returns the context pointer which was passed to the signal handler.
Sourcepub fn addr(&self) -> *mut c_void
pub fn addr(&self) -> *mut c_void
Returns the address of the memory access which triggered the exception.
Sourcepub fn signal(&self) -> Result<Signal, UnsupportedSignalError>
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.
Sourcepub fn addr_lsb(&self) -> Option<c_short>
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
.
Sourcepub fn lower(&self) -> Option<*mut c_void>
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
.
Sourcepub fn upper(&self) -> Option<*mut c_void>
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
.
Sourcepub fn pkey(&self) -> Option<c_int>
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.
Sourcepub fn sp(&self) -> *mut c_void
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.
Sourcepub fn ip(&self) -> *mut c_void
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.
Sourcepub fn symbol_address(&self) -> *mut c_void
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>
impl<'a> Clone for ExceptionInfo<'a>
Source§fn clone(&self) -> ExceptionInfo<'a>
fn clone(&self) -> ExceptionInfo<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more