ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super > Class Template Reference

Description

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
class Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >

Memory state.

Reading from an address that is either not writable (lacks MemoryMap::WRITABLE) or which is initialized (has MemoryMap::INITIALIZED) obtains the data directly from the memory map.

Addresses for each read operation are saved in a list which is nominally reset at the beginning of each instruction.

Definition at line 56 of file Semantics.h.

#include <Rose/BinaryAnalysis/Partitioner2/Semantics.h>

Inheritance diagram for Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >:
Collaboration graph
[legend]

Public Types

typedef boost::shared_ptr< MemoryStatePtr
 Shared-ownership pointer to a Semantics::MemoryState.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState
using Super = BaseSemantics::MemoryCellList
 Base type.
 
using Ptr = MemoryListStatePtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
using Super = MemoryCellState
 Base type.
 
using Ptr = MemoryCellListPtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
using Super = MemoryState
 Base type.
 
using Ptr = MemoryCellStatePtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
typedef MemoryStatePtr Ptr
 Shared-ownership pointer.
 

Public Member Functions

virtual InstructionSemantics::BaseSemantics::MemoryStatePtr create (const InstructionSemantics::BaseSemantics::SValuePtr &addrProtoval, const InstructionSemantics::BaseSemantics::SValuePtr &valProtoval) const override
 Virtual constructor.
 
virtual InstructionSemantics::BaseSemantics::MemoryStatePtr create (const InstructionSemantics::BaseSemantics::MemoryCellPtr &protocell) const override
 Virtual constructor.
 
virtual InstructionSemantics::BaseSemantics::MemoryStatePtr clone () const override
 Virtual copy constructor.
 
virtual InstructionSemantics::BaseSemantics::SValuePtr readMemory (const InstructionSemantics::BaseSemantics::SValuePtr &addr, const InstructionSemantics::BaseSemantics::SValuePtr &dflt, InstructionSemantics::BaseSemantics::RiscOperators *addrOps, InstructionSemantics::BaseSemantics::RiscOperators *valOps) override
 Read a byte from memory.
 
virtual void writeMemory (const InstructionSemantics::BaseSemantics::SValuePtr &addr, const InstructionSemantics::BaseSemantics::SValuePtr &value, InstructionSemantics::BaseSemantics::RiscOperators *addrOps, InstructionSemantics::BaseSemantics::RiscOperators *valOps) override
 Write a byte to memory.
 
virtual InstructionSemantics::BaseSemantics::SValuePtr peekMemory (const InstructionSemantics::BaseSemantics::SValuePtr &addr, const InstructionSemantics::BaseSemantics::SValuePtr &dflt, InstructionSemantics::BaseSemantics::RiscOperators *addrOps, InstructionSemantics::BaseSemantics::RiscOperators *valOps) override
 Read a byte from memory with no side effects.
 
void print (std::ostream &, InstructionSemantics::BaseSemantics::Formatter &) const override
 Print a memory state to more than one line of output.
 
bool enabled () const
 Property: Enabled.
 
void enabled (bool b)
 Property: Enabled.
 
MemoryMapPtr memoryMap () const
 The memory map for the specimen.
 
void memoryMap (const MemoryMapPtr &map)
 The memory map for the specimen.
 
const std::vector< SValuePtr > & addressesRead () const
 Property: concrete virtual addresses that were read.
 
std::vector< SValuePtr > & addressesRead ()
 Property: concrete virtual addresses that were read.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState
CellCompressor::Ptr get_cell_compressor () const
 
void set_cell_compressor (const CellCompressor::Ptr &)
 
CellCompressor::Ptr cellCompressor () const
 Callback for handling a memory read whose address matches more than one memory cell.
 
void cellCompressor (const CellCompressor::Ptr &)
 Callback for handling a memory read whose address matches more than one memory cell.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
virtual void clear () override
 Clear memory.
 
virtual bool merge (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override
 Merge memory states for data flow analysis.
 
virtual std::vector< MemoryCellPtrmatchingCells (MemoryCell::Predicate &) const override
 Find all matching cells.
 
virtual std::vector< MemoryCellPtrleadingCells (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 void hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
 Calculate a hash for this memory state.
 
bool mergeNoAliasing (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)
 Merge two states without aliasing.
 
bool mergeWithAliasing (const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)
 Merge two states with aliasing.
 
virtual bool isAllPresent (const SValuePtr &address, size_t nBytes, RiscOperators *addrOps, RiscOperators *valOps) const
 Predicate to determine whether all bytes are present.
 
template<class Iterator >
CellList scan (Iterator &cursor, const SValuePtr &addr, size_t nBits, RiscOperators *addrOps, RiscOperators *valOps) const
 Scan cell list to find matching 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.
 
bool occlusionsErased () const
 Property: erase occluded cells.
 
void occlusionsErased (bool b)
 Property: erase occluded cells.
 
virtual const CellListget_cells () const
 Returns the list of all memory cells.
 
virtual CellListget_cells ()
 Returns the list of all memory cells.
 
- 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< MemoryCellPtrallCells () const
 All cells.
 
virtual MemoryCellPtr latestWrittenCell () const
 Property: Cell most recently written.
 
virtual void latestWrittenCell (const MemoryCellPtr &cell)
 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.
 
void print (std::ostream &, const std::string prefix="") const
 Print a memory state to more than one line of output.
 
WithFormatter with_format (Formatter &)
 Used for printing memory states with formatting.
 
WithFormatter operator+ (Formatter &)
 Used for printing memory states with formatting.
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing memory states with formatting.
 

Static Public Member Functions

static Ptr instance (const InstructionSemantics::BaseSemantics::MemoryCellPtr &protocell)
 Instantiates a new memory state having specified prototypical cells and value.
 
static Ptr instance (const InstructionSemantics::BaseSemantics::SValuePtr &addrProtoval, const InstructionSemantics::BaseSemantics::SValuePtr &valProtoval)
 Instantiates a new memory state having specified prototypical value.
 
static Ptr instance (const Ptr &other)
 Instantiates a new deep copy of an existing state.
 
static Ptr promote (const InstructionSemantics::BaseSemantics::MemoryStatePtr &x)
 Recasts a base pointer to a symbolic memory state.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState
static MemoryListStatePtr instance (const BaseSemantics::MemoryCellPtr &protocell)
 Instantiates a new memory state having specified prototypical cells and value.
 
static MemoryListStatePtr instance (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 Instantiates a new memory state having specified prototypical value.
 
static MemoryListStatePtr instance (const MemoryListStatePtr &other)
 Instantiates a new deep copy of an existing state.
 
static MemoryListStatePtr promote (const BaseSemantics::MemoryStatePtr &)
 Recasts a base pointer to a symbolic memory state.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
static MemoryCellListPtr instance (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 Instantiate a new prototypical memory state.
 
static MemoryCellListPtr instance (const MemoryCellPtr &protocell)
 Instantiate a new memory state with prototypical memory cell.
 
static MemoryCellListPtr instance (const MemoryCellListPtr &other)
 Instantiate a new copy of an existing memory state.
 
static MemoryCellListPtr promote (const BaseSemantics::MemoryStatePtr &m)
 Promote a base memory state pointer to a BaseSemantics::MemoryCellList pointer.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
static MemoryCellStatePtr promote (const BaseSemantics::MemoryStatePtr &m)
 Promote a base memory state pointer to a BaseSemantics::MemoryCellState pointer.
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
static MemoryStatePtr promote (const MemoryStatePtr &)
 

Protected Member Functions

 MemoryState (const InstructionSemantics::BaseSemantics::MemoryCellPtr &protocell)
 
 MemoryState (const InstructionSemantics::BaseSemantics::SValuePtr &addrProtoval, const InstructionSemantics::BaseSemantics::SValuePtr &valProtoval)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState
 MemoryListState (const BaseSemantics::MemoryCellPtr &protocell)
 
 MemoryListState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
 MemoryListState (const MemoryListState &other)
 
BaseSemantics::SValuePtr readOrPeekMemory (const BaseSemantics::SValuePtr &address, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps, AllowSideEffects::Flag allowSideEffects)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
 MemoryCellList (const MemoryCellPtr &protocell)
 
 MemoryCellList (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryCellList (const MemoryCellList &other)
 
virtual SValuePtr mergeCellValues (const CellList &cells, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)
 
virtual AddressSet mergeCellWriters (const CellList &cells)
 
virtual InputOutputPropertySet mergeCellProperties (const CellList &cells)
 
virtual MemoryCellPtr insertReadCell (const SValuePtr &addr, const SValuePtr &value)
 
virtual MemoryCellPtr insertReadCell (const SValuePtr &addr, const SValuePtr &value, const AddressSet &writers, const InputOutputPropertySet &props)
 
- 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)
 

Additional Inherited Members

- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList
CellList cells
 
bool occlusionsErased_
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellState
MemoryCellPtr protocell
 
MemoryCellPtr latestWrittenCell_
 

Member Typedef Documentation

◆ Ptr

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
typedef boost::shared_ptr<MemoryState> Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::Ptr

Shared-ownership pointer to a Semantics::MemoryState.

See Shared ownership.

Definition at line 59 of file Semantics.h.

Constructor & Destructor Documentation

◆ MemoryState() [1/3]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::MemoryState ( )
inlineprotected

Definition at line 73 of file Semantics.h.

◆ MemoryState() [2/3]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::MemoryState ( const InstructionSemantics::BaseSemantics::MemoryCellPtr protocell)
inlineexplicitprotected

Definition at line 76 of file Semantics.h.

◆ MemoryState() [3/3]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::MemoryState ( const InstructionSemantics::BaseSemantics::SValuePtr addrProtoval,
const InstructionSemantics::BaseSemantics::SValuePtr valProtoval 
)
inlineprotected

Definition at line 79 of file Semantics.h.

Member Function Documentation

◆ instance() [1/3]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
static Ptr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::instance ( const InstructionSemantics::BaseSemantics::MemoryCellPtr protocell)
inlinestatic

Instantiates a new memory state having specified prototypical cells and value.

Definition at line 85 of file Semantics.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::create(), and Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::create().

◆ instance() [2/3]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
static Ptr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::instance ( const InstructionSemantics::BaseSemantics::SValuePtr addrProtoval,
const InstructionSemantics::BaseSemantics::SValuePtr valProtoval 
)
inlinestatic

Instantiates a new memory state having specified prototypical value.

Definition at line 90 of file Semantics.h.

◆ instance() [3/3]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
static Ptr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::instance ( const Ptr other)
inlinestatic

Instantiates a new deep copy of an existing state.

Definition at line 96 of file Semantics.h.

◆ create() [1/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
virtual InstructionSemantics::BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::create ( const InstructionSemantics::BaseSemantics::SValuePtr addrProtoval,
const InstructionSemantics::BaseSemantics::SValuePtr valProtoval 
) const
inlineoverridevirtual

Virtual constructor.

Creates a memory state having specified prototypical value.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState.

Definition at line 103 of file Semantics.h.

References Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::instance().

◆ create() [2/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
virtual InstructionSemantics::BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::create ( const InstructionSemantics::BaseSemantics::MemoryCellPtr protocell) const
inlineoverridevirtual

Virtual constructor.

Creates a new memory state having specified prototypical cells and value.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState.

Definition at line 110 of file Semantics.h.

References Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::instance().

◆ clone()

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
virtual InstructionSemantics::BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::clone ( ) const
inlineoverridevirtual

Virtual copy constructor.

Creates a new deep copy of this memory state.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState.

Definition at line 116 of file Semantics.h.

◆ promote()

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
static Ptr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::promote ( const InstructionSemantics::BaseSemantics::MemoryStatePtr x)
inlinestatic

Recasts a base pointer to a symbolic memory state.

This is a checked cast that will fail if the specified pointer does not point to an object of our class.

Definition at line 124 of file Semantics.h.

◆ enabled() [1/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
bool Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::enabled ( ) const
inline

Property: Enabled.

A memory state can be disabled, in which case writes are ignored and reads always return a copy of the provided default value. Disabling a memory state is useful for certain data-flow analyses that don't need memory.

Definition at line 137 of file Semantics.h.

◆ enabled() [2/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
void Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::enabled ( bool  b)
inline

Property: Enabled.

A memory state can be disabled, in which case writes are ignored and reads always return a copy of the provided default value. Disabling a memory state is useful for certain data-flow analyses that don't need memory.

Definition at line 138 of file Semantics.h.

◆ memoryMap() [1/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
MemoryMapPtr Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::memoryMap ( ) const
inline

The memory map for the specimen.

If this memory map exists and contains segments that have read permission but lack write permission, then any reads from such addresses will return the concrete values read from the map. Any writes to such addresses will cause warnings and no operation to be performed.

Definition at line 148 of file Semantics.h.

◆ memoryMap() [2/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
void Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::memoryMap ( const MemoryMapPtr map)
inline

The memory map for the specimen.

If this memory map exists and contains segments that have read permission but lack write permission, then any reads from such addresses will return the concrete values read from the map. Any writes to such addresses will cause warnings and no operation to be performed.

Definition at line 149 of file Semantics.h.

◆ addressesRead() [1/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
const std::vector< SValuePtr > & Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::addressesRead ( ) const
inline

Property: concrete virtual addresses that were read.

Definition at line 155 of file Semantics.h.

◆ addressesRead() [2/2]

template<class Super = InstructionSemantics::SymbolicSemantics::MemoryListState>
std::vector< SValuePtr > & Rose::BinaryAnalysis::Partitioner2::Semantics::MemoryState< Super >::addressesRead ( )
inline

Property: concrete virtual addresses that were read.

Definition at line 156 of file Semantics.h.

◆ readMemory()

Read a byte from memory.

In order to read a multi-byte value, use RiscOperators::readMemory().

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState.

Definition at line 300 of file Semantics.h.

◆ writeMemory()

template<class Super >
void MemoryState::writeMemory ( const InstructionSemantics::BaseSemantics::SValuePtr addr,
const InstructionSemantics::BaseSemantics::SValuePtr value,
InstructionSemantics::BaseSemantics::RiscOperators addrOps,
InstructionSemantics::BaseSemantics::RiscOperators valOps 
)
overridevirtual

Write a byte to memory.

In order to write a multi-byte value, use RiscOperators::writeMemory().

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState.

Definition at line 358 of file Semantics.h.

◆ peekMemory()

Read a byte from memory with no side effects.

In order to read a multi-byte value, use RiscOperators::peekMemory().

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::SymbolicSemantics::MemoryListState.

Definition at line 309 of file Semantics.h.

◆ print()

template<class Super >
void MemoryState::print ( std::ostream &  ,
InstructionSemantics::BaseSemantics::Formatter  
) const
overridevirtual

Print a memory state to more than one line of output.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList.

Definition at line 369 of file Semantics.h.

References Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::Formatter::get_line_prefix().


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