@@ -399,11 +399,11 @@ struct Model {
399
399
return ;
400
400
401
401
z3::expr x_only_path_condition = em.x_only_path_condition (depth);
402
- std::cout << x_only_path_condition << std::endl ;
402
+ dbg_trace ( " x_only_path_condition = %s \n " , x_only_path_condition. to_string (). c_str ()) ;
403
403
std::string sym_var_name = " x_" + std::to_string (depth);
404
404
auto already_exists = std::find_if (
405
405
subpaths.begin (), subpaths.end (), [x_only_path_condition, this , sym_var_name, depth](Model otherModel) {
406
- std::cout << " Compare with " << otherModel.x_only_path_condition (depth) << std::endl ;
406
+ dbg_trace ( " Compare with %s " , otherModel.x_only_path_condition (depth). to_string (). c_str ()) ;
407
407
z3::solver s (m->ctx );
408
408
s.add (z3::forall (m->ctx .bv_const (sym_var_name.c_str (), 32 ),
409
409
otherModel.x_only_path_condition (depth) ==
@@ -412,14 +412,15 @@ struct Model {
412
412
});
413
413
// Doesn't exist!
414
414
if (already_exists == subpaths.end ()) {
415
- std::cout << sym_var_name << std::endl;
416
- std::cout << " New:" << std::endl;
417
- std::cout << em.values [sym_var_name].concrete_value .value .uint64 << std::endl;
418
- std::cout << " Existing:" << std::endl;
419
- for (Model otherModel : subpaths) {
420
- std::cout << otherModel.values [sym_var_name].concrete_value .value .uint64 << std::endl;
415
+ #if TRACE
416
+ dbg_trace (" New branch value for %s, %llu\n " , sym_var_name.c_str (), em.values [sym_var_name].concrete_value .value .uint64 );
417
+ if (!subpaths.empty ()) {
418
+ dbg_trace (" Existing values:\n " );
419
+ for (Model otherModel : subpaths) {
420
+ dbg_trace (" - %llu\n " , otherModel.values [sym_var_name].concrete_value .value .uint64 );
421
+ }
421
422
}
422
- std::cout << " New subpath! " << std::endl;
423
+ # endif
423
424
em.add_partial_match (em, depth + 1 );
424
425
subpaths.push_back (em);
425
426
}
@@ -561,14 +562,16 @@ void run_concolic(const std::vector<std::string>& snapshot_messages, int max_ins
561
562
z3::solver s (m->ctx );
562
563
s.add (m->path_condition && preconditions ());
563
564
auto result = s.check ();
565
+ if (result != z3::sat) {
566
+ std::cout << m->path_condition .to_string () << std::endl;
567
+ }
564
568
assert (result == z3::sat);
565
- std::cout << " Iteration 0, fixing default values" << std::endl ;
566
- std::cout << " Model:" << std::endl ;
569
+ dbg_trace ( " Iteration 0, fixing default values\n " ) ;
570
+ dbg_trace ( " Model:\n " ) ;
567
571
z3::model model = s.get_model ();
568
572
for (int i = 0 ; i < (int )model.size (); i++) {
569
573
z3::func_decl func = model[i];
570
- std::cout << func.name () << " = "
571
- << model.get_const_interp (func) << std::endl;
574
+ dbg_trace (" - %s = %s\n " , func.name ().str ().c_str (), model.get_const_interp (func).to_string ().c_str ());
572
575
m->symbolic_concrete_values [func.name ().str ()]
573
576
.concrete_value .value .uint64 =
574
577
model.get_const_interp (func).get_numeral_uint64 ();
0 commit comments