@@ -68,9 +68,9 @@ path_searcht::resultt path_searcht::operator()(
6868 statet &state=tmp_queue.front ();
6969
7070 // record we have seen it
71- loc_data[state.get_pc ().loc_number ].visited =true ;
71+ loc_data[state.pc ().loc_number ].visited =true ;
7272
73- debug () << " Loc: #" << state.get_pc ().loc_number
73+ debug () << " Loc: #" << state.pc ().loc_number
7474 << " , queue: " << queue.size ()
7575 << " , depth: " << state.get_depth ();
7676 for (const auto &s : queue)
@@ -102,10 +102,13 @@ path_searcht::resultt path_searcht::operator()(
102102
103103 if (number_of_steps%1000 ==0 )
104104 {
105+ time_periodt running_time=current_time ()-start_time;
105106 status () << " Queue " << queue.size ()
106- << " thread " << state.get_current_thread ()
107+ << " thread " << state.get_current_thread ()+ 1
107108 << ' /' << state.threads .size ()
108- << " PC " << state.pc () << messaget::eom;
109+ << " PC " << state.pc ()
110+ << " [" << number_of_steps << " steps, "
111+ << running_time << " s]" << messaget::eom;
109112 }
110113
111114 // an error, possibly?
@@ -264,34 +267,90 @@ bool path_searcht::drop_state(const statet &state)
264267{
265268 goto_programt::const_targett pc=state.get_instruction ();
266269
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+
267283 // depth limit
268- if (depth_limit_set && state.get_depth ()>depth_limit)
284+ if (depth_limit>= 0 && state.get_depth ()>depth_limit)
269285 return true ;
270286
271287 // 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)
273289 return true ;
274290
275291 // branch bound
276- if (branch_bound_set && state.get_no_branches ()>branch_bound)
292+ if (branch_bound>= 0 && state.get_no_branches ()>branch_bound)
277293 return true ;
278294
279295 // unwinding limit -- loops
280- if (unwind_limit_set && state. get_instruction () ->is_backwards_goto ())
296+ if (unwind_limit>= 0 && pc ->is_backwards_goto ())
281297 {
298+ bool stop=false ;
299+
282300 for (const auto &loop_info : state.unwinding_map )
283301 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 ;
285319 }
286320
287321 // unwinding limit -- recursion
288- if (unwind_limit_set && state. get_instruction () ->is_function_call ())
322+ if (unwind_limit>= 0 && pc ->is_function_call ())
289323 {
324+ bool stop=false ;
325+
290326 for (const auto &rec_info : state.recursion_map )
291327 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 ;
293347 }
294348
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+
295354 if (pc->is_assume () &&
296355 simplify_expr (pc->guard , ns).is_false ())
297356 {
0 commit comments