Struct cwe_checker_lib::pcode::Variable
source · pub struct Variable {
pub name: Option<String>,
pub value: Option<String>,
pub address: Option<String>,
pub size: ByteSize,
pub is_virtual: bool,
}
Expand description
A variable representing a varnode in Ghidra P-Code
Fields§
§name: Option<String>
The name of the register if the varnode represents a register
value: Option<String>
The value of the varnode if it represents a constant
address: Option<String>
If the varnode represents an implicit LOAD
from memory,
the (necessarily constant) address of the LOAD
.
size: ByteSize
The size (in bytes) of the varnode
is_virtual: bool
A flag set to true
for virtual/temporary registers.
Implementations§
source§impl Variable
impl Variable
sourcepub fn parse_const_to_bitvector(&self) -> Bitvector
pub fn parse_const_to_bitvector(&self) -> Bitvector
Parses a variable representing a concrete value to a bitvector containing the value.
sourcepub fn parse_address_to_bitvector(
&self,
generic_pointer_size: ByteSize
) -> Bitvector
pub fn parse_address_to_bitvector( &self, generic_pointer_size: ByteSize ) -> Bitvector
Parses a variable representing an address to a pointer-sized bitvector containing the address.
sourcepub fn new_virtual(name: impl Into<String>, size: ByteSize) -> Variable
pub fn new_virtual(name: impl Into<String>, size: ByteSize) -> Variable
Generate a virtual variable with the given name and size.
sourcepub fn new_const(value_string: impl Into<String>, size: ByteSize) -> Variable
pub fn new_const(value_string: impl Into<String>, size: ByteSize) -> Variable
Generate a variable representing a constant
sourcepub fn to_load_def(
&self,
target_register_name: impl Into<String>,
generic_pointer_size: ByteSize
) -> Def
pub fn to_load_def( &self, target_register_name: impl Into<String>, generic_pointer_size: ByteSize ) -> Def
Create a LOAD instruction out of a variable representing a load from a constant address into a virtual register.
sourcepub fn parse_to_bytesize(self) -> ByteSize
pub fn parse_to_bytesize(self) -> ByteSize
Translates a variable into the byte size that it represents. Panics on error.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Variable
impl<'de> Deserialize<'de> for Variable
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<Variable> for Expression
impl From<Variable> for Expression
source§fn from(pcode_var: Variable) -> IrExpression
fn from(pcode_var: Variable) -> IrExpression
Translate a P-Code variable into a Var
or Const
expression of the internally used IR.
Panics if the translation fails.
source§impl From<Variable> for Variable
impl From<Variable> for Variable
source§fn from(pcode_var: Variable) -> IrVariable
fn from(pcode_var: Variable) -> IrVariable
Translate a P-Code variable into a register variable of the internally used IR. Panic if the variable does not represent a register.
source§impl PartialEq for Variable
impl PartialEq for Variable
impl Eq for Variable
impl StructuralEq for Variable
impl StructuralPartialEq for Variable
Auto Trait Implementations§
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnwindSafe for Variable
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.