Skip to content

Commit eecd1f8

Browse files
Add single-path symex-only checker
1 parent 5592d84 commit eecd1f8

File tree

3 files changed

+167
-0
lines changed

3 files changed

+167
-0
lines changed

src/goto-checker/Makefile

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

0 commit comments

Comments
 (0)