pub enum AbstractLocation {
Register(Variable),
GlobalAddress {
address: u64,
size: ByteSize,
},
Pointer(Variable, AbstractMemoryLocation),
GlobalPointer(u64, AbstractMemoryLocation),
}
Expand description
An abstract location describes how to find the value of a variable in memory at a given time.
It is defined recursively, where the root is either a register or a (constant) global address. This way only locations that the local state knows about are representable. It is also impossible to accidentally describe circular references.
Variants§
Register(Variable)
The location is given by a register.
GlobalAddress
Fields
The value itself is a constant address to global memory.
Note that the size
is the size of the pointer and not the size
of the value residing at the specific address in global memory.
Pointer(Variable, AbstractMemoryLocation)
The location is in memory. One needs to follow the pointer in the given register and then follow the abstract memory location inside the pointed to memory object to find the actual memory location.
GlobalPointer(u64, AbstractMemoryLocation)
The location is in memory. One needs to follow the pointer located at the given global address and then follow the abstract memory location inside the pointed to memory object to find the actual memory location.
Implementations§
source§impl AbstractLocation
impl AbstractLocation
sourcepub fn from_var(variable: &Variable) -> Result<AbstractLocation, Error>
pub fn from_var(variable: &Variable) -> Result<AbstractLocation, Error>
Create an abstract location from a variable corresponding to a register. This function returns an error if the variable is not a physical register.
sourcepub fn from_stack_position(
stack_register: &Variable,
offset: i64,
size: ByteSize
) -> AbstractLocation
pub fn from_stack_position( stack_register: &Variable, offset: i64, size: ByteSize ) -> AbstractLocation
Create an abstract location on the stack.
The returned location describes the value of the given size
at the given offset
relative to the memory location that the stack_register
is pointing to.
sourcepub fn from_global_address(address: &Bitvector) -> AbstractLocation
pub fn from_global_address(address: &Bitvector) -> AbstractLocation
Create an abstract location representing an address pointing to global memory.
sourcepub fn with_offset_addendum(self, addendum: i64) -> AbstractLocation
pub fn with_offset_addendum(self, addendum: i64) -> AbstractLocation
Add an offset to the abstract location.
sourcepub fn dereferenced(
self,
new_size: ByteSize,
generic_pointer_size: ByteSize
) -> AbstractLocation
pub fn dereferenced( self, new_size: ByteSize, generic_pointer_size: ByteSize ) -> AbstractLocation
Return the abstract location that one gets when dereferencing the pointer that self
is pointing to.
Panics if self
is not pointer-sized.
sourcepub fn bytesize(&self) -> ByteSize
pub fn bytesize(&self) -> ByteSize
Get the bytesize of the value represented by the abstract location.
sourcepub fn recursion_depth(&self) -> u64
pub fn recursion_depth(&self) -> u64
Get the recursion depth of the abstract location, i.e. how many times one has to dereference a pointer until reaching the actual location.
sourcepub fn extend(
&mut self,
extension: AbstractMemoryLocation,
generic_pointer_size: ByteSize
)
pub fn extend( &mut self, extension: AbstractMemoryLocation, generic_pointer_size: ByteSize )
Extend the location string by adding further derefence operations to it according to the given extension.
sourcepub fn get_parent_location(
&self,
generic_pointer_size: ByteSize
) -> Result<(AbstractLocation, i64), Error>
pub fn get_parent_location( &self, generic_pointer_size: ByteSize ) -> Result<(AbstractLocation, i64), Error>
Get the abstract location representing the pointer pointing to the memory object
that contains the location represented by self
together with the offset that one has to add to the pointer to get the location of self.
Returns an error if the abstract location contains no dereference operation
(e.g. if self
represents a register value).
sourcepub fn get_all_parent_locations(
&self,
generic_pointer_size: ByteSize
) -> Vec<AbstractLocation>
pub fn get_all_parent_locations( &self, generic_pointer_size: ByteSize ) -> Vec<AbstractLocation>
Get a list of all (recursive) parent locations. The list is sorted by recursion depth, starting with the root location.
Trait Implementations§
source§impl Clone for AbstractLocation
impl Clone for AbstractLocation
source§fn clone(&self) -> AbstractLocation
fn clone(&self) -> AbstractLocation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AbstractLocation
impl Debug for AbstractLocation
source§impl<'de> Deserialize<'de> for AbstractLocation
impl<'de> Deserialize<'de> for AbstractLocation
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 Display for AbstractLocation
impl Display for AbstractLocation
source§impl Hash for AbstractLocation
impl Hash for AbstractLocation
source§impl Ord for AbstractLocation
impl Ord for AbstractLocation
source§fn cmp(&self, other: &AbstractLocation) -> Ordering
fn cmp(&self, other: &AbstractLocation) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for AbstractLocation
impl PartialEq for AbstractLocation
source§fn eq(&self, other: &AbstractLocation) -> bool
fn eq(&self, other: &AbstractLocation) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AbstractLocation
impl PartialOrd for AbstractLocation
source§fn partial_cmp(&self, other: &AbstractLocation) -> Option<Ordering>
fn partial_cmp(&self, other: &AbstractLocation) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for AbstractLocation
impl Serialize for AbstractLocation
impl Eq for AbstractLocation
impl StructuralEq for AbstractLocation
impl StructuralPartialEq for AbstractLocation
Auto Trait Implementations§
impl RefUnwindSafe for AbstractLocation
impl Send for AbstractLocation
impl Sync for AbstractLocation
impl Unpin for AbstractLocation
impl UnwindSafe for AbstractLocation
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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.