pub struct State<T: AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> { /* private fields */ }
Expand description

Contains all information known about the state of a program at a specific point of time.

Implementations§

source§

impl<T: AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> State<T>

source

pub fn new( node_index: NodeIndex, pointer_inference_results: &PointerInferenceComputation<'_> ) -> State<T>

Creates a new state.

source

pub fn set_all_maps_empty(&mut self)

Removes all entries from the string maps.

source

pub fn add_unassigned_return_pointer( &mut self, pointer: DataDomain<IntervalDomain> )

Adds a return pointer to the unassigned return pointer set.

source

pub fn get_unassigned_return_pointer( &self ) -> &HashSet<DataDomain<IntervalDomain>>

Returns the set of function return pointer that have not yet been assigned to a memory location or register.

source

pub fn add_new_variable_to_pointer_entry( &mut self, variable: Variable, pointer: DataDomain<IntervalDomain> )

Adds a new variable to pointer entry to the map.

source

pub fn add_new_stack_offset_to_string_entry( &mut self, offset: i64, string_domain: T )

Adds a new offset to string entry to the map.

source

pub fn add_new_heap_to_string_entry( &mut self, heap_id: AbstractIdentifier, string_domain: T )

Adds a new heap id to string entry to the map.

source

pub fn remove_heap_to_string_entry(&mut self, heap_id: &AbstractIdentifier)

Removes a string from the heap to string map for the given abstract id.

source

pub fn get_variable_to_pointer_map( &self ) -> &HashMap<Variable, DataDomain<IntervalDomain>>

Returns a reference to the variable to pointer map.

source

pub fn set_variable_to_pointer_map( &mut self, map: HashMap<Variable, DataDomain<IntervalDomain>> )

Sets the variable to pointer map to a new value.

source

pub fn get_stack_offset_to_pointer_map( &self ) -> &HashMap<i64, DataDomain<IntervalDomain>>

Returns a reference to the variable to pointer map.

source

pub fn get_stack_offset_to_string_map(&self) -> &HashMap<i64, T>

Returns a reference to the stack offset to string map.

source

pub fn get_heap_to_string_map(&self) -> &HashMap<AbstractIdentifier, T>

Returns a reference to the heap to string map.

source

pub fn get_current_sub(&self) -> Option<&Term<Sub>>

Gets the current subroutine since the analysis is interprocedural.

source

pub fn get_pointer_inference_state(&self) -> Option<&PointerInferenceState>

Get the current pointer inference state if it is contained as an intermediate value in the state.

source

pub fn set_pointer_inference_state( &mut self, pi_state: Option<PointerInferenceState> )

Set the current pointer inference state for self.

source

pub fn delete_string_map_entries_if_no_pointer_targets_are_tracked( &self ) -> Self

Deletes all entries in the string maps that do not have corresponding pointers in the pointer maps.

source

pub fn collect_all_tracked_pointers(&self) -> Vec<DataDomain<IntervalDomain>>

Returns a vector of all currently tracked pointers.

source

pub fn filter_string_map_entries( &self, pi_state: &PointerInferenceState ) -> (HashMap<i64, T>, HashMap<AbstractIdentifier, T>)

Removes all string entries for which the pointers are not tracked anymore.

source

pub fn evaluate_constant( &self, runtime_memory_image: &RuntimeMemoryImage, block_first_def_set: &HashSet<(Tid, Tid)>, constant: Bitvector ) -> Option<DataDomain<IntervalDomain>>

Evaluates the constant used as input of a Def Term. It checks whether it is a constant address pointing to global read only memory. If so, a pointer is added to the register map.

source

pub fn handle_assign_and_load( &mut self, output: &Variable, input: &Expression, runtime_memory_image: &RuntimeMemoryImage, block_first_def_set: &HashSet<(Tid, Tid)>, is_assign: bool )

Handles assign and load Def Terms.

source

pub fn check_if_output_is_string_pointer_and_add_targets( &mut self, pi_state: &PointerInferenceState, output: &Variable, runtime_memory_image: &RuntimeMemoryImage, block_first_def_set: &HashSet<(Tid, Tid)> ) -> bool

Checks whether the given pointer points to a string and adds missing targets to the string maps as Top values.

source

pub fn add_global_pointer_if_input_is_string_constant( &mut self, runtime_memory_image: &RuntimeMemoryImage, block_first_def_set: &HashSet<(Tid, Tid)>, output: &Variable, input: &Expression ) -> bool

If the input is a string constant, add the global pointer to the variable map.

source

pub fn add_relative_targets_to_string_maps( &mut self, pi_state: &PointerInferenceState, pointer: &DataDomain<IntervalDomain> )

Adds all relative targets of the given DataDomain to the string maps if they are not already tracked.

source

pub fn pointer_added_to_variable_maps( &mut self, pi_state: &PointerInferenceState, output: &Variable, loaded_pointer: DataDomain<IntervalDomain> ) -> bool

Adds a pointer to the variable pointer maps if its targets were fully or partially tracked. Returns true if it was added.

source

pub fn pointer_added_to_stack_maps( &mut self, pi_state: &PointerInferenceState, target_address: &Expression, potential_string_pointer: DataDomain<IntervalDomain> ) -> bool

Adds a pointer to the stack pointer maps if its targets were fully or partially tracked.

source

pub fn pointer_targets_partially_tracked( &mut self, pi_state: &PointerInferenceState, pointer: &DataDomain<IntervalDomain> ) -> bool

If only some targets of a pointer point to tracked strings, add top values for the other targets. It is assumed that all targets point to the same data type.

source

pub fn add_top_domain_values_for_additional_pointer_targets( &mut self, new_stack_entries: Vec<i64>, new_heap_entries: Vec<AbstractIdentifier> )

Adds Top values to stack and heap maps for additional pointer targets.

source

pub fn pointer_is_in_pointer_maps( &self, pointer: &DataDomain<IntervalDomain> ) -> bool

Checks whether a given pointer is contained in one of the pointer maps.

source

pub fn handle_store( &mut self, target_address: &Expression, value: &Expression, runtime_memory_image: &RuntimeMemoryImage, block_first_def_set: &HashSet<(Tid, Tid)> )

Handles store Def Terms.

source

pub fn add_pointer_to_stack_map( &mut self, target: &Expression, string_pointer: DataDomain<IntervalDomain> )

If a string pointer is to be stored on the stack, add it to the stack map.

source

pub fn remove_non_callee_saved_pointer_entries_for_external_symbol( &mut self, project: &Project, extern_symbol: &ExternSymbol )

Removes all non callee saved register entries from the variable to pointer map.

source

pub fn is_stack_pointer( pi_state: &PointerInferenceState, target: &AbstractIdentifier ) -> bool

Checks whether a target refers to the Stack.

Trait Implementations§

source§

impl<T: AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> AbstractDomain for State<T>

source§

fn merge(&self, other: &Self) -> Self

Merges two states.

source§

fn is_top(&self) -> bool

The state has no explicit Top element.

source§

fn merge_with(&mut self, other: &Self) -> &mut Self

Returns an upper bound (with respect to the partial order on the domain) for the two inputs self and other. Read more
source§

impl<T: Clone + AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> Clone for State<T>

source§

fn clone(&self) -> State<T>

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<T: Debug + AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> Debug for State<T>

source§

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

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

impl<'de, T> Deserialize<'de> for State<T>

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: PartialEq + AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> PartialEq for State<T>

source§

fn eq(&self, other: &State<T>) -> 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<T> Serialize for State<T>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Eq + AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> Eq for State<T>

source§

impl<T: AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> StructuralEq for State<T>

source§

impl<T: AbstractDomain + DomainInsertion + HasTop + Eq + From<String>> StructuralPartialEq for State<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for State<T>
where T: RefUnwindSafe,

§

impl<T> Send for State<T>
where T: Send,

§

impl<T> Sync for State<T>
where T: Sync,

§

impl<T> Unpin for State<T>
where T: Unpin,

§

impl<T> UnwindSafe for State<T>
where T: UnwindSafe,

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,