Enum gimli::read::Value

source ·
pub enum Value {
    Generic(u64),
    I8(i8),
    U8(u8),
    I16(i16),
    U16(u16),
    I32(i32),
    U32(u32),
    I64(i64),
    U64(u64),
    F32(f32),
    F64(f64),
}
Expand description

The value of an entry on the DWARF stack.

Variants§

§

Generic(u64)

A generic value, which is address-sized and of unspecified sign.

§

I8(i8)

A signed 8-bit integer value.

§

U8(u8)

An unsigned 8-bit integer value.

§

I16(i16)

A signed 16-bit integer value.

§

U16(u16)

An unsigned 16-bit integer value.

§

I32(i32)

A signed 32-bit integer value.

§

U32(u32)

An unsigned 32-bit integer value.

§

I64(i64)

A signed 64-bit integer value.

§

U64(u64)

An unsigned 64-bit integer value.

§

F32(f32)

A 32-bit floating point value.

§

F64(f64)

A 64-bit floating point value.

Implementations§

source§

impl Value

source

pub fn value_type(&self) -> ValueType

Return the ValueType corresponding to this Value.

source

pub fn parse<R: Reader>(value_type: ValueType, bytes: R) -> Result<Value>

Read a Value with the given value_type from a Reader.

source

pub fn to_u64(self, addr_mask: u64) -> Result<u64>

Convert a Value to a u64.

The ValueType of self must be integral. Values are sign extended if the source value is signed.

source

pub fn from_u64(value_type: ValueType, value: u64) -> Result<Value>

Create a Value with the given value_type from a u64 value.

The value_type may be integral or floating point. The result is truncated if the u64 value does not fit the bounds of the value_type.

source

pub fn convert(self, value_type: ValueType, addr_mask: u64) -> Result<Value>

Convert a Value to the given value_type.

When converting between integral types, the result is truncated if the source value does not fit the bounds of the value_type. When converting from floating point types, the result is not defined if the source value does not fit the bounds of the value_type.

This corresponds to the DWARF DW_OP_convert operation.

source

pub fn reinterpret(self, value_type: ValueType, addr_mask: u64) -> Result<Value>

Reinterpret the bits in a Value as the given value_type.

The source and result value types must have equal sizes.

This corresponds to the DWARF DW_OP_reinterpret operation.

source

pub fn abs(self, addr_mask: u64) -> Result<Value>

Perform an absolute value operation.

If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_abs operation.

source

pub fn neg(self, addr_mask: u64) -> Result<Value>

Perform a negation operation.

If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_neg operation.

source

pub fn add(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform an addition operation.

This operation requires matching types.

This corresponds to the DWARF DW_OP_plus operation.

source

pub fn sub(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a subtraction operation.

This operation requires matching types.

This corresponds to the DWARF DW_OP_minus operation.

source

pub fn mul(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a multiplication operation.

This operation requires matching types.

This corresponds to the DWARF DW_OP_mul operation.

source

pub fn div(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a division operation.

This operation requires matching types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_div operation.

source

pub fn rem(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a remainder operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as an unsigned value.

This corresponds to the DWARF DW_OP_mod operation.

source

pub fn not(self, addr_mask: u64) -> Result<Value>

Perform a bitwise not operation.

This operation requires matching integral types.

This corresponds to the DWARF DW_OP_not operation.

source

pub fn and(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a bitwise and operation.

This operation requires matching integral types.

This corresponds to the DWARF DW_OP_and operation.

source

pub fn or(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a bitwise or operation.

This operation requires matching integral types.

This corresponds to the DWARF DW_OP_or operation.

source

pub fn xor(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a bitwise exclusive-or operation.

This operation requires matching integral types.

This corresponds to the DWARF DW_OP_xor operation.

source

pub fn shl(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a shift left operation.

This operation requires integral types. If the shift length exceeds the type size, then 0 is returned. If the shift length is negative then an error is returned.

This corresponds to the DWARF DW_OP_shl operation.

source

pub fn shr(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform a logical shift right operation.

This operation requires an unsigned integral type for the value. If the value type is Generic, then it is interpreted as an unsigned value.

This operation requires an integral type for the shift length. If the shift length exceeds the type size, then 0 is returned. If the shift length is negative then an error is returned.

This corresponds to the DWARF DW_OP_shr operation.

source

pub fn shra(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform an arithmetic shift right operation.

This operation requires a signed integral type for the value. If the value type is Generic, then it is interpreted as a signed value.

This operation requires an integral type for the shift length. If the shift length exceeds the type size, then 0 is returned for positive values, and -1 is returned for negative values. If the shift length is negative then an error is returned.

This corresponds to the DWARF DW_OP_shra operation.

source

pub fn eq(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform the == relational operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_eq operation.

source

pub fn ge(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform the >= relational operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_ge operation.

source

pub fn gt(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform the > relational operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_gt operation.

source

pub fn le(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform the `<= relational operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_le operation.

source

pub fn lt(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform the `< relational operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_lt operation.

source

pub fn ne(self, rhs: Value, addr_mask: u64) -> Result<Value>

Perform the `!= relational operation.

This operation requires matching integral types. If the value type is Generic, then it is interpreted as a signed value.

This corresponds to the DWARF DW_OP_ne operation.

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

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 Value

source§

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

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

impl PartialEq for Value

source§

fn eq(&self, other: &Value) -> 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 Copy for Value

source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

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

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

source§

default 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<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.