Skip to content

Commit 518ad9d

Browse files
Add single-path symex-only checker
1 parent 49c611f commit 518ad9d

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed

src/goto-checker/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SRC = bmc_util.cpp \
77
goto_verifier.cpp \
88
multi_path_symex_checker.cpp \
99
multi_path_symex_only_checker.cpp \
10+
single_path_symex_only_checker.cpp \
1011
properties.cpp \
1112
report_util.cpp \
1213
solver_factory.cpp \
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Checker using Single Path Symbolic Execution only
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Checker using Single Path Symbolic Execution only
11+
12+
#include "single_path_symex_only_checker.h"
13+
14+
#include <chrono>
15+
16+
#include <goto-symex/memory_model_pso.h>
17+
#include <goto-symex/path_storage.h>
18+
#include <goto-symex/show_program.h>
19+
#include <goto-symex/show_vcc.h>
20+
21+
#include "bmc_util.h"
22+
#include "symex_bmc.h"
23+
24+
single_path_symex_only_checkert::single_path_symex_only_checkert(
25+
const optionst &options,
26+
ui_message_handlert &ui_message_handler,
27+
abstract_goto_modelt &goto_model)
28+
: incremental_goto_checkert(options, ui_message_handler),
29+
goto_model(goto_model),
30+
ns(goto_model.get_symbol_table(), symex_symbol_table),
31+
worklist(get_path_strategy(options.get_option("exploration-strategy")))
32+
{
33+
}
34+
35+
incremental_goto_checkert::resultt single_path_symex_only_checkert::
36+
operator()(propertiest &properties)
37+
{
38+
resultt result;
39+
40+
// First run goto-symex from entry point to initialize worklist
41+
{
42+
symex_target_equationt first_equation;
43+
symex_bmct symex(
44+
ui_message_handler,
45+
goto_model.get_symbol_table(),
46+
first_equation,
47+
options,
48+
*worklist);
49+
50+
setup_symex(symex);
51+
perform_symex(
52+
goto_model,
53+
symex,
54+
symex_symbol_table,
55+
first_equation,
56+
options,
57+
ns,
58+
ui_message_handler);
59+
60+
equation_output(symex, first_equation);
61+
update_properties_status_from_symex_target_equation(
62+
properties, result.updated_properties, first_equation);
63+
}
64+
65+
while(!worklist->empty())
66+
{
67+
path_storaget::patht &resume = worklist->peek();
68+
symex_bmct symex(
69+
ui_message_handler,
70+
goto_model.get_symbol_table(),
71+
resume.equation,
72+
options,
73+
*worklist);
74+
75+
setup_symex(symex);
76+
perform_symex(
77+
goto_model,
78+
symex,
79+
resume,
80+
symex_symbol_table,
81+
options,
82+
ns,
83+
ui_message_handler);
84+
equation_output(symex, resume.equation);
85+
update_properties_status_from_symex_target_equation(
86+
properties, result.updated_properties, resume.equation);
87+
88+
worklist->pop();
89+
}
90+
91+
// For now, we assume that NOT_REACHED properties are PASS.
92+
update_properties_status_not_checked(properties, result.updated_properties);
93+
return result;
94+
}
95+
96+
void single_path_symex_only_checkert::equation_output(
97+
const symex_bmct &symex,
98+
const symex_target_equationt &equation)
99+
{
100+
output_coverage_report(
101+
options.get_option("symex-coverage-report"),
102+
goto_model,
103+
symex,
104+
ui_message_handler);
105+
106+
if(options.get_bool_option("show-vcc"))
107+
show_vcc(options, ui_message_handler, equation);
108+
109+
if(options.get_bool_option("program-only"))
110+
show_program(ns, equation);
111+
112+
if(options.get_bool_option("validate-ssa-equation"))
113+
{
114+
symex.validate(validation_modet::INVARIANT);
115+
}
116+
}
117+
118+
void single_path_symex_only_checkert::setup_symex(symex_bmct &symex)
119+
{
120+
::setup_symex(symex, ns, options, ui_message_handler);
121+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Checker using Single Path Symbolic Execution only
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Checker using Single Path Symbolic Execution only
11+
12+
#ifndef CPROVER_GOTO_CHECKER_SINGLE_PATH_SYMEX_ONLY_CHECKER_H
13+
#define CPROVER_GOTO_CHECKER_SINGLE_PATH_SYMEX_ONLY_CHECKER_H
14+
15+
#include "incremental_goto_checker.h"
16+
17+
#include <goto-symex/path_storage.h>
18+
19+
class symex_bmct;
20+
21+
class single_path_symex_only_checkert : public incremental_goto_checkert
22+
{
23+
public:
24+
single_path_symex_only_checkert(
25+
const optionst &options,
26+
ui_message_handlert &ui_message_handler,
27+
abstract_goto_modelt &goto_model);
28+
29+
resultt operator()(propertiest &) override;
30+
31+
virtual ~single_path_symex_only_checkert() = default;
32+
33+
protected:
34+
abstract_goto_modelt &goto_model;
35+
symbol_tablet symex_symbol_table;
36+
namespacet ns;
37+
std::unique_ptr<path_storaget> worklist;
38+
39+
void equation_output(
40+
const symex_bmct &symex,
41+
const symex_target_equationt &equation);
42+
43+
virtual void setup_symex(symex_bmct &symex);
44+
};
45+
46+
#endif // CPROVER_GOTO_CHECKER_SINGLE_PATH_SYMEX_ONLY_CHECKER_H

0 commit comments

Comments
 (0)