void bmct::show_vcc_json(std::ostream &out) { json_objectt json_result; json_arrayt &json_vccs=json_result["vccs"].make_array(); languagest languages(ns, new_ansi_c_language()); bool has_threads=equation.has_threads(); for(symex_target_equationt::SSA_stepst::iterator s_it=equation.SSA_steps.begin(); s_it!=equation.SSA_steps.end(); s_it++) { if(!s_it->is_assert()) continue; // vcc object json_objectt &object=json_vccs.push_back(jsont()).make_object(); const source_locationt &source_location=s_it->source.pc->source_location; if(source_location.is_not_nil()) object["sourceLocation"]=json(source_location); const std::string &s=s_it->comment; if(!s.empty()) object["comment"]=json_stringt(s); // we show everything in case there are threads symex_target_equationt::SSA_stepst::const_iterator last_it=has_threads?equation.SSA_steps.end():s_it; json_arrayt &json_constraints=object["constraints"].make_array(); for(symex_target_equationt::SSA_stepst::const_iterator p_it =equation.SSA_steps.begin(); p_it!=last_it; p_it++) { if((p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) && !p_it->ignore) { std::string string_value; languages.from_expr(p_it->cond_expr, string_value); json_constraints.push_back(json_stringt(string_value)); } } std::string string_value; languages.from_expr(s_it->cond_expr, string_value); object["expression"]=json_stringt(string_value); } out << ",\n" << json_result; }
void bmct::show_vcc_plain(std::ostream &out) { out << "\n" << "VERIFICATION CONDITIONS:" << "\n" << "\n"; languagest languages(ns, new_ansi_c_language()); bool has_threads=equation.has_threads(); for(symex_target_equationt::SSA_stepst::iterator s_it=equation.SSA_steps.begin(); s_it!=equation.SSA_steps.end(); s_it++) { if(!s_it->is_assert()) continue; if(s_it->source.pc->source_location.is_not_nil()) out << s_it->source.pc->source_location << "\n"; if(s_it->comment!="") out << s_it->comment << "\n"; symex_target_equationt::SSA_stepst::const_iterator p_it=equation.SSA_steps.begin(); // we show everything in case there are threads symex_target_equationt::SSA_stepst::const_iterator last_it=has_threads?equation.SSA_steps.end():s_it; for(unsigned count=1; p_it!=last_it; p_it++) if(p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) { if(!p_it->ignore) { std::string string_value; languages.from_expr(p_it->cond_expr, string_value); out << "{-" << count << "} " << string_value << "\n"; #if 0 languages.from_expr(p_it->guard_expr, string_value); out << "GUARD: " << string_value << "\n"; out << "\n"; #endif count++; } } out << "|--------------------------" << "\n"; std::string string_value; languages.from_expr(s_it->cond_expr, string_value); out << "{" << 1 << "} " << string_value << "\n"; out << "\n"; } }
void bmc_baset::show_vcc(std::ostream &out) { switch(ui) { case ui_message_handlert::OLD_GUI: case ui_message_handlert::XML_UI: error("not supported"); return; case ui_message_handlert::PLAIN: break; default: assert(false); } out << std::endl << "VERIFICATION CONDITIONS:" << std::endl << std::endl; languagest languages(ns, new_ansi_c_language()); for(symex_target_equationt::SSA_stepst::iterator it=equation.SSA_steps.begin(); it!=equation.SSA_steps.end(); it++) { if(!it->is_assert()) continue; if(it->source.pc->location.is_not_nil()) out << it->source.pc->location << std::endl; if(it->comment!="") out << it->comment << std::endl; symex_target_equationt::SSA_stepst::const_iterator p_it=equation.SSA_steps.begin(); for(unsigned count=1; p_it!=it; p_it++) if(p_it->is_assume() || p_it->is_assignment()) if(!p_it->ignore) { std::string string_value; languages.from_expr(p_it->cond_expr, string_value); out << "{-" << count << "} " << string_value << std::endl; count++; } out << "|--------------------------" << std::endl; std::string string_value; languages.from_expr(it->cond_expr, string_value); out << "{" << 1 << "} " << string_value << std::endl; out << std::endl; } }