45 if(expr.
id()==ID_symbol)
51 std::string identifier=
55 if(l0_l1!=std::string::npos)
57 identifier.resize(l0_l1);
64 else if(expr.
id() == ID_string_constant)
85 if(cit !=
cache.end())
90 if(assign.
rhs().
id() == ID_array_list)
93 const auto &ops = array_list.
operands();
95 for(std::size_t listidx = 0; listidx != ops.size(); listidx += 2)
104 else if(assign.
rhs().
id() == ID_array)
118 else if(assign.
rhs().
id()==ID_struct ||
119 assign.
rhs().
id()==ID_union)
124 assign.
lhs().
id() == ID_member &&
132 else if(assign.
lhs().
id()==ID_byte_extract_little_endian ||
133 assign.
lhs().
id()==ID_byte_extract_big_endian)
146 exprt::operandst::const_iterator it=
148 for(
const auto &comp : components)
150 if(comp.type().id()==ID_code ||
151 comp.get_is_padding() ||
157 it != assign.
rhs().
operands().end(),
"expression must have operands");
169 if(assign.
rhs().
id()==ID_union)
173 else if(assign.
rhs().
id() == ID_with)
176 const auto &ops = with_expr.
operands();
178 for(std::size_t i = 1; i < ops.size(); i += 2)
183 if(ops[i].
id() == ID_member_name)
186 assign.
lhs(), ops[i].
get(ID_component_name), ops[i + 1].type()};
208 lhs.find(
"#return_value") != std::string::npos ||
209 (lhs.find(
'$') != std::string::npos &&
210 has_prefix(lhs,
"return_value___VERIFIER_nondet_")))
229 const goto_tracet::stepst::const_iterator &prev_it,
230 goto_tracet::stepst::const_iterator &it)
234 (!it->pc->is_assign() || it->pc->assign_rhs().id() != ID_side_effect ||
235 it->pc->assign_rhs().get(ID_statement) != ID_nondet))
238 if(!it->is_assignment() && !it->is_goto() && !it->is_assert())
245 prev_it != goto_trace.
steps.end() &&
246 prev_it->pc->source_location() == it->pc->source_location())
249 if(it->is_goto() && it->pc->condition().is_true())
254 if(source_location.
is_nil() ||
273 expr.
id() == ID_symbol &&
290 unsigned int max_thread_idx = 0;
291 bool trace_has_violation =
false;
292 for(goto_tracet::stepst::const_iterator it = goto_trace.
steps.begin();
293 it != goto_trace.
steps.end();
296 if(it->thread_nr > max_thread_idx)
297 max_thread_idx = it->thread_nr;
298 if(it->is_assert() && !it->cond_value)
299 trace_has_violation =
true;
305 graphml[sink].node_name=
"sink";
306 graphml[sink].is_violation=
false;
307 graphml[sink].has_invariant=
false;
309 if(max_thread_idx > 0 && trace_has_violation)
311 std::vector<graphmlt::node_indext> nodes;
313 for(
unsigned int i = 0; i <= max_thread_idx + 1; ++i)
317 graphml[nodes.back()].is_violation = i == max_thread_idx + 1;
318 graphml[nodes.back()].has_invariant =
false;
321 for(
auto it = nodes.cbegin(); std::next(it) != nodes.cend(); ++it)
326 const auto thread_id = std::distance(nodes.cbegin(), it);
336 graphml[*std::next(it)].
in[*it].xml_node = edge;
337 graphml[*it].
out[*std::next(it)].xml_node = edge;
346 std::vector<std::size_t> step_to_node(goto_trace.
steps.size()+1, 0);
348 goto_tracet::stepst::const_iterator prev_it=goto_trace.
steps.end();
349 for(goto_tracet::stepst::const_iterator
350 it=goto_trace.
steps.begin();
351 it!=goto_trace.
steps.end();
356 step_to_node[it->step_nr]=sink;
362 goto_tracet::stepst::const_iterator next=it;
365 next != goto_trace.
steps.end() &&
367 it->full_lhs == next->full_lhs &&
368 it->pc->source_location() == next->pc->source_location())
370 step_to_node[it->step_nr]=sink;
386 graphml[node].has_invariant=
false;
388 step_to_node[it->step_nr]=node;
394 for(goto_tracet::stepst::const_iterator
395 it=goto_trace.
steps.begin();
396 it!=goto_trace.
steps.end();
399 const std::size_t from=step_to_node[it->step_nr];
402 if(from == sink ||
graphml[from].is_violation)
408 auto next = std::next(it);
409 for(; next != goto_trace.
steps.end() &&
410 (step_to_node[next->step_nr] == sink ||
416 const std::size_t to=
417 next==goto_trace.
steps.end()?
418 sink:step_to_node[next->step_nr];
429 {{
"source",
graphml[from].node_name},
430 {
"target",
graphml[to].node_name}},
447 const auto lhs_object = it->get_lhs_object();
450 lhs_object.has_value())
452 const std::string &lhs_id =
id2string(lhs_object->get_identifier());
453 if(lhs_id.find(
"pthread_create::thread") != std::string::npos)
464 lhs_id.find(
"thread") == std::string::npos &&
465 lhs_id.find(
"mutex") == std::string::npos &&
466 (!it->full_lhs_value.is_constant() ||
467 !it->full_lhs_value.has_operands() ||
481 irep_idt function_id = it->function_id;
482 const symbolt *symbol_ptr =
nullptr;
485 function_id = lhs_id.substr(0, lhs_id.find(
"::"));
536 graphml[sink].node_name=
"sink";
537 graphml[sink].is_violation=
false;
538 graphml[sink].has_invariant=
false;
541 std::vector<std::size_t> step_to_node(equation.
SSA_steps.size()+1, 0);
543 std::size_t step_nr=1;
544 for(symex_target_equationt::SSA_stepst::const_iterator
553 (!it->is_assignment() && !it->is_goto() && !it->is_assert()) ||
554 (it->is_goto() && it->source.pc->condition().is_true()) ||
558 step_to_node[step_nr]=sink;
564 symex_target_equationt::SSA_stepst::const_iterator next=it;
567 next != equation.
SSA_steps.end() && next->is_assignment() &&
568 it->ssa_full_lhs == next->ssa_full_lhs &&
569 it->source.pc->source_location() == next->source.pc->source_location())
571 step_to_node[step_nr]=sink;
582 graphml[node].is_violation=
false;
583 graphml[node].has_invariant=
false;
585 step_to_node[step_nr]=node;
590 for(symex_target_equationt::SSA_stepst::const_iterator
595 const std::size_t from=step_to_node[step_nr];
604 symex_target_equationt::SSA_stepst::const_iterator next=it;
605 std::size_t next_step_nr=step_nr;
606 for(++next, ++next_step_nr;
608 (step_to_node[next_step_nr]==sink || it->source.pc==next->source.pc);
609 ++next, ++next_step_nr)
613 const std::size_t to=
615 sink:step_to_node[next_step_nr];
626 {{
"source",
graphml[from].node_name},
627 {
"target",
graphml[to].node_name}},
641 (it->is_assignment() || it->is_decl()) && it->ssa_rhs.is_not_nil() &&
642 it->ssa_full_lhs.is_not_nil())
644 irep_idt identifier = it->ssa_lhs.get_object_name();
646 graphml[to].has_invariant =
true;
678 step_nr=next_step_nr;