Enum gimli::Operation
[−]
[src]
pub enum Operation<'input, Endian> where Endian: Endianity { Deref { 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: EndianBuf<'input, Endian>, }, Eq, Ge, Gt, Le, Lt, Ne, Skip { target: EndianBuf<'input, Endian>, }, Literal { value: u64, }, Register { register: u64, }, RegisterOffset { register: u64, offset: i64, }, FrameOffset { offset: i64, }, Nop, PushObjectAddress, Call { offset: DieReference, }, TLS, CallFrameCFA, Piece { size_in_bits: u64, bit_offset: Option<u64>, }, ImplicitValue { data: &'input [u8], }, StackValue, ImplicitPointer { value: DebugInfoOffset, byte_offset: i64, }, EntryValue { expression: EndianBuf<'input, Endian>, }, }
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
A dereference operation.
Fields
size: u8 | The size of the data to dereference. |
space: bool | True if the dereference operation takes an address space argument; 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: EndianBuf<'input, Endian> | 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: EndianBuf<'input, Endian> | The target bytecode. |
Literal
Push a constant value on the stack. This handles multiple
DWARF opcodes, including DW_OP_addr
.
Fields
value: u64 | The value to push. |
Register
Indicate that this piece's location is in the given register.
Fields
register: u64 | 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: u64 | The register number. |
offset: i64 | The offset to add. |
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 | 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 |
ImplicitValue
Represents DW_OP_implicit_value
.
Fields
data: &'input [u8] | The implicit value to use. |
StackValue
Represents DW_OP_stack_value
.
ImplicitPointer
Represents DW_OP_implicit_pointer
. The object is a pointer to
a value which has no actual location, such as an implicit value or
a stack value.
Fields
value: DebugInfoOffset | The |
byte_offset: i64 | The byte offset into the value that the implicit pointer points to. |
EntryValue
Represents DW_OP_entry_value
. Evaluate an expression at the entry to
the current subprogram, and push it on the stack.
Fields
expression: EndianBuf<'input, Endian> | The expression to be evaluated. |
Methods
impl<'input, Endian> Operation<'input, Endian> where Endian: Endianity
[src]
fn parse(bytes: EndianBuf<'input, Endian>,
bytecode: &'input [u8],
address_size: u8,
format: Format)
-> Result<(EndianBuf<'input, Endian>, Operation<'input, Endian>)> where Endian: Endianity
bytecode: &'input [u8],
address_size: u8,
format: Format)
-> Result<(EndianBuf<'input, Endian>, Operation<'input, Endian>)> where Endian: Endianity
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
impl<'input, Endian: Debug> Debug for Operation<'input, Endian> where Endian: Endianity
[src]
impl<'input, Endian: PartialEq> PartialEq for Operation<'input, Endian> where Endian: Endianity
[src]
fn eq(&self, __arg_0: &Operation<'input, Endian>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Operation<'input, Endian>) -> bool
This method tests for !=
.