ROSE 0.11.145.192
|
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.
Definition at line 609 of file SymbolicSemantics.h.
#include <Rose/BinaryAnalysis/InstructionSemantics/SymbolicSemantics.h>
Public Member Functions | |
virtual BaseSemantics::MemoryStatePtr | create (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override |
Virtual constructor. | |
virtual BaseSemantics::MemoryStatePtr | create (const BaseSemantics::MemoryCellPtr &protocell) const |
Virtual constructor. | |
virtual BaseSemantics::AddressSpacePtr | clone () const override |
Virtual copy constructor. | |
virtual CellKey | generateCellKey (const BaseSemantics::SValuePtr &addr_) const override |
Generate a cell lookup key. | |
Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap | |
virtual MemoryCellPtr | findCell (const SValuePtr &addr) const |
Look up memory cell for address. | |
virtual bool | isAllPresent (const SValuePtr &address, size_t nBytes, RiscOperators *addrOps) const |
Predicate to determine whether all bytes are present. | |
virtual void | hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override |
Hash this address space. | |
virtual void | clear () override |
Clear memory. | |
virtual bool | merge (const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override |
Merge address spaces for data flow analysis. | |
virtual SValuePtr | readMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) override |
Read a value from memory. | |
virtual SValuePtr | peekMemory (const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) override |
Read a value from memory without side effects. | |
virtual void | writeMemory (const SValuePtr &address, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps) override |
Write a value to memory. | |
virtual void | print (std::ostream &, Formatter &) const override |
Print an address space. | |
virtual std::vector< MemoryCellPtr > | matchingCells (MemoryCell::Predicate &) const override |
Find all matching cells. | |
virtual std::vector< MemoryCellPtr > | leadingCells (MemoryCell::Predicate &) const override |
Find leading matching cells. | |
virtual void | eraseMatchingCells (MemoryCell::Predicate &) override |
Remove all matching cells. | |
virtual void | eraseLeadingCells (MemoryCell::Predicate &) override |
Remove leading matching cells. | |
virtual void | traverse (MemoryCell::Visitor &) override |
Traverse and modify cells. | |
virtual AddressSet | getWritersUnion (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override |
Writers for an address. | |
virtual AddressSet | getWritersIntersection (const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) override |
Writers for an address. | |
Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState | |
virtual void | updateReadProperties (const CellList &) |
Adjust I/O properties after reading memory. | |
virtual void | updateWriteProperties (const CellList &, InputOutputPropertySet) |
Adjust I/O properties after writing memory. | |
void | eraseNonWritten () |
Erase cells that have no writers. | |
std::vector< MemoryCellPtr > | allCells () const |
All cells. | |
virtual MemoryCellPtr | latestWrittenCell () const |
Property: Cell most recently written. | |
virtual void | latestWrittenCell (const MemoryCellPtr &) |
Property: Cell most recently written. | |
Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState | |
SValuePtr | get_addr_protoval () const |
Return the address protoval. | |
SValuePtr | get_val_protoval () const |
Return the value protoval. | |
MergerPtr | merger () const |
Property: Merger. | |
void | merger (const MergerPtr &) |
Property: Merger. | |
bool | byteRestricted () const |
Indicates whether memory cell values are required to be eight bits wide. | |
void | byteRestricted (bool) |
Indicates whether memory cell values are required to be eight bits wide. | |
ByteOrder::Endianness | get_byteOrder () const |
Memory byte order. | |
void | set_byteOrder (ByteOrder::Endianness) |
Memory byte order. | |
Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace | |
virtual SValuePtr | read (const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps) |
Read a value from the address space. | |
virtual SValuePtr | peek (const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps) |
Read without causing side effects. | |
virtual void | write (const AddressSpaceAddress &, const SValuePtr &value, RiscOperators &addrOps, RiscOperators &valOps) |
Write a value to an address space. | |
std::string | printableName () const |
Printable name for this address space. | |
Purpose | purpose () const |
Property: Purpose of this address space. | |
void | purpose (Purpose) |
Property: Purpose of this address space. | |
const std::string & | name () const |
Property: Name for this address space. | |
void | name (const std::string &) |
Property: Name for this address space. | |
void | print (std::ostream &, const std::string &prefix="") const |
Print an address space. | |
WithFormatter | with_format (Formatter &) |
Used for printing address spaces with formatting. | |
WithFormatter | operator+ (Formatter &) |
Used for printing address spaces with formatting. | |
WithFormatter | operator+ (const std::string &linePrefix) |
Used for printing address spaces with formatting. | |
Static Public Member Functions | |
static MemoryMapStatePtr | instance (const BaseSemantics::MemoryCellPtr &protocell) |
Instantiates a new memory state having specified prototypical cells and value. | |
static MemoryMapStatePtr | instance (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) |
Instantiates a new memory state having specified prototypical value. | |
static MemoryMapStatePtr | instance (const MemoryMapStatePtr &other) |
Instantiates a new deep copy of an existing state. | |
static MemoryMapStatePtr | promote (const BaseSemantics::AddressSpacePtr &) |
Recasts a base pointer to a symbolic memory state. | |
Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap | |
static MemoryCellMapPtr | promote (const AddressSpacePtr &) |
Promote a base address space pointer to a MemoryCellMap pointer. | |
Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState | |
static MemoryCellStatePtr | promote (const BaseSemantics::AddressSpacePtr &) |
Promote a base address space pointer to a BaseSemantics::MemoryCellState pointer. | |
Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState | |
static MemoryStatePtr | promote (const AddressSpacePtr &) |
Protected Member Functions | |
MemoryMapState (const BaseSemantics::MemoryCellPtr &protocell) | |
MemoryMapState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) | |
Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap | |
MemoryCellMap (const MemoryCellPtr &protocell) | |
MemoryCellMap (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) | |
MemoryCellMap (const MemoryCellMap &) | |
Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState | |
MemoryCellState (const MemoryCellPtr &protocell) | |
MemoryCellState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) | |
MemoryCellState (const MemoryCellState &other) | |
Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState | |
MemoryState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) | |
MemoryState (const MemoryStatePtr &other) | |
Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace | |
AddressSpace (Purpose, const std::string &name) | |
AddressSpace (const AddressSpace &) | |
AddressSpace & | operator= (const AddressSpace &)=delete |
Additional Inherited Members | |
Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap | |
CellMap | cells |
Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState | |
MemoryCellPtr | protocell |
MemoryCellPtr | latestWrittenCell_ |
using Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryMapState::Super = BaseSemantics::MemoryCellMap |
Base type.
Definition at line 612 of file SymbolicSemantics.h.
using Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryMapState::Ptr = MemoryMapStatePtr |
Shared-ownership pointer.
Definition at line 615 of file SymbolicSemantics.h.
|
static |
Instantiates a new memory state having specified prototypical value.
This constructor uses BaseSemantics::MemoryCell as the cell type.
|
overridevirtual |
Virtual constructor.
Creates a memory state having specified prototypical value. This constructor uses BaseSemantics::MemoryCell as the cell type.
Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.
|
virtual |
Virtual constructor.
Creates a new memory state having specified prototypical cells and value.
|
overridevirtual |
Virtual copy constructor.
Creates a new deep copy of this memory state.
Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace.
|
static |
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.
|
overridevirtual |
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::InstructionSemantics::BaseSemantics::MemoryCellMap.