CBMC
all_properties_verifier_with_fault_localization.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Goto Verifier for Verifying all Properties and Localizing Faults
4 
5 Author: Daniel Kroening, Peter Schrammel
6 
7 \*******************************************************************/
8 
12 
13 #ifndef CPROVER_GOTO_CHECKER_ALL_PROPERTIES_VERIFIER_WITH_FAULT_LOCALIZATION_H
14 #define CPROVER_GOTO_CHECKER_ALL_PROPERTIES_VERIFIER_WITH_FAULT_LOCALIZATION_H
15 
16 #include "goto_verifier.h"
17 
19 #include "goto_trace_storage.h"
21 #include "properties.h"
22 #include "report_util.h"
23 
26 template <class incremental_goto_checkerT>
28 {
29 public:
31  const optionst &options,
37  traces(incremental_goto_checker.get_namespace())
38  {
40  }
41 
42  resultt operator()() override
43  {
44  while(true)
45  {
46  const auto result = incremental_goto_checker(properties);
48  break;
49 
50  // we've got an error trace
52  for(const auto &property_id : result.updated_properties)
53  {
54  if(properties.at(property_id).status == property_statust::FAIL)
55  {
56  // get correctly truncated error trace for property and store it
57  (void)traces.insert(
58  incremental_goto_checker.build_trace(property_id));
59 
60  fault_locations.insert(
61  {property_id,
62  incremental_goto_checker.localize_fault(property_id)});
63  }
64  }
65 
66  ++iterations;
67  }
68 
70  }
71 
72  void report() override
73  {
74  if(
75  options.get_bool_option("trace") ||
76  // currently --trace only affects plain text output
78  {
79  const trace_optionst trace_options(options);
81  properties,
82  traces,
83  trace_options,
85  iterations,
87  }
88  else
89  {
92  }
94  }
95 
97  {
98  return traces;
99  }
100 
101 protected:
103  incremental_goto_checkerT incremental_goto_checker;
104  std::size_t iterations = 1;
106  std::unordered_map<irep_idt, fault_location_infot> fault_locations;
107 };
108 
109 #endif // CPROVER_GOTO_CHECKER_ALL_PROPERTIES_VERIFIER_WITH_FAULT_LOCALIZATION_H
property_statust::FAIL
@ FAIL
The property was violated.
message_building_error_trace
void message_building_error_trace(messaget &log)
Outputs a message that an error trace is being built.
Definition: bmc_util.cpp:36
ui_message_handlert
Definition: ui_message.h:21
determine_result
resultt determine_result(const propertiest &properties)
Determines the overall result corresponding from the given properties That is PASS if all properties ...
Definition: properties.cpp:264
resultt
resultt
The result of goto verifying.
Definition: properties.h:44
goto_verifiert
An implementation of goto_verifiert checks all properties in a goto model.
Definition: goto_verifier.h:26
optionst
Definition: options.h:22
goto_verifier.h
all_properties_verifier_with_fault_localizationt::fault_locations
std::unordered_map< irep_idt, fault_location_infot > fault_locations
Definition: all_properties_verifier_with_fault_localization.h:106
all_properties_verifier_with_fault_localizationt::incremental_goto_checker
incremental_goto_checkerT incremental_goto_checker
Definition: all_properties_verifier_with_fault_localization.h:103
all_properties_verifier_with_fault_localizationt::traces
goto_trace_storaget traces
Definition: all_properties_verifier_with_fault_localization.h:105
incremental_goto_checker.h
ui_message_handlert::get_ui
virtual uit get_ui() const
Definition: ui_message.h:33
initialize_properties
propertiest initialize_properties(const abstract_goto_modelt &goto_model)
Returns the properties in the goto model.
Definition: properties.cpp:70
output_properties_with_fault_localization
void output_properties_with_fault_localization(const propertiest &properties, const std::unordered_map< irep_idt, fault_location_infot > &fault_locations, std::size_t iterations, ui_message_handlert &ui_message_handler)
Definition: report_util.cpp:536
output_overall_result
void output_overall_result(resultt result, ui_message_handlert &ui_message_handler)
Definition: report_util.cpp:677
all_properties_verifier_with_fault_localizationt::goto_model
abstract_goto_modelt & goto_model
Definition: all_properties_verifier_with_fault_localization.h:102
goto_trace_storaget::insert
const goto_tracet & insert(goto_tracet &&)
Store trace that ends in a violated assertion.
Definition: goto_trace_storage.cpp:18
goto_trace_storage.h
all_properties_verifier_with_fault_localizationt::operator()
resultt operator()() override
Check whether all properties hold.
Definition: all_properties_verifier_with_fault_localization.h:42
goto_verifiert::options
const optionst & options
Definition: goto_verifier.h:53
all_properties_verifier_with_fault_localizationt::report
void report() override
Report results.
Definition: all_properties_verifier_with_fault_localization.h:72
goto_trace_storaget
Definition: goto_trace_storage.h:21
output_properties_with_traces_and_fault_localization
void output_properties_with_traces_and_fault_localization(const propertiest &properties, const goto_trace_storaget &traces, const trace_optionst &trace_options, const std::unordered_map< irep_idt, fault_location_infot > &fault_locations, std::size_t iterations, ui_message_handlert &ui_message_handler)
Definition: report_util.cpp:579
incremental_goto_checkert::resultt::progresst::DONE
@ DONE
The goto checker has returned all results for the given set of properties.
fault_localization_provider.h
trace_optionst
Options for printing the trace using show_goto_trace.
Definition: goto_trace.h:218
ui_message_handlert::uit::PLAIN
@ PLAIN
report_util.h
optionst::get_bool_option
bool get_bool_option(const std::string &option) const
Definition: options.cpp:44
all_properties_verifier_with_fault_localizationt::iterations
std::size_t iterations
Definition: all_properties_verifier_with_fault_localization.h:104
abstract_goto_modelt
Abstract interface to eager or lazy GOTO models.
Definition: abstract_goto_model.h:20
all_properties_verifier_with_fault_localizationt::get_traces
const goto_trace_storaget & get_traces() const
Definition: all_properties_verifier_with_fault_localization.h:96
properties.h
goto_verifiert::ui_message_handler
ui_message_handlert & ui_message_handler
Definition: goto_verifier.h:54
all_properties_verifier_with_fault_localizationt
Requires an incremental goto checker that is a goto_trace_providert and fault_localization_providert.
Definition: all_properties_verifier_with_fault_localization.h:27
goto_verifiert::properties
propertiest properties
Definition: goto_verifier.h:56
goto_verifiert::log
messaget log
Definition: goto_verifier.h:55
all_properties_verifier_with_fault_localizationt::all_properties_verifier_with_fault_localizationt
all_properties_verifier_with_fault_localizationt(const optionst &options, ui_message_handlert &ui_message_handler, abstract_goto_modelt &goto_model)
Definition: all_properties_verifier_with_fault_localization.h:30