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
impl DebugFrameGuard
Sourcepub fn set(&mut self, index: usize, r: GcRef)
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.
Sourcepub fn set_scalar(&mut self, index: usize, bits: u64)
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.
Sourcepub fn set_scalar_payload(
&mut self,
index: usize,
kind: DebugSlotKind,
payload: u64,
)
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.