1#ifndef ROSE_BinaryAnalysis_Concolic_SharedMemory_H
2#define ROSE_BinaryAnalysis_Concolic_SharedMemory_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_CONCOLIC_TESTING
6#include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
7#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
8#include <Rose/BinaryAnalysis/SymbolicExpression.h>
11#include <Sawyer/Optional.h>
12#include <Sawyer/SharedObject.h>
15namespace BinaryAnalysis {
25class SharedMemoryContext {
27 SharedMemoryContext() =
delete;
30 SharedMemoryContext(
const ArchitecturePtr&,
const ExecutionEventPtr &sharedMemoryEvent);
33 SharedMemoryContext(
const ArchitecturePtr&,
const Emulation::RiscOperatorsPtr&,
34 const ExecutionEventPtr &sharedMemoryEvent);
37 SharedMemoryContext(
const ArchitecturePtr&,
const Emulation::RiscOperatorsPtr&, rose_addr_t accessingInstructionVa,
38 rose_addr_t accessedVa,
const SymbolicExpression::Ptr &value);
40 virtual ~SharedMemoryContext();
55 ArchitecturePtr architecture;
60 Emulation::RiscOperatorsPtr
ops;
74 ExecutionEventPtr sharedMemoryEvent;
83 SymbolicExpression::Ptr valueRead;
88 SymbolicExpression::Ptr valueWritten;
99 using Ptr = SharedMemoryCallbackPtr;
106 virtual ~SharedMemoryCallback();
108 SharedMemoryCallback(
const std::string &name);
109 SharedMemoryCallback(
const AddressInterval&,
const std::string &name);
113 static void registerFactory(
const Ptr &factory);
119 static bool deregisterFactory(
const Ptr &factory);
125 static std::vector<Ptr> registeredFactories();
132 static Ptr forge(
const AddressInterval &where,
const Yaml::Node &config);
135 virtual bool matchFactory(
const Yaml::Node &config)
const;
141 virtual Ptr instanceFromFactory(
const AddressInterval &where,
const Yaml::Node &config)
const;
144 bool isFactory()
const;
150 const std::string& name()
const;
151 void name(
const std::string&);
163 void registrationVas(
const AddressInterval&);
167 void hello(
const SharedMemoryContext&)
const;
174 virtual void playback(SharedMemoryContext&) = 0;
194 virtual void handlePreSharedMemory(SharedMemoryContext&) = 0;
195 virtual void handlePostSharedMemory(
const SharedMemoryContext&) {}
203 void normalRead(SharedMemoryContext&)
const;
209 void notAnInput(SharedMemoryContext&)
const;
217 void returns(SharedMemoryContext&,
const SymbolicExpression::Ptr&)
const;
218 void returns(SharedMemoryContext&,
const InstructionSemantics::BaseSemantics::SValuePtr&)
const;
226 SymbolicExpressionPtr inputVariable(
const SharedMemoryContext&)
const;
229 virtual bool operator()(
bool handled, SharedMemoryContext&)
final;
Base class for reference counted objects.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
Sawyer::Container::Interval< Address > AddressInterval
An interval of addresses.
const char * direction(int64_t)
Convert CGFunction::iterator::direction enum constant to a string.
const char * ConcolicPhase(int64_t)
Convert Rose::BinaryAnalysis::Concolic::ConcolicPhase enum constant to a string.
const char * IoDirection(int64_t)
Convert Rose::BinaryAnalysis::Concolic::IoDirection enum constant to a string.
const char * ops(int64_t)
Convert ops enum constant to a string.