@@ -153,9 +153,14 @@ bmct::run_decision_procedure(prop_convt &prop_conv)
153
153
154
154
void bmct::report_success ()
155
155
{
156
- result () << bold << " VERIFICATION SUCCESSFUL" << reset << eom;
156
+ report_success (*this , ui_message_handler);
157
+ }
157
158
158
- switch (ui_message_handler.get_ui ())
159
+ void bmct::report_success (messaget &log, ui_message_handlert &handler)
160
+ {
161
+ log.result () << log.bold << " VERIFICATION SUCCESSFUL" << log.reset << log.eom ;
162
+
163
+ switch (handler.get_ui ())
159
164
{
160
165
case ui_message_handlert::uit::PLAIN:
161
166
break ;
@@ -164,25 +169,30 @@ void bmct::report_success()
164
169
{
165
170
xmlt xml (" cprover-status" );
166
171
xml.data =" SUCCESS" ;
167
- result () << xml;
172
+ log. result () << xml;
168
173
}
169
174
break ;
170
175
171
176
case ui_message_handlert::uit::JSON_UI:
172
177
{
173
178
json_objectt json_result;
174
179
json_result[" cProverStatus" ]=json_stringt (" success" );
175
- result () << json_result;
180
+ log. result () << json_result;
176
181
}
177
182
break ;
178
183
}
179
184
}
180
185
181
186
void bmct::report_failure ()
182
187
{
183
- result () << bold << " VERIFICATION FAILED" << reset << eom;
188
+ report_failure (*this , ui_message_handler);
189
+ }
184
190
185
- switch (ui_message_handler.get_ui ())
191
+ void bmct::report_failure (messaget &log, ui_message_handlert &handler)
192
+ {
193
+ log.result () << log.bold << " VERIFICATION FAILED" << log.reset << log.eom ;
194
+
195
+ switch (handler.get_ui ())
186
196
{
187
197
case ui_message_handlert::uit::PLAIN:
188
198
break ;
@@ -191,15 +201,15 @@ void bmct::report_failure()
191
201
{
192
202
xmlt xml (" cprover-status" );
193
203
xml.data =" FAILURE" ;
194
- result () << xml;
204
+ log. result () << xml;
195
205
}
196
206
break ;
197
207
198
208
case ui_message_handlert::uit::JSON_UI:
199
209
{
200
210
json_objectt json_result;
201
211
json_result[" cProverStatus" ]=json_stringt (" failure" );
202
- result () << json_result;
212
+ log. result () << json_result;
203
213
}
204
214
break ;
205
215
}
@@ -260,9 +270,6 @@ safety_checkert::resultt bmct::execute(
260
270
const goto_functionst &goto_functions =
261
271
goto_model.get_goto_functions ();
262
272
263
- if (symex.should_pause_symex )
264
- return safety_checkert::resultt::PAUSED;
265
-
266
273
// This provides the driver program the opportunity to do things like a
267
274
// symbol-table or goto-functions dump instead of actually running the
268
275
// checker, like show-vcc except driver-program specific.
@@ -272,9 +279,14 @@ safety_checkert::resultt bmct::execute(
272
279
if (driver_callback_after_symex && driver_callback_after_symex ())
273
280
return safety_checkert::resultt::SAFE; // to indicate non-error
274
281
275
- // add a partial ordering, if required
276
282
if (equation.has_threads ())
277
283
{
284
+ // When doing path exploration in a concurrent setting, we should avoid
285
+ // model-checking the program until we reach the end of a path.
286
+ if (symex.should_pause_symex )
287
+ return safety_checkert::resultt::PAUSED;
288
+
289
+ // add a partial ordering, if required
278
290
memory_model->set_message_handler (get_message_handler ());
279
291
(*memory_model)(equation);
280
292
}
@@ -318,6 +330,8 @@ safety_checkert::resultt bmct::execute(
318
330
!options.get_bool_option (" program-only" ) &&
319
331
symex.get_remaining_vccs () == 0 )
320
332
{
333
+ if (options.is_set (" paths" ))
334
+ return safety_checkert::resultt::PAUSED;
321
335
report_success ();
322
336
output_graphml (resultt::SAFE);
323
337
return safety_checkert::resultt::SAFE;
@@ -329,7 +343,10 @@ safety_checkert::resultt bmct::execute(
329
343
return safety_checkert::resultt::SAFE;
330
344
}
331
345
332
- return decide (goto_functions, prop_conv);
346
+ if (!options.is_set (" paths" ) || symex.path_segment_vccs > 0 )
347
+ return decide (goto_functions, prop_conv);
348
+
349
+ return safety_checkert::resultt::PAUSED;
333
350
}
334
351
335
352
catch (const std::string &error_str)
@@ -396,6 +413,10 @@ void bmct::slice()
396
413
statistics () << " Generated " << symex.get_total_vccs () << " VCC(s), "
397
414
<< symex.get_remaining_vccs ()
398
415
<< " remaining after simplification" << eom;
416
+
417
+ if (options.is_set (" paths" ))
418
+ statistics () << " Generated " << symex.path_segment_vccs
419
+ << " new VCC(s) along current path segment" << eom;
399
420
}
400
421
401
422
safety_checkert::resultt bmct::run (
@@ -484,8 +505,8 @@ int bmct::do_language_agnostic_bmc(
484
505
std::function<void (bmct &, const symbol_tablet &)> driver_configure_bmc,
485
506
std::function<bool(void )> callback_after_symex)
486
507
{
487
- safety_checkert::resultt final_result = safety_checkert::resultt::UNKNOWN ;
488
- safety_checkert::resultt tmp_result = safety_checkert::resultt::UNKNOWN ;
508
+ safety_checkert::resultt final_result = safety_checkert::resultt::SAFE ;
509
+ safety_checkert::resultt tmp_result = safety_checkert::resultt::SAFE ;
489
510
const symbol_tablet &symbol_table = model.get_symbol_table ();
490
511
messaget message (ui);
491
512
std::unique_ptr<path_storaget> worklist;
@@ -544,11 +565,6 @@ int bmct::do_language_agnostic_bmc(
544
565
545
566
while (!worklist->empty ())
546
567
{
547
- if (tmp_result != safety_checkert::resultt::PAUSED)
548
- message.status () << " ___________________________\n "
549
- << " Starting new path (" << worklist->size ()
550
- << " to go)\n "
551
- << message.eom ;
552
568
cbmc_solverst solvers (
553
569
opts,
554
570
symbol_table,
@@ -603,13 +619,15 @@ int bmct::do_language_agnostic_bmc(
603
619
switch (final_result)
604
620
{
605
621
case safety_checkert::resultt::SAFE:
622
+ if (opts.is_set (" paths" ))
623
+ report_success (message, ui);
606
624
return CPROVER_EXIT_VERIFICATION_SAFE;
607
625
case safety_checkert::resultt::UNSAFE:
626
+ if (opts.is_set (" paths" ))
627
+ report_failure (message, ui);
608
628
return CPROVER_EXIT_VERIFICATION_UNSAFE;
609
629
case safety_checkert::resultt::ERROR:
610
630
return CPROVER_EXIT_INTERNAL_ERROR;
611
- case safety_checkert::resultt::UNKNOWN:
612
- return CPROVER_EXIT_INTERNAL_ERROR;
613
631
case safety_checkert::resultt::PAUSED:
614
632
UNREACHABLE;
615
633
}
0 commit comments