Struct gimli::write::Expression

source ·
pub struct Expression { /* private fields */ }
Expand description

The bytecode for a DWARF expression or location description.

Implementations§

source§

impl Expression

source

pub fn from<R: Reader<Offset = usize>>( from_expression: Expression<R>, encoding: Encoding, dwarf: Option<&Dwarf<R>>, unit: Option<&Unit<R>>, entry_ids: Option<&HashMap<UnitSectionOffset, (UnitId, UnitEntryId)>>, convert_address: &dyn Fn(u64) -> Option<Address>, ) -> ConvertResult<Expression>

Create an expression from the input expression.

source§

impl Expression

source

pub fn new() -> Self

Create an empty expression.

source

pub fn raw(bytecode: Vec<u8>) -> Self

Create an expression from raw bytecode.

This does not support operations that require references, such as DW_OP_addr.

source

pub fn op(&mut self, opcode: DwOp)

Add an operation to the expression.

This should only be used for operations that have no explicit operands.

source

pub fn op_addr(&mut self, address: Address)

Add a DW_OP_addr operation to the expression.

source

pub fn op_constu(&mut self, value: u64)

Add a DW_OP_constu operation to the expression.

This may be emitted as a smaller equivalent operation.

source

pub fn op_consts(&mut self, value: i64)

Add a DW_OP_consts operation to the expression.

This may be emitted as a smaller equivalent operation.

source

pub fn op_const_type(&mut self, base: UnitEntryId, value: Box<[u8]>)

Add a DW_OP_const_type or DW_OP_GNU_const_type operation to the expression.

source

pub fn op_fbreg(&mut self, offset: i64)

Add a DW_OP_fbreg operation to the expression.

source

pub fn op_breg(&mut self, register: Register, offset: i64)

Add a DW_OP_bregx operation to the expression.

This may be emitted as a smaller equivalent operation.

source

pub fn op_regval_type(&mut self, register: Register, base: UnitEntryId)

Add a DW_OP_regval_type or DW_OP_GNU_regval_type operation to the expression.

This may be emitted as a smaller equivalent operation.

source

pub fn op_pick(&mut self, index: u8)

Add a DW_OP_pick operation to the expression.

This may be emitted as a DW_OP_dup or DW_OP_over operation.

source

pub fn op_deref(&mut self)

Add a DW_OP_deref operation to the expression.

source

pub fn op_xderef(&mut self)

Add a DW_OP_xderef operation to the expression.

source

pub fn op_deref_size(&mut self, size: u8)

Add a DW_OP_deref_size operation to the expression.

source

pub fn op_xderef_size(&mut self, size: u8)

Add a DW_OP_xderef_size operation to the expression.

source

pub fn op_deref_type(&mut self, size: u8, base: UnitEntryId)

Add a DW_OP_deref_type or DW_OP_GNU_deref_type operation to the expression.

source

pub fn op_xderef_type(&mut self, size: u8, base: UnitEntryId)

Add a DW_OP_xderef_type operation to the expression.

source

pub fn op_plus_uconst(&mut self, value: u64)

Add a DW_OP_plus_uconst operation to the expression.

source

pub fn op_skip(&mut self) -> usize

Add a DW_OP_skip operation to the expression.

Returns the index of the operation. The caller must call set_target with this index to set the target of the branch.

source

pub fn op_bra(&mut self) -> usize

Add a DW_OP_bra operation to the expression.

Returns the index of the operation. The caller must call set_target with this index to set the target of the branch.

source

pub fn next_index(&self) -> usize

Return the index that will be assigned to the next operation.

This can be passed to set_target.

source

pub fn set_target(&mut self, operation: usize, new_target: usize)

Set the target of a DW_OP_skip or DW_OP_bra operation .

source

pub fn op_call(&mut self, entry: UnitEntryId)

Add a DW_OP_call4 operation to the expression.

source

pub fn op_call_ref(&mut self, entry: Reference)

Add a DW_OP_call_ref operation to the expression.

source

pub fn op_convert(&mut self, base: Option<UnitEntryId>)

Add a DW_OP_convert or DW_OP_GNU_convert operation to the expression.

base is the DIE of the base type, or None for the generic type.

source

pub fn op_reinterpret(&mut self, base: Option<UnitEntryId>)

Add a DW_OP_reinterpret or DW_OP_GNU_reinterpret operation to the expression.

base is the DIE of the base type, or None for the generic type.

source

pub fn op_entry_value(&mut self, expression: Expression)

Add a DW_OP_entry_value or DW_OP_GNU_entry_value operation to the expression.

source

pub fn op_reg(&mut self, register: Register)

Add a DW_OP_regx operation to the expression.

This may be emitted as a smaller equivalent operation.

source

pub fn op_implicit_value(&mut self, data: Box<[u8]>)

Add a DW_OP_implicit_value operation to the expression.

source

pub fn op_implicit_pointer(&mut self, entry: Reference, byte_offset: i64)

Add a DW_OP_implicit_pointer or DW_OP_GNU_implicit_pointer operation to the expression.

source

pub fn op_piece(&mut self, size_in_bytes: u64)

Add a DW_OP_piece operation to the expression.

source

pub fn op_bit_piece(&mut self, size_in_bits: u64, bit_offset: u64)

Add a DW_OP_bit_piece operation to the expression.

source

pub fn op_gnu_parameter_ref(&mut self, entry: UnitEntryId)

Add a DW_OP_GNU_parameter_ref operation to the expression.

source

pub fn op_wasm_local(&mut self, index: u32)

Add a DW_OP_WASM_location 0x0 operation to the expression.

source

pub fn op_wasm_global(&mut self, index: u32)

Add a DW_OP_WASM_location 0x1 operation to the expression.

source

pub fn op_wasm_stack(&mut self, index: u32)

Add a DW_OP_WASM_location 0x2 operation to the expression.

Trait Implementations§

source§

impl Clone for Expression

source§

fn clone(&self) -> Expression

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 Debug for Expression

source§

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

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

impl Default for Expression

source§

fn default() -> Expression

Returns the “default value” for a type. Read more
source§

impl Hash for Expression

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Expression

source§

fn eq(&self, other: &Expression) -> bool

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

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

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

impl Eq for Expression

source§

impl StructuralPartialEq for Expression

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

source§

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

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.