ROSE 0.11.145.192
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 31 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.
 

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 AddressSetgetWriters () 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 InputOutputPropertySetioProperties () const
 Properties: Boolean property set.
 
InputOutputPropertySetioProperties ()
 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)
 

Member Typedef Documentation

◆ Ptr

Shared-ownership pointer.

Definition at line 34 of file MemoryCell.h.

Member Function Documentation

◆ instance() [1/2]

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

References address(), and value().

Referenced by create().

◆ instance() [2/2]

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

Instantiates a new copy of an existing cell.

Definition at line 116 of file MemoryCell.h.

◆ create()

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

References address(), instance(), and value().

◆ clone()

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

Creates a new deep-copy of this memory cell.

Definition at line 129 of file MemoryCell.h.

◆ promote()

static MemoryCellPtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::promote ( const MemoryCellPtr x)
inlinestatic

Definition at line 136 of file MemoryCell.h.

◆ address() [1/2]

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.

Referenced by create(), and instance().

◆ address() [2/2]

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.

◆ value() [1/2]

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.

Referenced by create(), and instance().

◆ value() [2/2]

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.

◆ getWriters()

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

◆ insertWriter()

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

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

◆ insertWriters()

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

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

◆ eraseWriter()

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

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

◆ eraseWriters() [1/2]

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

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

◆ setWriter()

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.

◆ setWriters()

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

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

◆ eraseWriters() [2/2]

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCell::eraseWriters ( )
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().

◆ ioProperties() [1/2]

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

◆ ioProperties() [2/2]

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

◆ position() [1/2]

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

◆ position() [2/2]

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

◆ mayAlias()

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.

◆ mustAlias()

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.

◆ hash()

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.

◆ with_format()

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";
boost::shared_ptr< MemoryCell > MemoryCellPtr
Shared-ownership pointer to a memory cell.

◆ operator+() [1/2]

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";

◆ operator+() [2/2]

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: