Enum gimli::read::Operation

source ·
pub enum Operation<R, Offset = <R as Reader>::Offset>
where R: Reader<Offset = Offset>, Offset: ReaderOffset,
{
Show 53 variants Deref { base_type: UnitOffset<Offset>, size: u8, space: bool, }, Drop, Pick { index: u8, }, Swap, Rot, Abs, And, Div, Minus, Mod, Mul, Neg, Not, Or, Plus, PlusConstant { value: u64, }, Shl, Shr, Shra, Xor, Bra { target: i16, }, Eq, Ge, Gt, Le, Lt, Ne, Skip { target: i16, }, UnsignedConstant { value: u64, }, SignedConstant { value: i64, }, Register { register: Register, }, RegisterOffset { register: Register, offset: i64, base_type: UnitOffset<Offset>, }, FrameOffset { offset: i64, }, Nop, PushObjectAddress, Call { offset: DieReference<Offset>, }, TLS, CallFrameCFA, Piece { size_in_bits: u64, bit_offset: Option<u64>, }, ImplicitValue { data: R, }, StackValue, ImplicitPointer { value: DebugInfoOffset<Offset>, byte_offset: i64, }, EntryValue { expression: R, }, ParameterRef { offset: UnitOffset<Offset>, }, Address { address: u64, }, AddressIndex { index: DebugAddrIndex<Offset>, }, ConstantIndex { index: DebugAddrIndex<Offset>, }, TypedLiteral { base_type: UnitOffset<Offset>, value: R, }, Convert { base_type: UnitOffset<Offset>, }, Reinterpret { base_type: UnitOffset<Offset>, }, WasmLocal { index: u32, }, WasmGlobal { index: u32, }, WasmStack { index: u32, },
}
Expand description

A single decoded DWARF expression operation.

DWARF expression evaluation is done in two parts: first the raw bytes of the next part of the expression are decoded; and then the decoded operation is evaluated. This approach lets other consumers inspect the DWARF expression without reimplementing the decoding operation.

Multiple DWARF opcodes may decode into a single Operation. For example, both DW_OP_deref and DW_OP_xderef are represented using Operation::Deref.

Variants§

§

Deref

Dereference the topmost value of the stack.

Fields

§base_type: UnitOffset<Offset>

The DIE of the base type or 0 to indicate the generic type

§size: u8

The size of the data to dereference.

§space: bool

True if the dereference operation takes an address space argument from the stack; false otherwise.

§

Drop

Drop an item from the stack.

§

Pick

Pick an item from the stack and push it on top of the stack. This operation handles DW_OP_pick, DW_OP_dup, and DW_OP_over.

Fields

§index: u8

The index, from the top of the stack, of the item to copy.

§

Swap

Swap the top two stack items.

§

Rot

Rotate the top three stack items.

§

Abs

Take the absolute value of the top of the stack.

§

And

Bitwise and of the top two values on the stack.

§

Div

Divide the top two values on the stack.

§

Minus

Subtract the top two values on the stack.

§

Mod

Modulus of the top two values on the stack.

§

Mul

Multiply the top two values on the stack.

§

Neg

Negate the top of the stack.

§

Not

Bitwise not of the top of the stack.

§

Or

Bitwise or of the top two values on the stack.

§

Plus

Add the top two values on the stack.

§

PlusConstant

Add a constant to the topmost value on the stack.

Fields

§value: u64

The value to add.

§

Shl

Logical left shift of the 2nd value on the stack by the number of bits given by the topmost value on the stack.

§

Shr

Right shift of the 2nd value on the stack by the number of bits given by the topmost value on the stack.

§

Shra

Arithmetic left shift of the 2nd value on the stack by the number of bits given by the topmost value on the stack.

§

Xor

Bitwise xor of the top two values on the stack.

§

Bra

Branch to the target location if the top of stack is nonzero.

Fields

§target: i16

The relative offset to the target bytecode.

§

Eq

Compare the top two stack values for equality.

§

Ge

Compare the top two stack values using >=.

§

Gt

Compare the top two stack values using >.

§

Le

Compare the top two stack values using <=.

§

Lt

Compare the top two stack values using <.

§

Ne

Compare the top two stack values using !=.

§

Skip

Unconditional branch to the target location.

Fields

§target: i16

The relative offset to the target bytecode.

§

UnsignedConstant

Push an unsigned constant value on the stack. This handles multiple DWARF opcodes.

Fields

§value: u64

The value to push.

§

SignedConstant

Push a signed constant value on the stack. This handles multiple DWARF opcodes.

Fields

§value: i64

The value to push.

§

Register

Indicate that this piece’s location is in the given register.

Completes the piece or expression.

Fields

§register: Register

The register number.

§

RegisterOffset

Find the value of the given register, add the offset, and then push the resulting sum on the stack.

Fields

§register: Register

The register number.

§offset: i64

The offset to add.

§base_type: UnitOffset<Offset>

The DIE of the base type or 0 to indicate the generic type

§

FrameOffset

Compute the frame base (using DW_AT_frame_base), add the given offset, and then push the resulting sum on the stack.

Fields

§offset: i64

The offset to add.

§

Nop

No operation.

§

PushObjectAddress

Push the object address on the stack.

§

Call

Evaluate a DWARF expression as a subroutine. The expression comes from the DW_AT_location attribute of the indicated DIE.

Fields

§offset: DieReference<Offset>

The DIE to use.

§

TLS

Compute the address of a thread-local variable and push it on the stack.

§

CallFrameCFA

Compute the call frame CFA and push it on the stack.

§

Piece

Terminate a piece.

Fields

§size_in_bits: u64

The size of this piece in bits.

§bit_offset: Option<u64>

The bit offset of this piece. If None, then this piece was specified using DW_OP_piece and should start at the next byte boundary.

§

ImplicitValue

The object has no location, but has a known constant value.

Represents DW_OP_implicit_value. Completes the piece or expression.

Fields

§data: R

The implicit value to use.

§

StackValue

The object has no location, but its value is at the top of the stack.

Represents DW_OP_stack_value. Completes the piece or expression.

§

ImplicitPointer

The object is a pointer to a value which has no actual location, such as an implicit value or a stack value.

Represents DW_OP_implicit_pointer. Completes the piece or expression.

Fields

§value: DebugInfoOffset<Offset>

The .debug_info offset of the value that this is an implicit pointer into.

§byte_offset: i64

The byte offset into the value that the implicit pointer points to.

§

EntryValue

Evaluate an expression at the entry to the current subprogram, and push it on the stack.

Represents DW_OP_entry_value.

Fields

§expression: R

The expression to be evaluated.

§

ParameterRef

This represents a parameter that was optimized out.

The offset points to the definition of the parameter, and is matched to the DW_TAG_GNU_call_site_parameter in the caller that also points to the same definition of the parameter.

Represents DW_OP_GNU_parameter_ref.

Fields

§offset: UnitOffset<Offset>

The DIE to use.

§

Address

Relocate the address if needed, and push it on the stack.

Represents DW_OP_addr.

Fields

§address: u64

The offset to add.

§

AddressIndex

Read the address at the given index in `.debug_addr, relocate the address if needed, and push it on the stack.

Represents DW_OP_addrx.

Fields

§index: DebugAddrIndex<Offset>

The index of the address in .debug_addr.

§

ConstantIndex

Read the address at the given index in `.debug_addr, and push it on the stack. Do not relocate the address.

Represents DW_OP_constx.

Fields

§index: DebugAddrIndex<Offset>

The index of the address in .debug_addr.

§

TypedLiteral

Interpret the value bytes as a constant of a given type, and push it on the stack.

Represents DW_OP_const_type.

Fields

§base_type: UnitOffset<Offset>

The DIE of the base type.

§value: R

The value bytes.

§

Convert

Pop the top stack entry, convert it to a different type, and push it on the stack.

Represents DW_OP_convert.

Fields

§base_type: UnitOffset<Offset>

The DIE of the base type.

§

Reinterpret

Pop the top stack entry, reinterpret the bits in its value as a different type, and push it on the stack.

Represents DW_OP_reinterpret.

Fields

§base_type: UnitOffset<Offset>

The DIE of the base type.

§

WasmLocal

The index of a local in the currently executing function.

Represents DW_OP_WASM_location 0x00. Completes the piece or expression.

Fields

§index: u32

The index of the local.

§

WasmGlobal

The index of a global.

Represents DW_OP_WASM_location 0x01 or DW_OP_WASM_location 0x03. Completes the piece or expression.

Fields

§index: u32

The index of the global.

§

WasmStack

The index of an item on the operand stack.

Represents DW_OP_WASM_location 0x02. Completes the piece or expression.

Fields

§index: u32

The index of the stack item. 0 is the bottom of the operand stack.

Implementations§

source§

impl<R, Offset> Operation<R, Offset>
where R: Reader<Offset = Offset>, Offset: ReaderOffset,

source

pub fn parse(bytes: &mut R, encoding: Encoding) -> Result<Operation<R, Offset>>

Parse a single DWARF expression operation.

This is useful when examining a DWARF expression for reasons other than direct evaluation.

bytes points to a the operation to decode. It should point into the same array as bytecode, which should be the entire expression.

Trait Implementations§

source§

impl<R, Offset> Clone for Operation<R, Offset>
where R: Reader<Offset = Offset> + Clone, Offset: ReaderOffset + Clone,

source§

fn clone(&self) -> Operation<R, Offset>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<R, Offset> Debug for Operation<R, Offset>
where R: Reader<Offset = Offset> + Debug, Offset: ReaderOffset + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<R, Offset> PartialEq for Operation<R, Offset>
where R: Reader<Offset = Offset> + PartialEq, Offset: ReaderOffset + PartialEq,

source§

fn eq(&self, other: &Operation<R, Offset>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<R, Offset> Copy for Operation<R, Offset>
where R: Reader<Offset = Offset> + Copy, Offset: ReaderOffset + Copy,

source§

impl<R, Offset> Eq for Operation<R, Offset>
where R: Reader<Offset = Offset> + Eq, Offset: ReaderOffset + Eq,

source§

impl<R, Offset> StructuralPartialEq for Operation<R, Offset>
where R: Reader<Offset = Offset>, Offset: ReaderOffset,

Auto Trait Implementations§

§

impl<R, Offset> Freeze for Operation<R, Offset>
where R: Freeze, Offset: Freeze,

§

impl<R, Offset> RefUnwindSafe for Operation<R, Offset>
where R: RefUnwindSafe, Offset: RefUnwindSafe,

§

impl<R, Offset> Send for Operation<R, Offset>
where R: Send, Offset: Send,

§

impl<R, Offset> Sync for Operation<R, Offset>
where R: Sync, Offset: Sync,

§

impl<R, Offset> Unpin for Operation<R, Offset>
where R: Unpin, Offset: Unpin,

§

impl<R, Offset> UnwindSafe for Operation<R, Offset>
where R: UnwindSafe, Offset: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.