Skip to content

Commit 79bde98

Browse files
Add multi path symex only checker
multi_path_symex_only_checkert is a bounded model checking algorithm that determines the status of properties through symbolic execution and constant propagation. I.e. it doesn't call the SAT solver. If desired CBMC could expose this to support a symex-only BMC algorithm. For now, this is used to implement show-vcc and program-only (which are rather orthogonal to the BMC algorithm used, but currently assume symex-only).
1 parent c3e5f4e commit 79bde98

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed

src/goto-checker/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
SRC = bmc_util.cpp \
22
incremental_goto_checker.cpp \
33
goto_verifier.cpp \
4+
multi_path_symex_only_checker.cpp \
45
properties.cpp \
56
report_util.cpp \
67
solver_factory.cpp \
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Checker using Multi-Path Symbolic Execution Only
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Checker using Multi-Path Symbolic Execution only (no SAT solving)
11+
12+
#include "multi_path_symex_only_checker.h"
13+
14+
#include <util/invariant.h>
15+
16+
#include <goto-symex/memory_model_pso.h>
17+
#include <goto-symex/show_program.h>
18+
#include <goto-symex/show_vcc.h>
19+
20+
#include "bmc_util.h"
21+
22+
multi_path_symex_only_checkert::multi_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+
symex(
30+
ui_message_handler,
31+
goto_model.get_symbol_table(),
32+
equation,
33+
options,
34+
path_storage)
35+
{
36+
setup_symex(symex, ns, options, ui_message_handler);
37+
}
38+
39+
incremental_goto_checkert::resultt multi_path_symex_only_checkert::
40+
operator()(propertiest &properties)
41+
{
42+
perform_symex();
43+
44+
output_coverage_report();
45+
46+
if(options.get_bool_option("show-vcc"))
47+
{
48+
show_vcc(options, ui_message_handler, equation);
49+
}
50+
51+
if(options.get_bool_option("program-only"))
52+
{
53+
show_program(ns, equation);
54+
}
55+
56+
return resultt(
57+
resultt::progresst::DONE,
58+
update_properties_status_from_symex_target_equation(properties, equation));
59+
}
60+
61+
void multi_path_symex_only_checkert::perform_symex()
62+
{
63+
auto get_goto_function =
64+
[this](const irep_idt &id) -> const goto_functionst::goto_functiont & {
65+
return goto_model.get_goto_function(id);
66+
};
67+
68+
// perform symbolic execution
69+
symex.symex_from_entry_point_of(get_goto_function, symex_symbol_table);
70+
71+
// add a partial ordering, if required
72+
// We won't be able to decide any properties by adding this,
73+
// but we'd like to see the entire SSA.
74+
if(equation.has_threads())
75+
{
76+
std::unique_ptr<memory_model_baset> memory_model =
77+
get_memory_model(options, ns);
78+
memory_model->set_message_handler(ui_message_handler);
79+
(*memory_model)(equation);
80+
}
81+
82+
log.statistics() << "size of program expression: "
83+
<< equation.SSA_steps.size() << " steps" << messaget::eom;
84+
85+
slice(symex, equation, ns, options, ui_message_handler);
86+
}
87+
88+
void multi_path_symex_only_checkert::output_coverage_report()
89+
{
90+
std::string cov_out = options.get_option("symex-coverage-report");
91+
if(
92+
!cov_out.empty() &&
93+
symex.output_coverage_report(goto_model.get_goto_functions(), cov_out))
94+
{
95+
log.error() << "Failed to write symex coverage report to '" << cov_out
96+
<< "'" << messaget::eom;
97+
}
98+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Checker using Multi-Path Symbolic Execution only
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Checker using Multi-Path Symbolic Execution only (no SAT solving)
11+
12+
#ifndef CPROVER_GOTO_CHECKER_MULTI_PATH_SYMEX_ONLY_CHECKER_H
13+
#define CPROVER_GOTO_CHECKER_MULTI_PATH_SYMEX_ONLY_CHECKER_H
14+
15+
#include "incremental_goto_checker.h"
16+
17+
#include "symex_bmc.h"
18+
19+
class multi_path_symex_only_checkert : public incremental_goto_checkert
20+
{
21+
public:
22+
multi_path_symex_only_checkert(
23+
const optionst &options,
24+
ui_message_handlert &ui_message_handler,
25+
abstract_goto_modelt &goto_model);
26+
27+
resultt operator()(propertiest &) override;
28+
29+
protected:
30+
abstract_goto_modelt &goto_model;
31+
symbol_tablet symex_symbol_table;
32+
namespacet ns;
33+
symex_target_equationt equation;
34+
path_fifot path_storage; // should go away
35+
symex_bmct symex;
36+
37+
void perform_symex();
38+
void output_coverage_report();
39+
};
40+
41+
#endif // CPROVER_GOTO_CHECKER_MULTI_PATH_SYMEX_ONLY_CHECKER_H

0 commit comments

Comments
 (0)