ROSE  0.9.9.109
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory Class Reference

Description

Purely symbolic memory state.

This memory state stores memory as a symbolic expression consisting of read and/or write operations expressed symbolically. The memory state can be passed to SMT solvers and included in if-then-else symbolic expressions to represent different memory states according to different paths through a specimen.

Definition at line 22 of file SymbolicMemory2.h.

#include <SymbolicMemory2.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory:
Collaboration graph
[legend]

Public Member Functions

virtual MemoryStatePtr create (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) const ROSE_OVERRIDE
 Virtual allocating constructor. More...
 
virtual MemoryStatePtr clone () const ROSE_OVERRIDE
 Virtual allocating copy constructor. More...
 
virtual bool merge (const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
 Merge memory states for data flow analysis. More...
 
virtual void clear () ROSE_OVERRIDE
 Clear memory. 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.
 
SymbolicExpr::Ptr expression () const
 Property: the symbolic expression for the memory.
 
void expression (const SymbolicExpr::Ptr &mem)
 Property: the symbolic expression for the memory.
 
- 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 SymbolicMemoryPtr instance (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 Instantiate a new empty memory state on the heap. More...
 
static SymbolicMemoryPtr promote (const MemoryStatePtr &x)
 Convert pointer to a SymbolicMemory pointer. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
static MemoryStatePtr promote (const MemoryStatePtr &x)
 

Protected Member Functions

 SymbolicMemory (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
 MemoryState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryState (const MemoryStatePtr &other)
 

Additional Inherited Members

- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryState
typedef MemoryStatePtr Ptr
 Shared-ownership pointer for a MemoryState. More...
 

Member Function Documentation

static SymbolicMemoryPtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory::instance ( const SValuePtr addrProtoval,
const SValuePtr valProtoval 
)
inlinestatic

Instantiate a new empty memory state on the heap.

Definition at line 34 of file SymbolicMemory2.h.

Referenced by create().

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

Virtual allocating constructor.

Allocates and constructs a new MemoryState object having the same dynamic type as this object. A prototypical SValue must be supplied and will be used to construct any additional SValue objects needed during the operation of a MemoryState. Two prototypical values are supplied, one for addresses and another for values stored at those addresses, although they will almost always be the same.

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

Definition at line 40 of file SymbolicMemory2.h.

References instance().

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

Virtual allocating copy constructor.

Creates a new MemoryState object which is a copy of this object.

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

Definition at line 45 of file SymbolicMemory2.h.

static SymbolicMemoryPtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory::promote ( const MemoryStatePtr x)
inlinestatic

Convert pointer to a SymbolicMemory pointer.

Converts x to a SymbolicMemoryPtr and asserts that it is non-null.

Definition at line 52 of file SymbolicMemory2.h.

virtual bool Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory::merge ( const BaseSemantics::MemoryStatePtr other,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
virtual

Merge memory states for data flow analysis.

Merges the other state into this state, returning true if this state changed.

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

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory::clear ( )
virtual

Clear memory.

Removes all memory cells from this memory state.

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

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory::readMemory ( const SValuePtr address,
const SValuePtr dflt,
RiscOperators addrOps,
RiscOperators valOps 
)
virtual

Read a value from memory.

Consults the memory represented by this MemoryState object and returns a semantic value. Depending on the semantic domain, the value can be a value that is already stored in the memory state, a supplied default value, a new value constructed from some combination of existing values and/or the default value, or anything else. For instance, in a symbolic domain the address could alias multiple existing memory locations and the implementation may choose to return a McCarthy expression. Additional data (such as SMT solvers) may be passed via the RiscOperators argument.

The size of the value being read does not necessarily need to be equal to the size of values stored in the memory state, though it typically is(1). For instance, an implementation may allow reading a 32-bit little endian value from a memory state that stores only bytes. A RiscOperators object is provided for use in these situations.

In order to support cases where an address does not match any existing location, the dflt value can be used to initialize a new memory location. The manner in which the default is used depends on the implementation. In any case, the width of the dflt value determines how much to read.

Footnote 1: A MemoryState::readMemory() call is the last in a sequence of delegations starting with RiscOperators::readMemory(). The designers of the MemoryState, State, and RiscOperators subclasses will need to coordinate to decide which layer should handle concatenating values from individual memory locations.

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

virtual void Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::SymbolicMemory::writeMemory ( const SValuePtr addr,
const SValuePtr value,
RiscOperators addrOps,
RiscOperators valOps 
)
virtual

Write a value to memory.

Consults the memory represented by this MemoryState object and possibly inserts the specified value. The details of how a value is inserted into a memory state depends entirely on the implementation in a subclass and will probably be different for each semantic domain.

A MemoryState::writeMemory() call is the last in a sequence of delegations starting with RiscOperators::writeMemory(). The designers of the MemoryState, State, and RiscOperators will need to coordinate to decide which layer (if any) should handle splitting a multi-byte value into multiple memory locations.

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


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