ROSE  0.11.50.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState Class Reference

Description

Byte-addressable memory.

This class represents an entire state of memory via a map of memory cells. The cells are indexed in the map using the hash of their symbolic virtual address, therefore querying using an address that is equal but structurally different will fail to find the cell. This memory state does not resolve aliasing. For instance, storing a value at virtual address esp + 24 and then querying ebp + 8 will always assume that they are two non-aliasing addresses unless ROSE is able to simplify one of the expressions to exactly match the other.

Although this state has less precision than the list-based state (MemoryListState), it operatates in logorithmic time instead of linear time, and by using hashing it avoids a relatively expensive comparison of address expressions at each step.

This class should not be confused with MemoryMap. The former is used by instruction semantics to represent the state of memory such as during data-flow, while the latter is a model for mapping concrete values to concrete addresses similar to how operating systems map parts of files into an address space.

See also
MemoryListState

Definition at line 674 of file SymbolicSemantics.h.

#include <SymbolicSemantics.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState:
Collaboration graph
[legend]

Public Types

using Super = BaseSemantics::MemoryCellMap
 Base type. More...
 
using Ptr = MemoryMapStatePtr
 Shared-ownership pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap
using Super = MemoryCellState
 Base type. More...
 
using Ptr = MemoryCellMapPtr
 Shared-ownership pointer. More...
 
typedef uint64_t CellKey
 Key used to look up memory cells. More...
 
typedef Sawyer::Container::Map< CellKey, MemoryCellPtrCellMap
 Map of memory cells indexed by cell keys. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState
using Super = MemoryState
 Base type. More...
 
using Ptr = MemoryCellStatePtr
 Shared-ownership pointer. More...
 

Public Member Functions

virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE
 Virtual constructor. More...
 
virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::MemoryCellPtr &protocell) const
 Virtual constructor. More...
 
virtual BaseSemantics::MemoryStatePtr clone () const ROSE_OVERRIDE
 Virtual copy constructor. More...
 
virtual CellKey generateCellKey (const BaseSemantics::SValuePtr &addr_) const ROSE_OVERRIDE
 Generate a cell lookup key. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap
virtual MemoryCellPtr findCell (const SValuePtr &addr) const
 Look up memory cell for address. More...
 
virtual bool isAllPresent (const SValuePtr &address, size_t nBytes, RiscOperators *addrOps) const
 Predicate to determine whether all bytes are present. More...
 
virtual void hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
 
virtual void clear () ROSE_OVERRIDE
 
virtual bool merge (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 
virtual SValuePtr readMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 
virtual SValuePtr peekMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 
virtual void writeMemory (const SValuePtr &address, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 
virtual void print (std::ostream &, Formatter &) const ROSE_OVERRIDE
 
virtual std::vector< MemoryCellPtrmatchingCells (const MemoryCell::Predicate &) const ROSE_OVERRIDE
 Find all matching cells. More...
 
virtual std::vector< MemoryCellPtrleadingCells (const MemoryCell::Predicate &) const ROSE_OVERRIDE
 Find leading matching cells. More...
 
virtual void eraseMatchingCells (const MemoryCell::Predicate &) ROSE_OVERRIDE
 Remove all matching cells. More...
 
virtual void eraseLeadingCells (const MemoryCell::Predicate &) ROSE_OVERRIDE
 Remove leading matching cells. More...
 
virtual void traverse (MemoryCell::Visitor &) ROSE_OVERRIDE
 Traverse and modify cells. More...
 
virtual AddressSet getWritersUnion (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 Writers for an address. More...
 
virtual AddressSet getWritersIntersection (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 Writers for an address. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState
void eraseNonWritten ()
 Erase cells that have no writers. More...
 
std::vector< MemoryCellPtrallCells () const
 All cells. More...
 
virtual MemoryCellPtr latestWrittenCell () const
 Property: Cell most recently written.
 
virtual void latestWrittenCell (const MemoryCellPtr &cell)
 Property: Cell most recently written.
 

Static Public Member Functions

static MemoryMapStatePtr instance (const BaseSemantics::MemoryCellPtr &protocell)
 Instantiates a new memory state having specified prototypical cells and value. More...
 
static MemoryMapStatePtr instance (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 Instantiates a new memory state having specified prototypical value. More...
 
static MemoryMapStatePtr instance (const MemoryMapStatePtr &other)
 Instantiates a new deep copy of an existing state. More...
 
static MemoryMapStatePtr promote (const BaseSemantics::MemoryStatePtr &x)
 Recasts a base pointer to a symbolic memory state. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap
static MemoryCellMapPtr promote (const MemoryStatePtr &x)
 Promote a base memory state pointer to a MemoryCellMap pointer. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState
static MemoryCellStatePtr promote (const BaseSemantics::MemoryStatePtr &m)
 Promote a base memory state pointer to a BaseSemantics::MemoryCellState pointer. More...
 

Protected Member Functions

 MemoryMapState (const BaseSemantics::MemoryCellPtr &protocell)
 
 MemoryMapState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap
 MemoryCellMap (const MemoryCellPtr &protocell)
 
 MemoryCellMap (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryCellMap (const MemoryCellMap &other)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState
 MemoryCellState (const MemoryCellPtr &protocell)
 
 MemoryCellState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryCellState (const MemoryCellState &other)
 

Additional Inherited Members

- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap
CellMap cells
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState
MemoryCellPtr protocell
 
MemoryCellPtr latestWrittenCell_
 

Member Typedef Documentation

Base type.

Definition at line 677 of file SymbolicSemantics.h.

Shared-ownership pointer.

Definition at line 680 of file SymbolicSemantics.h.

Member Function Documentation

static MemoryMapStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::instance ( const BaseSemantics::MemoryCellPtr protocell)
inlinestatic

Instantiates a new memory state having specified prototypical cells and value.

Definition at line 709 of file SymbolicSemantics.h.

Referenced by create().

static MemoryMapStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::instance ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
)
inlinestatic

Instantiates a new memory state having specified prototypical value.

This constructor uses BaseSemantics::MemoryCell as the cell type.

Definition at line 715 of file SymbolicSemantics.h.

static MemoryMapStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::instance ( const MemoryMapStatePtr other)
inlinestatic

Instantiates a new deep copy of an existing state.

Definition at line 721 of file SymbolicSemantics.h.

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::create ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
) const
inlinevirtual

Virtual constructor.

Creates a memory state having specified prototypical value. This constructor uses BaseSemantics::MemoryCell as the cell type.

Definition at line 730 of file SymbolicSemantics.h.

References instance().

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::create ( const BaseSemantics::MemoryCellPtr protocell) const
inlinevirtual

Virtual constructor.

Creates a new memory state having specified prototypical cells and value.

Definition at line 736 of file SymbolicSemantics.h.

References instance().

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::clone ( ) const
inlinevirtual

Virtual copy constructor.

Creates a new deep copy of this memory state.

Definition at line 741 of file SymbolicSemantics.h.

static MemoryMapStatePtr Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::promote ( const BaseSemantics::MemoryStatePtr x)
inlinestatic

Recasts a base pointer to a symbolic memory state.

This is a checked cast that will fail if the specified pointer does not have a run-time type that is a SymbolicSemantics::MemoryMapState or subclass thereof.

Definition at line 750 of file SymbolicSemantics.h.

virtual CellKey Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState::generateCellKey ( const BaseSemantics::SValuePtr address) const
virtual

Generate a cell lookup key.

Generates a key from a virtual address. The key is used to look up the cell in a map-based container.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap.


The documentation for this class was generated from the following file: