ROSE  0.9.9.139
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 633 of file SymbolicSemantics2.h.

#include <SymbolicSemantics2.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

typedef BaseSemantics::MemoryCellMap Super
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap
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...
 
typedef MemoryCellMap Ptr
 Shared-ownership pointer for a memory cell map object. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
typedef MemoryStatePtr Ptr
 Shared-ownership pointer for a MemoryState. 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 void clear () ROSE_OVERRIDE
 Clear memory. More...
 
virtual bool merge (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 Merge memory states for data flow analysis. More...
 
virtual SValuePtr readMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 Read a value from memory. More...
 
virtual void writeMemory (const SValuePtr &address, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 Write a value to memory. More...
 
virtual void print (std::ostream &, Formatter &) const ROSE_OVERRIDE
 Print a memory state to more than one line of output.
 
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 MemoryCell::AddressSet getWritersUnion (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) ROSE_OVERRIDE
 Writers for an address. More...
 
virtual MemoryCell::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.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
SValuePtr get_addr_protoval () const
 Return the address protoval. More...
 
SValuePtr get_val_protoval () const
 Return the value protoval. More...
 
MergerPtr merger () const
 Property: Merger. More...
 
void merger (const MergerPtr &m)
 Property: Merger. More...
 
bool byteRestricted () const
 Indicates whether memory cell values are required to be eight bits wide. More...
 
void byteRestricted (bool b)
 Indicates whether memory cell values are required to be eight bits wide. More...
 
ByteOrder::Endianness get_byteOrder () const
 Memory byte order.
 
void set_byteOrder (ByteOrder::Endianness bo)
 Memory byte order.
 
void print (std::ostream &stream, const std::string prefix="") const
 Print a memory state to more than one line of output.
 
WithFormatter with_format (Formatter &fmt)
 Used for printing memory states with formatting. More...
 
WithFormatter operator+ (Formatter &fmt)
 Used for printing memory states with formatting. More...
 

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...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
static MemoryStatePtr promote (const MemoryStatePtr &x)
 

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)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
 MemoryState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryState (const MemoryStatePtr &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 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 664 of file SymbolicSemantics2.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 670 of file SymbolicSemantics2.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 676 of file SymbolicSemantics2.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.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState.

Definition at line 685 of file SymbolicSemantics2.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 691 of file SymbolicSemantics2.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.

Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState.

Definition at line 696 of file SymbolicSemantics2.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 705 of file SymbolicSemantics2.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: