Skip to content

Commit 019afa7

Browse files
author
thk123
committed
Extend the printing to be enabled for both json and plain text ouput
1 parent 89203e2 commit 019afa7

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
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

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/symex_bmc_incremental_one_loop.cpp

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,7 @@ bool symex_bmc_incremental_one_loopt::should_stop_unwind(
8888
abort_unwind_decision.is_known(), "unwind decision should be taken by now");
8989
bool abort = abort_unwind_decision.is_true();
9090

91-
92-
if(output_ui == ui_message_handlert::uit::XML_UI)
93-
{
94-
xmlt xml("current-unwinding");
95-
xml.data = std::to_string(unwind);
96-
log.statistics() << xml;
97-
}
98-
91+
log_unwinding(unwind);
9992
log.statistics() << (abort ? "Not unwinding" : "Unwinding") << " loop " << id
10093
<< " iteration " << unwind;
10194

@@ -142,3 +135,29 @@ bool symex_bmc_incremental_one_loopt::resume(
142135

143136
return should_pause_symex;
144137
}
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class symex_bmc_incremental_one_loopt : public symex_bmct
4747
const call_stackt &context,
4848
unsigned unwind) override;
4949

50+
void log_unwinding(unsigned unwind);
51+
5052
ui_message_handlert::uit output_ui;
5153
};
5254

0 commit comments

Comments
 (0)