1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryState_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_MemoryState_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
8 #include <boost/enable_shared_from_this.hpp>
9 #include <boost/serialization/access.hpp>
10 #include <boost/serialization/export.hpp>
11 #include <boost/serialization/shared_ptr.hpp>
14 namespace BinaryAnalysis {
15 namespace InstructionSemantics {
25 class MemoryState:
public boost::enable_shared_from_this<MemoryState> {
33 ByteOrder::Endianness byteOrder_;
39 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
41 friend class boost::serialization::access;
44 void serialize(S &s,
const unsigned ) {
45 s & BOOST_SERIALIZATION_NVP(addrProtoval_);
46 s & BOOST_SERIALIZATION_NVP(valProtoval_);
47 s & BOOST_SERIALIZATION_NVP(byteOrder_);
49 s & BOOST_SERIALIZATION_NVP(byteRestricted_);
110 virtual void clear() = 0;
184 void print(std::ostream&,
const std::string prefix =
"")
const;
196 void print(std::ostream&)
const;
220 std::ostream& operator<<(std::ostream&,
const MemoryState&);
Base classes for instruction semantics.
virtual MemoryStatePtr clone() const =0
Virtual allocating copy constructor.
virtual MemoryStatePtr create(const SValuePtr &addrProtoval, const SValuePtr &valProtoval) const =0
Virtual allocating constructor.
virtual SValuePtr readMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)=0
Read a value from memory.
bool byteRestricted() const
Indicates whether memory cell values are required to be eight bits wide.
SValuePtr get_val_protoval() const
Return the value protoval.
virtual bool merge(const MemoryStatePtr &other, RiscOperators *addrOps, RiscOperators *valOps)=0
Merge memory states for data flow analysis.
Main namespace for the ROSE library.
ByteOrder::Endianness get_byteOrder() const
Memory byte order.
MergerPtr merger() const
Property: Merger.
WithFormatter with_format(Formatter &)
Used for printing memory states with formatting.
void set_byteOrder(ByteOrder::Endianness)
Memory byte order.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
virtual SValuePtr peekMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps)=0
Read a value from memory without side effects.
virtual void hash(Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const =0
Calculate a hash for this memory state.
WithFormatter operator+(Formatter &)
Used for printing memory states with formatting.
virtual void clear()=0
Clear memory.
virtual void writeMemory(const SValuePtr &addr, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps)=0
Write a value to memory.
SValuePtr get_addr_protoval() const
Return the address protoval.
Base class for most instruction semantics RISC operators.
MemoryStatePtr Ptr
Shared-ownership pointer.
void print(std::ostream &, const std::string prefix="") const
Print a memory state to more than one line of output.
Represents all memory in the state.