ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState Class Reference

Description

Null memory.

This memory state does not store any values. Read operations always return (new) undefined values.

Definition at line 228 of file NullSemantics.h.

#include <Rose/BinaryAnalysis/InstructionSemantics/NullSemantics.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState:
Collaboration graph
[legend]

Public Types

using Super = BaseSemantics::MemoryState
 Base type.
 
using Ptr = MemoryStatePtr
 Shared-ownership pointer.
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
typedef MemoryStatePtr Ptr
 Shared-ownership pointer.
 

Public Member Functions

virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const override
 Virtual allocating constructor.
 
virtual BaseSemantics::MemoryStatePtr clone () const override
 Virtual allocating copy constructor.
 
virtual void clear () override
 Clear memory.
 
virtual BaseSemantics::SValuePtr readMemory (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *, BaseSemantics::RiscOperators *) override
 Read a value from memory.
 
virtual void writeMemory (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, BaseSemantics::RiscOperators *, BaseSemantics::RiscOperators *) override
 Write a value to memory.
 
virtual BaseSemantics::SValuePtr peekMemory (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *, BaseSemantics::RiscOperators *) override
 Read a value from memory without side effects.
 
virtual void hash (Combinatorics::Hasher &, BaseSemantics::RiscOperators *, BaseSemantics::RiscOperators *) const override
 Calculate a hash for this memory state.
 
virtual void print (std::ostream &, BaseSemantics::Formatter &) const override
 Print a memory state to more than one line of output.
 
virtual bool merge (const BaseSemantics::MemoryStatePtr &, BaseSemantics::RiscOperators *, BaseSemantics::RiscOperators *) override
 Merge memory states for data flow analysis.
 
- 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 MemoryStatePtr instance (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
static MemoryStatePtr promote (const BaseSemantics::MemoryStatePtr &x)
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
static MemoryStatePtr promote (const MemoryStatePtr &)
 

Protected Member Functions

 MemoryState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
 MemoryState (const MemoryStatePtr &other)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState
 MemoryState (const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
 
 MemoryState (const MemoryStatePtr &other)
 

Member Typedef Documentation

◆ Super

Base type.

Definition at line 231 of file NullSemantics.h.

◆ Ptr

Shared-ownership pointer.

Definition at line 234 of file NullSemantics.h.

Constructor & Destructor Documentation

◆ MemoryState() [1/2]

Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::MemoryState ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
)
inlineprotected

Definition at line 237 of file NullSemantics.h.

◆ MemoryState() [2/2]

Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::MemoryState ( const MemoryStatePtr other)
inlineprotected

Definition at line 240 of file NullSemantics.h.

Member Function Documentation

◆ instance()

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::instance ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
)
inlinestatic

Definition at line 244 of file NullSemantics.h.

◆ create()

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::create ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
) const
inlineoverridevirtual

Virtual allocating constructor.

Allocates and constructs a new MemoryState object having the same dynamic type as this object. A prototypical SValue must be supplied and will be used to construct any additional SValue objects needed during the operation of a MemoryState. Two prototypical values are supplied, one for addresses and another for values stored at those addresses, although they will almost always be the same.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 249 of file NullSemantics.h.

◆ clone()

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::clone ( ) const
inlineoverridevirtual

Virtual allocating copy constructor.

Creates a new MemoryState object which is a copy of this object.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 254 of file NullSemantics.h.

◆ promote()

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::promote ( const BaseSemantics::MemoryStatePtr x)
inlinestatic

Definition at line 259 of file NullSemantics.h.

◆ clear()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::clear ( )
inlineoverridevirtual

Clear memory.

Removes all memory cells from this memory state.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 266 of file NullSemantics.h.

◆ readMemory()

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::readMemory ( const BaseSemantics::SValuePtr address,
const BaseSemantics::SValuePtr dflt,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
inlineoverridevirtual

Read a value from memory.

Consults the memory represented by this MemoryState object and returns a semantic value. Depending on the semantic domain, the value can be a value that is already stored in the memory state, a supplied default value, a new value constructed from some combination of existing values and/or the default value, or anything else. For instance, in a symbolic domain the address could alias multiple existing memory locations and the implementation may choose to return a McCarthy expression. Additional data (such as SMT solvers) may be passed via the RiscOperators argument.

The size of the value being read does not necessarily need to be equal to the size of values stored in the memory state, though it typically is(1). For instance, an implementation may allow reading a 32-bit little endian value from a memory state that stores only bytes. A RiscOperators object is provided for use in these situations.

In order to support cases where an address does not match any existing location, the dflt value can be used to initialize a new memory location. The manner in which the default is used depends on the implementation. In any case, the width of the dflt value determines how much to read.

Footnote 1: A MemoryState::readMemory() call is the last in a sequence of delegations starting with RiscOperators::readMemory(). The designers of the MemoryState, State, and RiscOperators subclasses will need to coordinate to decide which layer should handle concatenating values from individual memory locations.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 268 of file NullSemantics.h.

◆ writeMemory()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::writeMemory ( const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr value,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
inlineoverridevirtual

Write a value to memory.

Consults the memory represented by this MemoryState object and possibly inserts the specified value. The details of how a value is inserted into a memory state depends entirely on the implementation in a subclass and will probably be different for each semantic domain.

A MemoryState::writeMemory() call is the last in a sequence of delegations starting with RiscOperators::writeMemory(). The designers of the MemoryState, State, and RiscOperators will need to coordinate to decide which layer (if any) should handle splitting a multi-byte value into multiple memory locations.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 275 of file NullSemantics.h.

◆ peekMemory()

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::peekMemory ( const BaseSemantics::SValuePtr address,
const BaseSemantics::SValuePtr dflt,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
inlineoverridevirtual

Read a value from memory without side effects.

This is similar to readMemory except there are no side effects. The memory state is not modified by this function.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 278 of file NullSemantics.h.

◆ hash()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::hash ( Combinatorics::Hasher ,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
) const
inlineoverridevirtual

Calculate a hash for this memory state.

This hashes the addresses and values stored in memory. The goal is to be able to identify when two memory states are the "same". An analysis might be able to take shortcuts if it encounters a state that it has seen before.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 284 of file NullSemantics.h.

◆ print()

virtual void Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::print ( std::ostream &  ,
BaseSemantics::Formatter  
) const
inlineoverridevirtual

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

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 287 of file NullSemantics.h.

◆ merge()

virtual bool Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState::merge ( const BaseSemantics::MemoryStatePtr other,
BaseSemantics::RiscOperators addrOps,
BaseSemantics::RiscOperators valOps 
)
inlineoverridevirtual

Merge memory states for data flow analysis.

Merges the other state into this state, returning true if this state changed.

Implements Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryState.

Definition at line 289 of file NullSemantics.h.


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