ROSE 0.11.145.192
SymbolicMemory.h
1// Symbolic memory -- a memory state where memory is represented by an SMT function whose domain is the address space and whose
2// range are the bytes stored at those addresses.
3#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_SymbolicMemory_H
4#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_SymbolicMemory_H
5#include <featureTests.h>
6#ifdef ROSE_ENABLE_BINARY_ANALYSIS
7
8#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/MemoryState.h>
9#include <Rose/BinaryAnalysis/SymbolicExpression.h>
10
11namespace Rose {
12namespace BinaryAnalysis {
13namespace InstructionSemantics {
14namespace BaseSemantics {
15
17using SymbolicMemoryPtr = boost::shared_ptr<class SymbolicMemory>;
18
25public:
28
31
32private:
34
35public:
37
38protected:
39 // All memory states should be heap allocated; use instance(), create(), or clone() instead.
40 explicit SymbolicMemory(const SValuePtr &addrProtoval, const SValuePtr &valProtoval);
41
42public:
44 static SymbolicMemoryPtr instance(const SValuePtr &addrProtoval, const SValuePtr &valProtoval);
45
46public:
47 // documented in base class
48 virtual MemoryStatePtr create(const SValuePtr &addrProtoval, const SValuePtr &valProtoval) const override;
49
50 // documented in base class
51 virtual AddressSpacePtr clone() const override;
52
57
58public:
66public:
67 virtual bool merge(const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override;
68
69 virtual void clear() override;
70
71 virtual SValuePtr readMemory(const SValuePtr &address, const SValuePtr &dflt,
72 RiscOperators *addrOps, RiscOperators *valOps) override;
73
74 virtual void writeMemory(const SValuePtr &address, const SValuePtr &value,
75 RiscOperators *addrOps, RiscOperators *valOps) override;
76
77 virtual SValuePtr peekMemory(const SValuePtr &address, const SValuePtr &dflt,
78 RiscOperators *addrOps, RiscOperators *valOps) override;
79
80public:
81 virtual void hash(Combinatorics::Hasher&, RiscOperators *addrOps, RiscOperators *valOps) const override;
82
83 virtual void print(std::ostream&, Formatter&) const override;
84};
85
86} // namespace
87} // namespace
88} // namespace
89} // namespace
90
91#endif
92#endif
Base class for most instruction semantics RISC operators.
void expression(const SymbolicExpression::Ptr &mem)
Property: the symbolic expression for the memory.
virtual SValuePtr peekMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) override
Read a value from memory without side effects.
virtual bool merge(const AddressSpacePtr &other, RiscOperators *addrOps, RiscOperators *valOps) override
Merge address spaces for data flow analysis.
virtual void hash(Combinatorics::Hasher &, RiscOperators *addrOps, RiscOperators *valOps) const override
Hash this address space.
virtual void writeMemory(const SValuePtr &address, const SValuePtr &value, RiscOperators *addrOps, RiscOperators *valOps) override
Write a value to memory.
static SymbolicMemoryPtr promote(const AddressSpacePtr &)
Convert pointer to a SymbolicMemory pointer.
static SymbolicMemoryPtr instance(const SValuePtr &addrProtoval, const SValuePtr &valProtoval)
Instantiate a new empty memory state on the heap.
virtual AddressSpacePtr clone() const override
Deep-copy of this address space.
SymbolicExpression::Ptr expression() const
Property: the symbolic expression for the memory.
virtual SValuePtr readMemory(const SValuePtr &address, const SValuePtr &dflt, RiscOperators *addrOps, RiscOperators *valOps) override
Read a value from memory.
virtual void print(std::ostream &, Formatter &) const override
Print an address space.
virtual MemoryStatePtr create(const SValuePtr &addrProtoval, const SValuePtr &valProtoval) const override
Virtual allocating constructor.
Base classes for instruction semantics.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
boost::shared_ptr< class SymbolicMemory > SymbolicMemoryPtr
Shared-ownership pointer for symbolic memory state.
boost::shared_ptr< AddressSpace > AddressSpacePtr
Shared-ownership pointer for AddressSpace objects.
The ROSE library.