Skip to content

Commit a3c58a4

Browse files
author
Thomas Kiley
authored
Merge pull request #5237 from thk123/refinement-iteration-printing
Refinement iteration printing
2 parents ac74e68 + 019afa7 commit a3c58a4

File tree

6 files changed

+61
-4
lines changed

6 files changed

+61
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--incremental-loop main.0 --unwind-min 5 --unwind-max 10 --json-ui
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
"messageText": "VERIFICATION FAILED"
7+
"currentUnwinding": 1
8+
--
9+
^warning: ignoring
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--incremental-loop main.0 --unwind-min 5 --unwind-max 10 --xml-ui
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
<text>VERIFICATION FAILED</text>
7+
<current-unwinding>1</current-unwinding>
8+
<refinement-iteration>1</refinement-iteration>
9+
--
10+
^warning: ignoring

regression/cbmc-incr-oneloop/alarm2/test.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
CORE
22
main.c
33
--incremental-loop main.0 --unwind-min 5 --unwind-max 10
4+
Current unwinding: 1
45
^EXIT=10$
56
^SIGNAL=0$
67
^VERIFICATION FAILED$

src/goto-checker/single_loop_incremental_symex_checker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ single_loop_incremental_symex_checkert::single_loop_incremental_symex_checkert(
3434
equation,
3535
options,
3636
path_storage,
37-
guard_manager),
37+
guard_manager,
38+
ui_message_handler.get_ui()),
3839
property_decider(options, ui_message_handler, equation, ns)
3940
{
4041
setup_symex(symex, ns, options, ui_message_handler);

src/goto-checker/symex_bmc_incremental_one_loop.cpp

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ symex_bmc_incremental_one_loopt::symex_bmc_incremental_one_loopt(
1919
symex_target_equationt &target,
2020
const optionst &options,
2121
path_storaget &path_storage,
22-
guard_managert &guard_manager)
22+
guard_managert &guard_manager,
23+
ui_message_handlert::uit output_ui)
2324
: symex_bmct(
2425
message_handler,
2526
outer_symbol_table,
@@ -33,7 +34,8 @@ symex_bmc_incremental_one_loopt::symex_bmc_incremental_one_loopt(
3334
: std::numeric_limits<unsigned>::max()),
3435
incr_min_unwind(
3536
options.is_set("unwind-min") ? options.get_signed_int_option("unwind-min")
36-
: 0)
37+
: 0),
38+
output_ui(output_ui)
3739
{
3840
ignore_assertions =
3941
incr_min_unwind >= 1 &&
@@ -56,6 +58,7 @@ bool symex_bmc_incremental_one_loopt::should_stop_unwind(
5658
this_loop_limit = incr_max_unwind;
5759
if(unwind + 1 >= incr_min_unwind)
5860
ignore_assertions = false;
61+
5962
abort_unwind_decision = tvt(unwind >= this_loop_limit);
6063
}
6164
else
@@ -85,6 +88,7 @@ bool symex_bmc_incremental_one_loopt::should_stop_unwind(
8588
abort_unwind_decision.is_known(), "unwind decision should be taken by now");
8689
bool abort = abort_unwind_decision.is_true();
8790

91+
log_unwinding(unwind);
8892
log.statistics() << (abort ? "Not unwinding" : "Unwinding") << " loop " << id
8993
<< " iteration " << unwind;
9094

@@ -131,3 +135,29 @@ bool symex_bmc_incremental_one_loopt::resume(
131135

132136
return should_pause_symex;
133137
}
138+
void symex_bmc_incremental_one_loopt::log_unwinding(unsigned unwind)
139+
{
140+
const std::string unwind_num = std::to_string(unwind);
141+
switch(output_ui)
142+
{
143+
case ui_message_handlert::uit::PLAIN:
144+
{
145+
log.statistics() << "Current unwinding: " << unwind_num << messaget::eom;
146+
break;
147+
}
148+
case ui_message_handlert::uit::XML_UI:
149+
{
150+
xmlt xml("current-unwinding");
151+
xml.data = unwind_num;
152+
log.statistics() << xml << messaget::eom;
153+
break;
154+
}
155+
case ui_message_handlert::uit::JSON_UI:
156+
{
157+
json_objectt json;
158+
json["currentUnwinding"] = json_numbert(unwind_num);
159+
log.statistics() << json << messaget::eom;
160+
break;
161+
}
162+
}
163+
}

src/goto-checker/symex_bmc_incremental_one_loop.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define CPROVER_GOTO_CHECKER_SYMEX_BMC_INCREMENTAL_ONE_LOOP_H
1111

1212
#include "symex_bmc.h"
13+
#include <util/ui_message.h>
1314

1415
class symex_bmc_incremental_one_loopt : public symex_bmct
1516
{
@@ -20,7 +21,8 @@ class symex_bmc_incremental_one_loopt : public symex_bmct
2021
symex_target_equationt &,
2122
const optionst &,
2223
path_storaget &,
23-
guard_managert &);
24+
guard_managert &,
25+
ui_message_handlert::uit output_ui);
2426

2527
/// Return true if symex can be resumed
2628
bool from_entry_point_of(
@@ -44,6 +46,10 @@ class symex_bmc_incremental_one_loopt : public symex_bmct
4446
const symex_targett::sourcet &source,
4547
const call_stackt &context,
4648
unsigned unwind) override;
49+
50+
void log_unwinding(unsigned unwind);
51+
52+
ui_message_handlert::uit output_ui;
4753
};
4854

4955
#endif // CPROVER_GOTO_CHECKER_SYMEX_BMC_INCREMENTAL_ONE_LOOP_H

0 commit comments

Comments
 (0)