ROSE 0.11.145.192
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace Class Referenceabstract

Description

Base class for address spaces.

An address space stores information about memory, registers, or other kinds of states that have a mapping from an address to a value. A semantic state typically has multiple address spaces.

Definition at line 88 of file AddressSpace.h.

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

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

Classes

class  WithFormatter
 Address space with formatter. More...
 

Public Types

using Ptr = AddressSpacePtr
 Shared-ownership pointer.
 
using Purpose = AddressSpacePurpose
 Purpose for the address space.
 

Public Member Functions

virtual Ptr clone () const =0
 Deep-copy of this address space.
 
virtual void clear ()=0
 Remove all values.
 
virtual SValuePtr read (const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps)
 Read a value from the address space.
 
virtual SValuePtr peek (const AddressSpaceAddress &, const SValuePtr &dflt, RiscOperators &addrOps, RiscOperators &valOps)
 Read without causing side effects.
 
virtual void write (const AddressSpaceAddress &, const SValuePtr &value, RiscOperators &addrOps, RiscOperators &valOps)
 Write a value to an address space.
 
virtual void hash (Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const =0
 Hash this address space.
 
virtual bool merge (const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps)=0
 Merge address spaces for data flow analysis.
 
std::string printableName () const
 Printable name for this address space.
 
Purpose purpose () const
 Property: Purpose of this address space.
 
void purpose (Purpose)
 Property: Purpose of this address space.
 
const std::string & name () const
 Property: Name for this address space.
 
void name (const std::string &)
 Property: Name for this address space.
 
void print (std::ostream &, const std::string &prefix="") const
 Print an address space.
 
virtual void print (std::ostream &, Formatter &) const =0
 Print an address space.
 
WithFormatter with_format (Formatter &)
 Used for printing address spaces with formatting.
 
WithFormatter operator+ (Formatter &)
 Used for printing address spaces with formatting.
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing address spaces with formatting.
 

Protected Member Functions

 AddressSpace (Purpose, const std::string &name)
 
 AddressSpace (const AddressSpace &)
 
AddressSpaceoperator= (const AddressSpace &)=delete
 

Member Typedef Documentation

◆ Ptr

Shared-ownership pointer.

Definition at line 91 of file AddressSpace.h.

◆ Purpose

Purpose for the address space.

Definition at line 94 of file AddressSpace.h.

Member Function Documentation

◆ clone()

virtual Ptr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::clone ( ) const
pure virtual

◆ purpose() [1/2]

Purpose Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::purpose ( ) const

Property: Purpose of this address space.

Every address space has a purpose to describe what kind of data it stores. It is permissible for a semantic state to have multiple address spaces that have the same value for this property but have slightly different purposes. For instance, the state might have two Purpose::MEMORY address spaces where one is for the processor's main address bus and another is used internally to store temporary values.

Thread safety: It is safe to have multiple threads reading the purpose as long as none are modifying the purpose.

◆ purpose() [2/2]

void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::purpose ( Purpose  )

Property: Purpose of this address space.

Every address space has a purpose to describe what kind of data it stores. It is permissible for a semantic state to have multiple address spaces that have the same value for this property but have slightly different purposes. For instance, the state might have two Purpose::MEMORY address spaces where one is for the processor's main address bus and another is used internally to store temporary values.

Thread safety: It is safe to have multiple threads reading the purpose as long as none are modifying the purpose.

◆ name() [1/2]

const std::string & Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::name ( ) const

Property: Name for this address space.

Every address space has a name (possibly an empty string) that is used in diagnostic messages and sometimes used to look up an address space within a semantic state.

Thread safety: It is safe for multiple threads to read the name as long as none are modifying the name.

◆ name() [2/2]

void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::name ( const std::string &  )

Property: Name for this address space.

Every address space has a name (possibly an empty string) that is used in diagnostic messages and sometimes used to look up an address space within a semantic state.

Thread safety: It is safe for multiple threads to read the name as long as none are modifying the name.

◆ clear()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::clear ( )
pure virtual

◆ read()

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::read ( const AddressSpaceAddress ,
const SValuePtr dflt,
RiscOperators addrOps,
RiscOperators valOps 
)
virtual

Read a value from the address space.

Reading a value may have side effects. For instance, reading from a certain address that hasn't previously been defined may instantiate a new value and save it at that address so that a subsequent read from the same address can return the same value. The provided default is used for this purpose.

◆ peek()

virtual SValuePtr Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::peek ( const AddressSpaceAddress ,
const SValuePtr dflt,
RiscOperators addrOps,
RiscOperators valOps 
)
virtual

Read without causing side effects.

Attempts to read a value from the specified address of this address space. If the space does not hold a value for that address then the specified default is returned. The address space is not modified by this operation.

◆ hash()

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::hash ( Combinatorics::Hasher ,
RiscOperators addrOps,
RiscOperators valOps 
) const
pure virtual

Hash this address space.

Hashes this address space by appending its data to the specified hasher. The goal is to identify when two address spaces are the "same" and allow certain kinds of analyses to take shortcuts. The address space purpose and name are not included in the hash. Separate RISC operators are passed for the addresses and values of this address space and are used if the hashing requires any operations on the addresses or values.

Implemented in Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::RegisterState, Rose::BinaryAnalysis::InstructionSemantics::NullSemantics::MemoryState, Rose::BinaryAnalysis::InstructionSemantics::ConcreteSemantics::MemoryState, Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellList, Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::MemoryCellMap, Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::RegisterStateGeneric, and Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::SymbolicMemory.

◆ merge()

virtual bool Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::merge ( const AddressSpacePtr other,
RiscOperators addrOps,
RiscOperators valOps 
)
pure virtual

◆ printableName()

std::string Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::printableName ( ) const

Printable name for this address space.

Returns a string with the name of the address space. If the address space name is a single word then the word is printed without quotes. Otherwise quotes and appropriate C-style escapes are included.

◆ print() [1/2]

void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::print ( std::ostream &  ,
const std::string &  prefix = "" 
) const

Print an address space.

The output most likely occupies more than one line and each emitted line will be terminated with a line feed.

◆ print() [2/2]

virtual void Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::print ( std::ostream &  ,
Formatter  
) const
pure virtual

◆ with_format()

WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::with_format ( Formatter )

Used for printing address spaces with formatting.

The usual way to use this is:

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

Since specifying a line prefix string for indentation purposes is such a common use case, the indentation can be given instead of a format, as in the following code that indents each line of the expression with four spaces.

std::cout <<"Memory state:\n" <<(*obj + " ");

◆ operator+() [1/2]

WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::operator+ ( Formatter )

Used for printing address spaces with formatting.

The usual way to use this is:

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

Since specifying a line prefix string for indentation purposes is such a common use case, the indentation can be given instead of a format, as in the following code that indents each line of the expression with four spaces.

std::cout <<"Memory state:\n" <<(*obj + " ");

◆ operator+() [2/2]

WithFormatter Rose::BinaryAnalysis::InstructionSemantics::BaseSemantics::AddressSpace::operator+ ( const std::string &  linePrefix)

Used for printing address spaces with formatting.

The usual way to use this is:

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

Since specifying a line prefix string for indentation purposes is such a common use case, the indentation can be given instead of a format, as in the following code that indents each line of the expression with four spaces.

std::cout <<"Memory state:\n" <<(*obj + " ");

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