diff --git a/src/util/state_graph.cpp b/src/util/state_graph.cpp index 1a59dc4af..b5f621a00 100644 --- a/src/util/state_graph.cpp +++ b/src/util/state_graph.cpp @@ -263,8 +263,9 @@ void state_graph::add_state(state s) { if (m_seen.contains(s)) return; STRACE("state_graph", tout << "[state_graph] adding state " << s << ": ";); add_state_core(s); + CASSERT("state_graph", write_dgml()); + CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", write_dgml();); STRACE("state_graph", tout << std::endl;); } void state_graph::mark_live(state s) { @@ -273,8 +274,9 @@ void state_graph::mark_live(state s) { SASSERT(m_state_ufind.is_root(s)); if (m_unexplored.contains(s)) mark_unknown_core(s); mark_live_recursive(s); + CASSERT("state_graph", write_dgml()); + CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", write_dgml();); STRACE("state_graph", tout << std::endl;); } void state_graph::add_edge(state s1, state s2, bool maybecycle) { @@ -286,8 +288,9 @@ void state_graph::add_edge(state s1, state s2, bool maybecycle) { s2 = m_state_ufind.find(s2); add_edge_core(s1, s2, maybecycle); if (m_live.contains(s2)) mark_live(s1); + CASSERT("state_graph", write_dgml()); + CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", write_dgml();); STRACE("state_graph", tout << std::endl;); } void state_graph::mark_done(state s) { @@ -298,8 +301,9 @@ void state_graph::mark_done(state s) { if (m_unexplored.contains(s)) mark_unknown_core(s); s = merge_all_cycles(s); mark_dead_recursive(s); // check if dead + CASSERT("state_graph", write_dgml()); + CASSERT("state_graph", write_dot()); CASSERT("state_graph", check_invariant()); - STRACE("state_graph", write_dgml();); STRACE("state_graph", tout << std::endl;); } @@ -413,10 +417,11 @@ std::ostream& state_graph::display(std::ostream& o) const { return o; } +#ifdef Z3DEBUG /* Output the whole state graph in dgml format into the file '.z3-state-graph.dgml' */ -void state_graph::write_dgml() { +bool state_graph::write_dgml() { std::ofstream dgml(".z3-state-graph.dgml"); dgml << "" << std::endl << "" << std::endl @@ -432,10 +437,10 @@ void state_graph::write_dgml() { r = m_state_ufind.next(r); } while (r != s); dgml << "\" Category=\"State\">" << std::endl; - if (m_live.contains(s)) - dgml << "" << std::endl; if (m_dead.contains(s)) dgml << "" << std::endl; + if (m_live.contains(s)) + dgml << "" << std::endl; if (m_unexplored.contains(s)) dgml << "" << std::endl; dgml << "" << std::endl; @@ -469,6 +474,7 @@ void state_graph::write_dgml() { << "" << std::endl << "