ROSE  0.11.145.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell Class Reference

Description

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 29 of file MemoryCell.h.

#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryCell.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell:
Collaboration graph
[legend]

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. More...
 

Public Member Functions

virtual MemoryCellPtr create (const SValuePtr &address, const SValuePtr &value)
 Creates a new memory cell object with the specified address and value. More...
 
virtual MemoryCellPtr clone () const
 Creates a new deep-copy of this memory cell. More...
 
virtual const AddressSetgetWriters () const
 Get writer information. More...
 
virtual void eraseWriters ()
 Erase all writers. More...
 
bool mayAlias (const MemoryCellPtr &other, RiscOperators *addrOps) const
 Test whether two memory cells can alias one another. More...
 
bool mustAlias (const MemoryCellPtr &other, RiscOperators *addrOps) const
 Test whether two memory cells must alias one another. More...
 
virtual void hash (Combinatorics::Hasher &) const
 Hash the address and value. More...
 
virtual SValuePtr address () const
 Property: Memory cell address. More...
 
virtual void address (const SValuePtr &addr)
 Property: Memory cell address. More...
 
virtual SValuePtr value () const
 Property: Memory cell value. More...
 
virtual void value (const SValuePtr &v)
 Property: Memory cell value. More...
 
bool insertWriter (rose_addr_t writerVa)
 Insert writer information. More...
 
virtual bool insertWriters (const AddressSet &writerVas)
 Insert writer information. More...
 
bool eraseWriter (rose_addr_t writerVa)
 Erase specified writers. More...
 
virtual bool eraseWriters (const AddressSet &writerVas)
 Erase specified writers. More...
 
void setWriter (rose_addr_t writerVa)
 Sets writer information. More...
 
virtual void setWriters (const AddressSet &writerVas)
 Sets writer information. More...
 
const InputOutputPropertySetioProperties () const
 Properties: Boolean property set. More...
 
InputOutputPropertySetioProperties ()
 Properties: Boolean property set. More...
 
unsigned position () const
 Property: Position in listings. More...
 
void position (unsigned p)
 Property: Position in listings. More...
 
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. More...
 
WithFormatter operator+ (Formatter &)
 Used for printing states with formatting. More...
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing states with formatting. More...
 

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. More...
 
static MemoryCellPtr instance (const MemoryCellPtr &other)
 Instantiates a new copy of an existing cell. More...
 
static MemoryCellPtr promote (const MemoryCellPtr &x)
 

Protected Member Functions

 MemoryCell (const SValuePtr &address, const SValuePtr &value)
 
 MemoryCell (const MemoryCell &other)
 

Member Typedef Documentation

Shared-ownership pointer.

Definition at line 32 of file MemoryCell.h.

Member Function Documentation

static MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::instance ( const SValuePtr address,
const SValuePtr value 
)
inlinestatic

Instantiates a new memory cell object with the specified address and value.

Definition at line 109 of file MemoryCell.h.

Referenced by create().

static MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::instance ( const MemoryCellPtr other)
inlinestatic

Instantiates a new copy of an existing cell.

Definition at line 114 of file MemoryCell.h.

virtual MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::create ( const SValuePtr address,
const SValuePtr value 
)
inlinevirtual

Creates a new memory cell object with the specified address and value.

Definition at line 122 of file MemoryCell.h.

References instance().

virtual MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::clone ( ) const
inlinevirtual

Creates a new deep-copy of this memory cell.

Definition at line 127 of file MemoryCell.h.

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::address ( ) const
virtual

Property: Memory cell address.

This property holds the address of the memory cell. The address must not be null.

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::address ( const SValuePtr addr)
virtual

Property: Memory cell address.

This property holds the address of the memory cell. The address must not be null.

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::value ( ) const
virtual

Property: Memory cell value.

This property holds the value of the memory cell. It must not be null.

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::value ( const SValuePtr v)
virtual

Property: Memory cell value.

This property holds the value of the memory cell. It must not be null.

virtual const AddressSet& Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::getWriters ( ) const
inlinevirtual

Get writer information.

Returns all instruction addresses that have written to the specified memory address.

Definition at line 163 of file MemoryCell.h.

bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::insertWriter ( rose_addr_t  writerVa)
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 173 of file MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::insert().

virtual bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::insertWriters ( const AddressSet writerVas)
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 174 of file MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::insert().

bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::eraseWriter ( rose_addr_t  writerVa)
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 183 of file MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::erase().

virtual bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::eraseWriters ( const AddressSet writerVas)
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 184 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.

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::setWriters ( const AddressSet writerVas)
inlinevirtual

Sets writer information.

Changes writer information to be excactly the specified address or set of addresses.

Definition at line 193 of file MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::insert().

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::eraseWriters ( )
inlinevirtual

Erase all writers.

Erases all writer information for this memory cell.

Definition at line 199 of file MemoryCell.h.

References Sawyer::Container::Set< T, C, A >::clear().

const InputOutputPropertySet& Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::ioProperties ( ) const
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 207 of file MemoryCell.h.

InputOutputPropertySet& Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::ioProperties ( )
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 208 of file MemoryCell.h.

unsigned Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::position ( ) const
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 220 of file MemoryCell.h.

void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::position ( unsigned  p)
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 221 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 void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::hash ( Combinatorics::Hasher ) const
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:

MemoryCellPtr obj = ...;
Formatter fmt = ...;
std::cout <<"The value is: " <<(*obj+fmt) <<"\n";
WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::operator+ ( Formatter )

Used for printing states with formatting.

The usual way to use this is:

MemoryCellPtr obj = ...;
Formatter fmt = ...;
std::cout <<"The value is: " <<(*obj+fmt) <<"\n";
WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::operator+ ( const std::string &  linePrefix)

Used for printing states with formatting.

The usual way to use this is:

MemoryCellPtr obj = ...;
Formatter fmt = ...;
std::cout <<"The value is: " <<(*obj+fmt) <<"\n";

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