ROSE  0.11.122.0
InputVariables.h
1 #ifndef ROSE_BinaryAnalysis_Concolic_InputVariables_H
2 #define ROSE_BinaryAnalysis_Concolic_InputVariables_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_CONCOLIC_TESTING
5 #include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
6 
7 #include <Rose/BinaryAnalysis/SymbolicExpression.h>
8 
9 namespace Rose {
10 namespace BinaryAnalysis {
11 namespace Concolic {
12 
24 class InputVariables: public Sawyer::SharedObject {
25 public:
27  using Ptr = InputVariablesPtr;
28 
29 private:
30  using Variables = Sawyer::Container::Map<uint64_t, ExecutionEventPtr>; // map symbolic variable ID to program input
31  Variables variables_;
32  SymbolicExpression::ExprExprHashMap bindings_; // used for substitutions
33 
35  // Constructors, etc.
37 protected:
38  InputVariables();
39 
40 public:
42  static Ptr instance();
43 
44  ~InputVariables();
45 
47  // Properties and queries
49 public:
50 
55  const SymbolicExpression::ExprExprHashMap& bindings() const;
56 
63  ExecutionEventPtr event(const std::string &variableName) const;
64  ExecutionEventPtr event(const SymbolicExpressionPtr &variable) const;
67  // High-level functions.
70 
83  void activate(const ExecutionEventPtr&, InputType, size_t idx1 = INVALID_INDEX, size_t idx2 = INVALID_INDEX);
84 
94  void deactivate(const ExecutionEventPtr&);
95 
101  void playback(const ExecutionEventPtr&);
102 
107  void unplayback(const ExecutionEventPtr&);
108 
110  void addBindingsToSolver(const SmtSolverPtr&) const;
111 
113  void print(std::ostream&, const std::string &prefix = "") const;
114 
116  // Mid-level functions
118 
128  void define(const ExecutionEventPtr&, InputType, size_t idx1 = INVALID_INDEX, size_t idx2 = INVALID_INDEX);
129 
140  void undefine(const ExecutionEventPtr&);
141 
148  void bind(const ExecutionEventPtr&);
149 
159  void unbind(const ExecutionEventPtr&);
160 
162  // Low-level functions.
164 
169  void bindVariableValue(const SymbolicExpressionPtr &variable, const SymbolicExpressionPtr &value);
170 
175  void unbindVariableValue(const SymbolicExpressionPtr &variable);
176 };
177 
178 } // namespace
179 } // namespace
180 } // namespace
181 
182 #endif
183 #endif
Main namespace for the ROSE library.
void print(const StackVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
Print info about multiple local variables.
Base class for reference counted objects.
Definition: SharedObject.h:64
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.
Container associating values with keys.
Definition: Sawyer/Map.h:66
const size_t INVALID_INDEX(static_cast< size_t >(-1))
Invalid array index.