1#ifndef ROSE_BinaryAnalysis_ModelChecker_SemanticCallbacks_H
2#define ROSE_BinaryAnalysis_ModelChecker_SemanticCallbacks_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_MODEL_CHECKER
6#include <Rose/BinaryAnalysis/ModelChecker/BasicTypes.h>
8#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
9#include <Rose/BinaryAnalysis/SmtSolver.h>
12#ifdef ROSE_HAVE_YAMLCPP
13#include <yaml-cpp/yaml.h>
17namespace BinaryAnalysis {
18namespace ModelChecker {
25class SemanticCallbacks {
28 using Ptr = SemanticCallbacksPtr;
31 const SettingsPtr mcSettings_;
34 SemanticCallbacks() =
delete;
35 explicit SemanticCallbacks(
const SettingsPtr&);
37 virtual ~SemanticCallbacks();
50 virtual void reset() {}
57 SettingsPtr mcSettings()
const;
68 virtual InstructionSemantics::BaseSemantics::SValuePtr protoval();
76 virtual InstructionSemantics::BaseSemantics::RegisterStatePtr createInitialRegisters() = 0;
84 virtual InstructionSemantics::BaseSemantics::MemoryStatePtr createInitialMemory() = 0;
93 virtual InstructionSemantics::BaseSemantics::StatePtr createInitialState();
112 virtual InstructionSemantics::BaseSemantics::RiscOperatorsPtr createRiscOperators() = 0;
138 virtual void attachModelCheckerSolver(
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&,
139 const SmtSolverPtr&) {}
149 virtual void initializeState(
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&);
157 virtual InstructionSemantics::BaseSemantics::DispatcherPtr
158 createDispatcher(
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&) = 0;
170 virtual InstructionSemantics::BaseSemantics::SValuePtr
171 instructionPointer(
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&) = 0;
176 struct CodeAddresses {
177 InstructionSemantics::BaseSemantics::SValuePtr ip;
178 std::set<rose_addr_t> addresses;
179 bool isComplete =
true;
188 virtual CodeAddresses nextCodeAddresses(
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&);
203 virtual std::vector<TagPtr>
204 preExecute(
const ExecutionUnitPtr&,
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&);
215 virtual std::vector<TagPtr>
216 postExecute(
const ExecutionUnitPtr&,
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&);
220 ExecutionUnitPtr unit;
221 SymbolicExpression::Ptr assertion;
222 SmtSolver::Evidence evidence;
240 virtual std::vector<NextUnit>
241 nextUnits(
const PathPtr&,
const InstructionSemantics::BaseSemantics::RiscOperatorsPtr&,
const SmtSolverPtr&) = 0;
257#ifdef ROSE_HAVE_YAMLCPP
258 virtual std::list<ExecutionUnitPtr>
259 parsePath(
const YAML::Node&,
const std::string &sourceName) = 0;
261 virtual std::list<ExecutionUnitPtr>
262 parsePath(
const Yaml::Node&,
const std::string &sourceName) = 0;
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.