1 #ifndef ROSE_BinaryAnalysis_SmtlibSolver_H
2 #define ROSE_BinaryAnalysis_SmtlibSolver_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/BinaryAnalysis/SmtSolver.h>
7 #include <boost/filesystem.hpp>
8 #include <boost/unordered_map.hpp>
11 namespace BinaryAnalysis {
16 boost::filesystem::path executable_;
17 std::string shellArgs_;
25 explicit SmtlibSolver(
const std::string &
name,
const boost::filesystem::path &executable,
const std::string &shellArgs =
"",
27 :
SmtSolver(name, linkages), executable_(executable), shellArgs_(shellArgs) {}
41 static Ptr instance(
const std::string &name,
const boost::filesystem::path &executable,
const std::string &shellArgs =
"",
49 virtual void reset()
override;
50 virtual void generateFile(std::ostream&,
const std::vector<SymbolicExpression::Ptr> &exprs,
Definitions*)
override;
51 virtual std::string
getCommand(
const std::string &configName)
override;
54 virtual void timeout(boost::chrono::duration<double>)
override;
80 virtual Type mostType(
const std::vector<SExprTypePair>&);
83 virtual SExprTypePair outputCast(
const SExprTypePair&,
Type to);
84 virtual std::vector<SExprTypePair> outputCast(
const std::vector<SExprTypePair>&,
Type to);
93 virtual std::vector<SmtSolver::SExprTypePair> outputExpressions(
const std::vector<SymbolicExpression::Ptr>&);
102 virtual SExprTypePair outputLeftAssoc(
const std::string &func,
const std::vector<SExprTypePair>&,
Type rettype = NO_TYPE);
123 virtual SExprTypePair outputUnary(
const std::string &funcName,
const SExprTypePair &arg);
160 virtual void outputVariableDeclarations(std::ostream&,
const VariableSet&);
161 virtual void outputComments(std::ostream&,
const std::vector<SymbolicExpression::Ptr>&);
162 virtual void outputCommonSubexpressions(std::ostream&,
const std::vector<SymbolicExpression::Ptr>&);
SmtSolverPtr Ptr
Reference counting pointer for SMT solvers.
Sawyer::Container::Set< SymbolicExpression::LeafPtr, CompareLeavesByName > VariableSet
Set of variables.
virtual std::string getErrorMessage(int exitStatus) override
Error message from running a solver executable.
virtual void findVariables(const SymbolicExpression::Ptr &, VariableSet &) override
Return all variables that need declarations.
virtual void parseEvidence() override
Parses evidence of satisfiability.
Holds a value or nothing.
const std::string & name() const
Property: Name of solver for debugging.
virtual void timeout(boost::chrono::duration< double >) override
Set the timeout for the solver.
Main namespace for the ROSE library.
std::set< uint64_t > Definitions
Free variables that have been defined.
SmtSolver(const std::string &name, unsigned linkages)
Construct with name and linkage.
virtual void reset() override
Reset solver state.
void varForSet(const SymbolicExpression::InteriorPtr &set, const SymbolicExpression::LeafPtr &var)
Specify variable to use for OP_SET.
Wrapper around solvers that speak SMT-LIB.
static Ptr instance(const std::string &name, const boost::filesystem::path &executable, const std::string &shellArgs="", unsigned linkages=LM_EXECUTABLE)
Construct a solver using the specified program.
An executable is available.
virtual void outputComparisonFunctions(std::ostream &, const std::vector< SymbolicExpression::Ptr > &)
Generate functions for comparison of bitvectors.
Type
Type (sort) of expression.
Interface to Satisfiability Modulo Theory (SMT) solvers.
virtual std::string getCommand(const std::string &configName) override
Given the name of a configuration file, return the command that is needed to run the solver...
virtual Ptr create() const override
Virtual constructor.
virtual void outputBvxorFunctions(std::ostream &, const std::vector< SymbolicExpression::Ptr > &)
Generate definitions for bit-wise XOR functions.