|
| 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 | +} |
0 commit comments