Struct gimli::write::Expression
source · [−]pub struct Expression { /* private fields */ }
Expand description
The bytecode for a DWARF expression or location description.
Implementations
sourceimpl Expression
impl Expression
sourcepub 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>
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.
sourceimpl Expression
impl Expression
sourcepub fn raw(bytecode: Vec<u8>) -> Self
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
.
sourcepub fn op(&mut self, opcode: DwOp)
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.
sourcepub fn op_constu(&mut self, value: u64)
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.
sourcepub fn op_consts(&mut self, value: i64)
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.
sourcepub fn op_const_type(&mut self, base: UnitEntryId, value: Box<[u8]>)
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.
sourcepub fn op_breg(&mut self, register: Register, offset: i64)
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.
sourcepub fn op_regval_type(&mut self, register: Register, base: UnitEntryId)
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.
sourcepub fn op_pick(&mut self, index: u8)
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.
sourcepub fn op_deref_size(&mut self, size: u8)
pub fn op_deref_size(&mut self, size: u8)
Add a DW_OP_deref_size
operation to the expression.
sourcepub fn op_xderef_size(&mut self, size: u8)
pub fn op_xderef_size(&mut self, size: u8)
Add a DW_OP_xderef_size
operation to the expression.
sourcepub fn op_deref_type(&mut self, size: u8, base: UnitEntryId)
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.
sourcepub fn op_xderef_type(&mut self, size: u8, base: UnitEntryId)
pub fn op_xderef_type(&mut self, size: u8, base: UnitEntryId)
Add a DW_OP_xderef_type
operation to the expression.
sourcepub fn op_plus_uconst(&mut self, value: u64)
pub fn op_plus_uconst(&mut self, value: u64)
Add a DW_OP_plus_uconst
operation to the expression.
sourcepub fn op_skip(&mut self) -> usize
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.
sourcepub fn op_bra(&mut self) -> usize
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.
sourcepub fn next_index(&self) -> usize
pub fn next_index(&self) -> usize
Return the index that will be assigned to the next operation.
This can be passed to set_target
.
sourcepub fn set_target(&mut self, operation: usize, new_target: usize)
pub fn set_target(&mut self, operation: usize, new_target: usize)
Set the target of a DW_OP_skip
or DW_OP_bra
operation .
sourcepub fn op_call(&mut self, entry: UnitEntryId)
pub fn op_call(&mut self, entry: UnitEntryId)
Add a DW_OP_call4
operation to the expression.
sourcepub fn op_call_ref(&mut self, entry: Reference)
pub fn op_call_ref(&mut self, entry: Reference)
Add a DW_OP_call_ref
operation to the expression.
sourcepub fn op_convert(&mut self, base: Option<UnitEntryId>)
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.
sourcepub fn op_reinterpret(&mut self, base: Option<UnitEntryId>)
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.
sourcepub fn op_entry_value(&mut self, expression: Expression)
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.
sourcepub fn op_reg(&mut self, register: Register)
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.
sourcepub fn op_implicit_value(&mut self, data: Box<[u8]>)
pub fn op_implicit_value(&mut self, data: Box<[u8]>)
Add a DW_OP_implicit_value
operation to the expression.
sourcepub fn op_implicit_pointer(&mut self, entry: Reference, byte_offset: i64)
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.
sourcepub fn op_bit_piece(&mut self, size_in_bits: u64, bit_offset: u64)
pub fn op_bit_piece(&mut self, size_in_bits: u64, bit_offset: u64)
Add a DW_OP_bit_piece
operation to the expression.
sourcepub fn op_gnu_parameter_ref(&mut self, entry: UnitEntryId)
pub fn op_gnu_parameter_ref(&mut self, entry: UnitEntryId)
Add a DW_OP_GNU_parameter_ref
operation to the expression.
sourcepub fn op_wasm_local(&mut self, index: u32)
pub fn op_wasm_local(&mut self, index: u32)
Add a DW_OP_WASM_location 0x0
operation to the expression.
sourcepub fn op_wasm_global(&mut self, index: u32)
pub fn op_wasm_global(&mut self, index: u32)
Add a DW_OP_WASM_location 0x1
operation to the expression.
sourcepub fn op_wasm_stack(&mut self, index: u32)
pub fn op_wasm_stack(&mut self, index: u32)
Add a DW_OP_WASM_location 0x2
operation to the expression.
Trait Implementations
sourceimpl Clone for Expression
impl Clone for Expression
sourcefn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Expression
impl Debug for Expression
sourceimpl Default for Expression
impl Default for Expression
sourcefn default() -> Expression
fn default() -> Expression
Returns the “default value” for a type. Read more
sourceimpl Hash for Expression
impl Hash for Expression
sourceimpl PartialEq<Expression> for Expression
impl PartialEq<Expression> for Expression
sourcefn eq(&self, other: &Expression) -> bool
fn eq(&self, other: &Expression) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Expression) -> bool
fn ne(&self, other: &Expression) -> bool
This method tests for !=
.
impl Eq for Expression
impl StructuralEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more