ROSE 0.11.145.192
|
Represents one location in memory.
MemoryCell objects are used by the MemoryCellList to represent a memory state. Each memory cell has an address and a value. A cell also has an optional list of instruction addresses that wrote to that cell, and this list is manipulated by the RiscOperators separately from updating cell addresses and values and according to settings in the RiscOperators. Cells written to by RiscOperators typically contain one writer address since each write operation creates a new cell; however, the result of a dataflow merge operation might produce cells that have multiple writers.
Definition at line 31 of file MemoryCell.h.
#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryCell.h>
Classes | |
class | AllCells |
Predicate that always returns true. More... | |
class | NonWrittenCells |
Predicate for non-written cells. More... | |
class | Predicate |
Predicate for matching cells. More... | |
class | Visitor |
Visitor for traversing a cells. More... | |
class | WithFormatter |
State with formatter. More... | |
Public Types | |
using | Ptr = MemoryCellPtr |
Shared-ownership pointer. | |
Public Member Functions | |
virtual MemoryCellPtr | create (const SValuePtr &address, const SValuePtr &value) |
Creates a new memory cell object with the specified address and value. | |
virtual MemoryCellPtr | clone () const |
Creates a new deep-copy of this memory cell. | |
virtual const AddressSet & | getWriters () const |
Get writer information. | |
virtual void | eraseWriters () |
Erase all writers. | |
bool | mayAlias (const MemoryCellPtr &other, RiscOperators *addrOps) const |
Test whether two memory cells can alias one another. | |
bool | mustAlias (const MemoryCellPtr &other, RiscOperators *addrOps) const |
Test whether two memory cells must alias one another. | |
virtual void | hash (Combinatorics::Hasher &) const |
Hash the address and value. | |
virtual SValuePtr | address () const |
Property: Memory cell address. | |
virtual void | address (const SValuePtr &addr) |
Property: Memory cell address. | |
virtual SValuePtr | value () const |
Property: Memory cell value. | |
virtual void | value (const SValuePtr &v) |
Property: Memory cell value. | |
bool | insertWriter (rose_addr_t writerVa) |
Insert writer information. | |
virtual bool | insertWriters (const AddressSet &writerVas) |
Insert writer information. | |
bool | eraseWriter (rose_addr_t writerVa) |
Erase specified writers. | |
virtual bool | eraseWriters (const AddressSet &writerVas) |
Erase specified writers. | |
void | setWriter (rose_addr_t writerVa) |
Sets writer information. | |
virtual void | setWriters (const AddressSet &writerVas) |
Sets writer information. | |
const InputOutputPropertySet & | ioProperties () const |
Properties: Boolean property set. | |
InputOutputPropertySet & | ioProperties () |
Properties: Boolean property set. | |
unsigned | position () const |
Property: Position in listings. | |
void | position (unsigned p) |
Property: Position in listings. | |
void | print (std::ostream &stream) const |
Print the memory cell on a single line. | |
virtual void | print (std::ostream &, Formatter &) const |
Print the memory cell on a single line. | |
WithFormatter | with_format (Formatter &) |
Used for printing states with formatting. | |
WithFormatter | operator+ (Formatter &) |
Used for printing states with formatting. | |
WithFormatter | operator+ (const std::string &linePrefix) |
Used for printing states with formatting. | |
Static Public Member Functions | |
static MemoryCellPtr | instance (const SValuePtr &address, const SValuePtr &value) |
Instantiates a new memory cell object with the specified address and value. | |
static MemoryCellPtr | instance (const MemoryCellPtr &other) |
Instantiates a new copy of an existing cell. | |
static MemoryCellPtr | promote (const MemoryCellPtr &x) |
Protected Member Functions | |
MemoryCell (const SValuePtr &address, const SValuePtr &value) | |
MemoryCell (const MemoryCell &other) | |
Shared-ownership pointer.
Definition at line 34 of file MemoryCell.h.
|
inlinestatic |
Instantiates a new memory cell object with the specified address and value.
Definition at line 111 of file MemoryCell.h.
References address(), and value().
Referenced by create().
|
inlinestatic |
Instantiates a new copy of an existing cell.
Definition at line 116 of file MemoryCell.h.
|
inlinevirtual |
Creates a new memory cell object with the specified address and value.
Definition at line 124 of file MemoryCell.h.
References address(), instance(), and value().
|
inlinevirtual |
Creates a new deep-copy of this memory cell.
Definition at line 129 of file MemoryCell.h.
|
inlinestatic |
Definition at line 136 of file MemoryCell.h.
|
virtual |
Property: Memory cell address.
This property holds the address of the memory cell. The address must not be null.
Referenced by create(), and instance().
|
virtual |
Property: Memory cell address.
This property holds the address of the memory cell. The address must not be null.
|
virtual |
Property: Memory cell value.
This property holds the value of the memory cell. It must not be null.
Referenced by create(), and instance().
|
virtual |
Property: Memory cell value.
This property holds the value of the memory cell. It must not be null.
|
inlinevirtual |
Get writer information.
Returns all instruction addresses that have written to the specified memory address.
Definition at line 165 of file MemoryCell.h.
|
inline |
Insert writer information.
Insert the specified instruction addresses as writers for this memory cell. Returns true if any address was inserted, false if they were all already members.
Definition at line 175 of file MemoryCell.h.
References Sawyer::Container::Set< T, C, A >::insert().
|
inlinevirtual |
Insert writer information.
Insert the specified instruction addresses as writers for this memory cell. Returns true if any address was inserted, false if they were all already members.
Definition at line 176 of file MemoryCell.h.
References Sawyer::Container::Set< T, C, A >::insert().
|
inline |
Erase specified writers.
Removes the specified addresses from the set of writers for this memory cell. Returns true if none of the writer addresses existed, false if any were removed.
Definition at line 185 of file MemoryCell.h.
References Sawyer::Container::Set< T, C, A >::erase().
|
inlinevirtual |
Erase specified writers.
Removes the specified addresses from the set of writers for this memory cell. Returns true if none of the writer addresses existed, false if any were removed.
Definition at line 186 of file MemoryCell.h.
References Sawyer::Container::Set< T, C, A >::erase().
void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::setWriter | ( | rose_addr_t | writerVa | ) |
Sets writer information.
Changes writer information to be excactly the specified address or set of addresses.
|
inlinevirtual |
Sets writer information.
Changes writer information to be excactly the specified address or set of addresses.
Definition at line 195 of file MemoryCell.h.
References Sawyer::Container::Set< T, C, A >::insert().
|
inlinevirtual |
Erase all writers.
Erases all writer information for this memory cell.
Definition at line 201 of file MemoryCell.h.
References Sawyer::Container::Set< T, C, A >::clear().
|
inline |
Properties: Boolean property set.
This set holds Boolean input/output properties. If a property is present in the set then it is considered to be true, otherwise false.
Definition at line 209 of file MemoryCell.h.
|
inline |
Properties: Boolean property set.
This set holds Boolean input/output properties. If a property is present in the set then it is considered to be true, otherwise false.
Definition at line 210 of file MemoryCell.h.
|
inline |
Property: Position in listings.
For memory states that support it, this property holds an integer position of the cell relative to the other cells. For instance, a map-based memory state that uses address hashes would normally list the memory cells in order of their hashes, which makes it confusing for a human to look at because the bytes for a single multi-byte word will be scattered throughout the listing. By setting a position, the user can control the order that the four bytes are listed with respect to each other and with respect to the other cells in the memory state.
Definition at line 222 of file MemoryCell.h.
|
inline |
Property: Position in listings.
For memory states that support it, this property holds an integer position of the cell relative to the other cells. For instance, a map-based memory state that uses address hashes would normally list the memory cells in order of their hashes, which makes it confusing for a human to look at because the bytes for a single multi-byte word will be scattered throughout the listing. By setting a position, the user can control the order that the four bytes are listed with respect to each other and with respect to the other cells in the memory state.
Definition at line 223 of file MemoryCell.h.
bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::mayAlias | ( | const MemoryCellPtr & | other, |
RiscOperators * | addrOps | ||
) | const |
Test whether two memory cells can alias one another.
Two cells may alias one another if it is possible that their addresses cause them to overlap. For cells containing one-byte values, aliasing may occur if their two addresses may be equal; multi-byte cells will need to check ranges of addresses.
bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::mustAlias | ( | const MemoryCellPtr & | other, |
RiscOperators * | addrOps | ||
) | const |
Test whether two memory cells must alias one another.
Two cells must alias one another when it can be proven that their addresses cause them to overlap. For cells containing one-byte values, aliasing must occur unless their addresses can be different; multi-byte cells will need to check ranges of addresses.
|
virtual |
Hash the address and value.
This hashes the address and value for the cell, but not any other properties. The goal is that an analysis that encounters the same state twice might be able to eliminate some work, and comparing hashes is a fast first test of equality: different hashes mean the states are different.
WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::with_format | ( | Formatter & | ) |
Used for printing states with formatting.
The usual way to use this is:
WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::operator+ | ( | Formatter & | ) |
Used for printing states with formatting.
The usual way to use this is:
WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::operator+ | ( | const std::string & | linePrefix | ) |
Used for printing states with formatting.
The usual way to use this is: