ROSE
0.11.17.0
|
Simple map-based memory state.
Memory cells (address + value pairs with additional data, ) are stored in a map-like container so that a cell can be accessed in logarithmic time given its address. The keys for the map are generated from the cell virtual addresses, either by using the address directly or by hashing it. The function that generates these keys, generateCellKey, is pure virtual.
Definition at line 29 of file MemoryCellMap.h.
#include <MemoryCellMap.h>
Public Types | |
typedef uint64_t | CellKey |
Key used to look up memory cells. More... | |
typedef Sawyer::Container::Map< CellKey, MemoryCellPtr > | CellMap |
Map of memory cells indexed by cell keys. More... | |
typedef MemoryCellMap | Ptr |
Shared-ownership pointer for a memory cell map object. More... | |
Public Member Functions | |
virtual CellKey | generateCellKey (const SValuePtr &address) const =0 |
Generate a cell lookup key. More... | |
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 | 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< MemoryCellPtr > | matchingCells (const MemoryCell::Predicate &) const ROSE_OVERRIDE |
Find all matching cells. More... | |
virtual std::vector< MemoryCellPtr > | leadingCells (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... | |
![]() | |
void | eraseNonWritten () |
Erase cells that have no writers. More... | |
std::vector< MemoryCellPtr > | allCells () 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 MemoryCellMapPtr | promote (const MemoryStatePtr &x) |
Promote a base memory state pointer to a MemoryCellMap pointer. More... | |
![]() | |
static MemoryCellStatePtr | promote (const BaseSemantics::MemoryStatePtr &m) |
Promote a base memory state pointer to a BaseSemantics::MemoryCellState pointer. More... | |
Protected Member Functions | |
MemoryCellMap (const MemoryCellPtr &protocell) | |
MemoryCellMap (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) | |
MemoryCellMap (const MemoryCellMap &other) | |
![]() | |
MemoryCellState (const MemoryCellPtr &protocell) | |
MemoryCellState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval) | |
MemoryCellState (const MemoryCellState &other) | |
Protected Attributes | |
CellMap | cells |
![]() | |
MemoryCellPtr | protocell |
MemoryCellPtr | latestWrittenCell_ |
Key used to look up memory cells.
The key is generated from the cell's virtual address either by using the address directly or by hashing it. For instance, a concrete domain might use the address directly while a symbolic domain will probably hash the symbolic address expression.
Definition at line 36 of file MemoryCellMap.h.
typedef Sawyer::Container::Map<CellKey, MemoryCellPtr> Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap::CellMap |
Map of memory cells indexed by cell keys.
Definition at line 39 of file MemoryCellMap.h.
typedef MemoryCellMap Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellMap::Ptr |
Shared-ownership pointer for a memory cell map object.
Definition at line 75 of file MemoryCellMap.h.
|
inlinestatic |
Promote a base memory state pointer to a MemoryCellMap pointer.
The memory state, x
, must have a MemoryCellMap dynamic type.
Definition at line 80 of file MemoryCellMap.h.
|
pure 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.
Implemented in Rose::BinaryAnalysis::InstructionSemantics2::SymbolicSemantics::MemoryMapState.
|
virtual |
Look up memory cell for address.
Returns the memory cell for the specified address, or a null pointer if the cell does not exist. The address is used to look up the cell in logirithmic time. This is just a convenience wrapper around matchingCells that returns either the (single) cell found by that function or a null pointer.
|
virtual |
Predicate to determine whether all bytes are present.
Returns true if bytes at the specified address and the following consecutive addresses are all present in this memory state.
|
virtual |
Find all matching cells.
Returns a vector of cells for which the predicate
returns true.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.
|
virtual |
Find leading matching cells.
Returns the vector of cells obtained by invoking the predicate on each cell and returning those leading cells for which the predicate is true. The first cell for which the predicate is false terminates the traversal and does not appear in the return value.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.
|
virtual |
Remove all matching cells.
Traverses the memory cells and removes those for which the predicate returns true.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.
|
virtual |
Remove leading matching cells.
Traverses the memory cells and removes those for which the predicate returns true. The traversal is terminated the first time the predicate returns false.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.
|
virtual |
Traverse and modify cells.
Traverse cells and optionally modify them.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.
|
virtual |
Writers for an address.
Returns the set of all writers that wrote to the specified address or any address that might alias the specified address. Memory states that don't normally compute aliases (e.g., MemoryCellMap) return only the writers for the specified address, not any aliases, and in this case getWritersUnion and getWritersIntersection return the same set.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.
|
virtual |
Writers for an address.
Returns the set of all writers that wrote to the specified address and any address that might alias the specified address. Memory states that don't normally compute aliases (e.g., MemoryCellMap) return only the writers for the specified address, not any aliases, and in this case getWritersUnion and getWritersIntersection return the same set.
Implements Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCellState.