Skip to main content

DebugFrameGuard

Struct DebugFrameGuard 

Source
pub struct DebugFrameGuard { /* private fields */ }
Expand description

A debug frame claimed from Rust, released when dropped.

Mirrors crate::shadow_stack::ShadowFrameGuard, and for the same reason: the two stacks must be popped together and in the reverse of the order they were pushed, and an RAII guard is what makes “pop one and not the other” unrepresentable from Rust.

Implementations§

Source§

impl DebugFrameGuard

Source

pub fn set(&mut self, index: usize, r: GcRef)

Record r as the current value of local index.

§Panics

If index is outside the frame. Writing another frame’s slot would make the other frame render a value it never held, which is not a condition the caller could detect afterwards.

Source

pub fn set_scalar(&mut self, index: usize, bits: u64)

Record the raw word bits as the current value of local index — the Rust-side equivalent of the store a definition of an elided box’s scalar emits (ADR-120 part 2).

Deliberately not typed as a ScalarValue: generated code writes one machine word and knows nothing about what it means, and a test that could only write a well-formed payload could not reproduce the state the collector has to survive — a slot whose word is an f64 bit pattern that happens to be a plausible heap address.

§Panics

If index is outside the frame, for DebugFrameGuard::set’s reason.

Source

pub fn set_scalar_payload( &mut self, index: usize, kind: DebugSlotKind, payload: u64, )

Record payload as local index’s value the way generated code does — biased by its slot kind (ADR-121 decision 2).

set_scalar’s counterpart, and the two exist for the two different questions a test can ask. That one writes a machine word and is what an adversarial state needs (a payload that is a plausible heap address). This one writes a payload and is what a round-trip needs: with the bias in place, a test that stores a raw word and expects DebugLocalMeta::read to answer it back is asserting that the encoding does not exist.

Source

pub fn values(&self) -> &[Option<GcRef>]

This frame’s value slots, as the crash snapshot reads them.

Trait Implementations§

Source§

impl Drop for DebugFrameGuard

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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> 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, 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.