pub enum FrameInstPos {
Post,
Pre,
}
Expand description
An instruction position for a program point.
We attach debug metadata to a position on an offset in the text (code) section, either “post” or “pre”. The “post” position logically comes first, and is associated with the instruction that ends at this offset (i.e., the previous instruction). The “pre” position comes next, and is associated with the instruction that begins at this offset (i.e., the next instruction).
We make this distinction because metadata lookups sometimes occur with a PC that is after the instruction (e.g., the return address after a call instruction), and sometimes at the instruction (e.g., a trapping PC address). The lookup context will know which one to use – e.g., when walking the stack, “pre” for a trapping PC and “post” for every frame after that – so we simply encode it as part of the position and allow searching on it.
The need for this distinction can be understood by way of an example; say we have:
call ...
trapping_store ...
where both instructions have debug metadata. We might look up the
PC of trapping_store
once as we walk the stack from within the
call (we will get this PC because it is the return address) and
once when trapping_store
itself traps; and we want different
metadata in each case.
An alternative is to universally attach tags to the end offset of an instruction, which allows us to handle return addresses naturally but requires traps to adjust their PC. However, this requires trap handlers to know the length of the trapping instruction, which is not always easy – in the most general case, on variable-length instruction sets, it requires a full instruction decoder.
Variants§
Post
The “post” position at an offset attaches to the instruction that ends at this offset, i.e., came previously.
Pre
The “pre” position at an offset attaches to the instruction that begins at this offset, i.e., comes next.
Trait Implementations§
Source§impl Clone for FrameInstPos
impl Clone for FrameInstPos
Source§fn clone(&self) -> FrameInstPos
fn clone(&self) -> FrameInstPos
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FrameInstPos
impl Debug for FrameInstPos
Source§impl Hash for FrameInstPos
impl Hash for FrameInstPos
Source§impl PartialEq for FrameInstPos
impl PartialEq for FrameInstPos
impl Copy for FrameInstPos
impl Eq for FrameInstPos
impl StructuralPartialEq for FrameInstPos
Auto Trait Implementations§
impl Freeze for FrameInstPos
impl RefUnwindSafe for FrameInstPos
impl Send for FrameInstPos
impl Sync for FrameInstPos
impl Unpin for FrameInstPos
impl UnwindSafe for FrameInstPos
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.