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
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.
source§impl 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§
source§impl Clone for Expression
impl Clone for Expression
source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Expression
impl Debug for Expression
source§impl Default for Expression
impl Default for Expression
source§fn default() -> Expression
fn default() -> Expression
source§impl Hash for Expression
impl Hash for Expression
source§impl PartialEq for Expression
impl PartialEq for Expression
impl Eq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.