@@ -68,9 +68,9 @@ path_searcht::resultt path_searcht::operator()(
68
68
statet &state=tmp_queue.front ();
69
69
70
70
// record we have seen it
71
- loc_data[state.get_pc ().loc_number ].visited =true ;
71
+ loc_data[state.pc ().loc_number ].visited =true ;
72
72
73
- debug () << " Loc: #" << state.get_pc ().loc_number
73
+ debug () << " Loc: #" << state.pc ().loc_number
74
74
<< " , queue: " << queue.size ()
75
75
<< " , depth: " << state.get_depth ();
76
76
for (const auto &s : queue)
@@ -102,10 +102,13 @@ path_searcht::resultt path_searcht::operator()(
102
102
103
103
if (number_of_steps%1000 ==0 )
104
104
{
105
+ time_periodt running_time=current_time ()-start_time;
105
106
status () << " Queue " << queue.size ()
106
- << " thread " << state.get_current_thread ()
107
+ << " thread " << state.get_current_thread ()+ 1
107
108
<< ' /' << state.threads .size ()
108
- << " PC " << state.pc () << messaget::eom;
109
+ << " PC " << state.pc ()
110
+ << " [" << number_of_steps << " steps, "
111
+ << running_time << " s]" << messaget::eom;
109
112
}
110
113
111
114
// an error, possibly?
@@ -264,34 +267,90 @@ bool path_searcht::drop_state(const statet &state)
264
267
{
265
268
goto_programt::const_targett pc=state.get_instruction ();
266
269
270
+ const source_locationt &source_location=pc->source_location ;
271
+
272
+ if (!source_location.is_nil () &&
273
+ last_source_location!=source_location)
274
+ {
275
+ debug () << " SYMEX at file " << source_location.get_file ()
276
+ << " line " << source_location.get_line ()
277
+ << " function " << source_location.get_function ()
278
+ << eom;
279
+
280
+ last_source_location=source_location;
281
+ }
282
+
267
283
// depth limit
268
- if (depth_limit_set && state.get_depth ()>depth_limit)
284
+ if (depth_limit>= 0 && state.get_depth ()>depth_limit)
269
285
return true ;
270
286
271
287
// context bound
272
- if (context_bound_set && state.get_no_thread_interleavings ()>context_bound)
288
+ if (context_bound>= 0 && state.get_no_thread_interleavings ()>context_bound)
273
289
return true ;
274
290
275
291
// branch bound
276
- if (branch_bound_set && state.get_no_branches ()>branch_bound)
292
+ if (branch_bound>= 0 && state.get_no_branches ()>branch_bound)
277
293
return true ;
278
294
279
295
// unwinding limit -- loops
280
- if (unwind_limit_set && state. get_instruction () ->is_backwards_goto ())
296
+ if (unwind_limit>= 0 && pc ->is_backwards_goto ())
281
297
{
298
+ bool stop=false ;
299
+
282
300
for (const auto &loop_info : state.unwinding_map )
283
301
if (loop_info.second >unwind_limit)
284
- return true ;
302
+ {
303
+ stop=true ;
304
+ break ;
305
+ }
306
+
307
+ const irep_idt id=goto_programt::loop_id (pc);
308
+ path_symex_statet::unwinding_mapt::const_iterator entry=
309
+ state.unwinding_map .find (state.pc ());
310
+ debug () << (stop?" Not unwinding" :" Unwinding" )
311
+ << " loop " << id << " iteration "
312
+ << (entry==state.unwinding_map .end ()?-1 :entry->second )
313
+ << " (" << unwind_limit << " max)"
314
+ << " " << source_location
315
+ << " thread " << state.get_current_thread () << eom;
316
+
317
+ if (stop)
318
+ return true ;
285
319
}
286
320
287
321
// unwinding limit -- recursion
288
- if (unwind_limit_set && state. get_instruction () ->is_function_call ())
322
+ if (unwind_limit>= 0 && pc ->is_function_call ())
289
323
{
324
+ bool stop=false ;
325
+
290
326
for (const auto &rec_info : state.recursion_map )
291
327
if (rec_info.second >unwind_limit)
292
- return true ;
328
+ {
329
+ stop=true ;
330
+ break ;
331
+ }
332
+
333
+ exprt function=to_code_function_call (pc->code ).function ();
334
+ const irep_idt id=function.get (ID_identifier); // could be nil
335
+ path_symex_statet::recursion_mapt::const_iterator entry=
336
+ state.recursion_map .find (id);
337
+ if (entry!=state.recursion_map .end ())
338
+ debug () << (stop?" Not unwinding" :" Unwinding" )
339
+ << " recursion " << id << " iteration "
340
+ << entry->second
341
+ << " (" << unwind_limit << " max)"
342
+ << " " << source_location
343
+ << " thread " << state.get_current_thread () << eom;
344
+
345
+ if (stop)
346
+ return true ;
293
347
}
294
348
349
+ // search time limit (--max-search-time)
350
+ if (time_limit>=0 &&
351
+ current_time ().get_t ()>start_time.get_t ()+time_limit*1000 )
352
+ return true ;
353
+
295
354
if (pc->is_assume () &&
296
355
simplify_expr (pc->guard , ns).is_false ())
297
356
{
0 commit comments