pub unsafe trait Unwind {
// Required methods
fn next_older_fp_from_fp_offset(&self) -> usize;
fn next_older_sp_from_fp_offset(&self) -> usize;
unsafe fn get_next_older_pc_from_fp(&self, fp: usize) -> usize;
fn assert_fp_is_aligned(&self, fp: usize);
}Expand description
Implementation necessary to unwind the stack, used by Backtrace.
§Safety
This trait is unsafe because the return values of each function are
required to be semantically correct when connected to the visit_frames
function below. Incorrect and/or arbitrary values in this trait will cause
unwinding to segfault or otherwise result in UB.
Required Methods§
Sourcefn next_older_fp_from_fp_offset(&self) -> usize
fn next_older_fp_from_fp_offset(&self) -> usize
Returns the offset, from the current frame pointer, of where to get to the previous frame pointer on the stack.
Sourcefn next_older_sp_from_fp_offset(&self) -> usize
fn next_older_sp_from_fp_offset(&self) -> usize
Returns the offset, from the current frame pointer, of the stack pointer of the next older frame.
Sourceunsafe fn get_next_older_pc_from_fp(&self, fp: usize) -> usize
unsafe fn get_next_older_pc_from_fp(&self, fp: usize) -> usize
Load the return address of a frame given the frame pointer for that frame.
§Safety
This function is expected to read raw memory from fp and thus is not
safe to operate on any value of fp passed in, instead it must be a
trusted Cranelift-defined frame pointer.
Sourcefn assert_fp_is_aligned(&self, fp: usize)
fn assert_fp_is_aligned(&self, fp: usize)
Debug assertion that the frame pointer is aligned.