37 switch(ui_message_handler.
get_ui())
54 msg.
result() << json_result;
65 switch(ui_message_handler.
get_ui())
82 msg.
result() << json_result;
93 switch(ui_message_handler.
get_ui())
109 json_result[
"cProverStatus"] =
json_stringt(
"inconclusive");
110 msg.
result() << json_result;
121 switch(ui_message_handler.
get_ui())
138 msg.
result() << json_result;
150 const auto &l = property_info.
pc->source_location();
153 if(l.get_file() != current_file)
154 log.
result() <<
"file " << l.get_file() <<
' ';
155 if(!l.get_line().empty())
156 log.
result() <<
"line " << l.get_line() <<
' ';
158 switch(property_info.
status)
196 const auto &p1 = property1.second.pc->source_location();
197 const auto &p2 = property2.second.pc->source_location();
198 if(p1.get_file() != p2.get_file())
200 if(p1.get_function() != p2.get_function())
203 !p1.get_line().empty() && !p2.get_line().empty() &&
204 p1.get_line() != p2.get_line())
205 return std::stoul(
id2string(p1.get_line())) <
208 const auto split_property_id =
209 [](
const irep_idt &property_id) -> std::pair<std::string, std::size_t> {
210 const auto property_string =
id2string(property_id);
211 const auto last_dot = property_string.rfind(
'.');
212 std::string property_name;
213 std::string property_number;
214 if(last_dot == std::string::npos)
217 property_number = property_string;
221 property_name = property_string.substr(0, last_dot);
222 property_number = property_string.substr(last_dot + 1);
225 if(maybe_number.has_value())
226 return std::make_pair(property_name, *maybe_number);
228 return std::make_pair(property_name, 0);
231 const auto left_split = split_property_id(property1.first);
232 const auto left_id_name = left_split.first;
233 const auto left_id_number = left_split.second;
235 const auto right_split = split_property_id(property2.first);
236 const auto right_id_name = right_split.first;
237 const auto right_id_number = right_split.second;
239 if(left_id_name != right_id_name)
240 return left_id_name < right_id_name;
242 return left_id_number < right_id_number;
245 static std::vector<propertiest::const_iterator>
248 std::vector<propertiest::const_iterator> sorted_properties;
249 for(
auto p_it = properties.begin(); p_it != properties.end(); p_it++)
250 sorted_properties.push_back(p_it);
253 sorted_properties.begin(),
254 sorted_properties.end(),
255 [](propertiest::const_iterator pit1, propertiest::const_iterator pit2) {
256 return is_property_less_than(*pit1, *pit2);
258 return sorted_properties;
262 const std::vector<propertiest::const_iterator> &sorted_properties,
265 if(sorted_properties.empty())
272 for(
const auto &p : sorted_properties)
274 const auto &l = p->second.pc->source_location();
275 if(l.get_function() != previous_function)
277 if(!previous_function.
empty())
279 previous_function = l.get_function();
280 if(!previous_function.
empty())
282 current_file = l.get_file();
283 if(!current_file.
empty())
284 log.
result() << current_file <<
' ';
285 if(!l.get_function().empty())
286 log.
result() <<
"function " << l.get_function();
296 std::size_t iterations,
299 if(properties.empty())
304 << properties.size() <<
" failed (" << iterations
310 std::size_t iterations,
314 switch(ui_message_handler.
get_ui())
325 for(
const auto &property_pair : properties)
327 log.
result() <<
xml(property_pair.first, property_pair.second);
337 for(
const auto &property_pair : properties)
339 result_array.
push_back(
json(property_pair.first, property_pair.second));
350 std::size_t iterations,
354 switch(ui_message_handler.
get_ui())
360 for(
const auto &property_it : sorted_properties)
365 <<
"Trace for " << property_it->first <<
":"
370 traces[property_it->first],
380 for(
const auto &property_pair : properties)
382 xmlt xml_result =
xml(property_pair.first, property_pair.second);
387 traces[property_pair.first],
390 log.
result() << xml_result;
400 for(
const auto &property_pair : properties)
404 json(json_property, property_pair.
first, property_pair.second);
409 convert<json_stream_arrayt>(
411 traces[property_pair.first],
427 out <<
"Fault localization scores:" << messaget::eom;
428 for(auto &score_pair : fault_location.scores)
430 out << score_pair.first->source_location()
431 <<
"\n score: " << score_pair.second << messaget::eom;
441 return std::max_element(
442 fault_location.
scores.begin(),
443 fault_location.
scores.end(),
445 fault_location_infot::score_mapt::value_type score_pair1,
446 fault_location_infot::score_mapt::value_type score_pair2) {
447 return score_pair1.second < score_pair2.second;
457 if(fault_location.
scores.empty())
466 <<
"[" +
id2string(property_id) +
"]: \n "
472 const std::unordered_map<irep_idt, fault_location_infot> &fault_locations,
476 for(
const auto &fault_location_pair : fault_locations)
479 fault_location_pair.first, fault_location_pair.second, log);
488 xmlt xml_diagnosis(
"diagnosis");
492 if(fault_location.
scores.empty())
495 return xml_diagnosis;
504 return xml_diagnosis;
508 const std::unordered_map<irep_idt, fault_location_infot> &fault_locations,
511 xmlt dest(
"fault-localization");
512 for(
const auto &fault_location_pair : fault_locations)
515 xml(fault_location_pair.first, fault_location_pair.second, log);
524 if(fault_location.
scores.empty())
526 json_result[
"result"] =
json_stringt(
"unable to localize fault");
530 json_result[
"result"] =
538 const std::unordered_map<irep_idt, fault_location_infot> &fault_locations,
539 std::size_t iterations,
543 switch(ui_message_handler.
get_ui())
557 for(
const auto &property_pair : properties)
561 json(json_property, property_pair.
first, property_pair.second);
565 "diagnosis",
json(fault_locations.at(property_pair.first)));
583 const std::unordered_map<irep_idt, fault_location_infot> &fault_locations,
584 std::size_t iterations,
588 switch(ui_message_handler.
get_ui())
593 properties, traces, trace_options, iterations, ui_message_handler);
603 for(
const auto &property_pair : properties)
607 json(json_property, property_pair.
first, property_pair.second);
612 convert<json_stream_arrayt>(
614 traces[property_pair.first],
618 "diagnosis",
json(fault_locations.at(property_pair.first)));
626 properties, traces, trace_options, iterations, ui_message_handler);
641 switch(ui_message_handler.
get_ui())
659 convert<json_stream_arrayt>(ns, goto_trace, json_trace, trace_options);
660 json_result.
push_back(
"diagnosis",
json(fault_location_info));
668 "fault-localization",