-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathconcolic_driver.hpp
More file actions
86 lines (69 loc) · 2.16 KB
/
Copy pathconcolic_driver.hpp
File metadata and controls
86 lines (69 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef CONCOLIC_DRIVER_HPP
#define CONCOLIC_DRIVER_HPP
#include "concrete_rt.hpp"
#include "config.hpp"
#include "output_report.hpp"
#include "profile.hpp"
#include "smt_solver.hpp"
#include "sym_rt.hpp"
#include "utils.hpp"
#include "z3++.h"
#include <functional>
#include <optional>
#include <set>
#include <string>
#include <variant>
#include <vector>
class ConcolicDriver {
friend class ManagedConcolicCleanup;
public:
ConcolicDriver(std::function<void()> entrypoint,
std::optional<std::string> tree_file, int branchCount);
void run();
private:
void main_exploration_loop();
std::optional<QueryResult> get_new_input();
std::vector<std::vector<SymVal>> collect_all_unexplored_path_conds();
std::function<void()> entrypoint;
std::optional<std::string> tree_file;
std::vector<NodeBox *> work_list;
std::set<NodeBox *> visited;
};
class ManagedConcolicCleanup {
const ConcolicDriver &driver;
public:
ManagedConcolicCleanup(const ConcolicDriver &driver);
~ManagedConcolicCleanup();
};
static std::monostate reset_stacks();
// A PathFrontier represents the frontier of an unexplored path. From this
// frontier, we can explore the path by executing the program from the beginning
// with the model stored in QueryResult.
struct PathFrontier {
QueryResult query_result;
NodeBox *node;
};
class PathPicker {
public:
PathPicker(std::vector<NodeBox *> &unexplored_paths,
std::set<NodeBox *> &visited);
virtual std::optional<PathFrontier> pick_path() = 0;
protected:
std::vector<NodeBox *> &unexplored_paths;
std::set<NodeBox *> &visited;
};
class DefaultPathPicker : public PathPicker {
public:
DefaultPathPicker(std::vector<NodeBox *> &unexplored_paths,
std::set<NodeBox *> &visited);
std::optional<PathFrontier> pick_path() override;
};
class RandomPathPicker : public PathPicker {
public:
RandomPathPicker(std::vector<NodeBox *> &unexplored_paths,
std::set<NodeBox *> &visited);
std::optional<PathFrontier> pick_path() override;
};
void start_concolic_execution_with(
std::function<std::monostate(std::monostate)> entrypoint, int branchCount);
#endif // CONCOLIC_DRIVER_HPP