- Added lots of debugging info.
This commit is contained in:
parent
3673fc689d
commit
0ec70b9de0
@ -718,7 +718,10 @@ dotSemiState ()
|
|||||||
|
|
||||||
// Needed for the bindings later on: create graph
|
// Needed for the bindings later on: create graph
|
||||||
goal_graph_create (); // create graph
|
goal_graph_create (); // create graph
|
||||||
warshall (graph, nodes); // determine closure
|
if (warshall (graph, nodes) == 0) // determine closure
|
||||||
|
{
|
||||||
|
eprintf ("// This graph was not completely closed transitively because it contains a cycle!\n");
|
||||||
|
}
|
||||||
|
|
||||||
ranks = memAlloc (nodes * sizeof(int));
|
ranks = memAlloc (nodes * sizeof(int));
|
||||||
maxrank = graph_ranks (graph, ranks, nodes); // determine ranks
|
maxrank = graph_ranks (graph, ranks, nodes); // determine ranks
|
||||||
@ -726,6 +729,59 @@ dotSemiState ()
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// For debugging purposes, we also display an ASCII version of some stuff in the comments
|
// For debugging purposes, we also display an ASCII version of some stuff in the comments
|
||||||
printSemiState ();
|
printSemiState ();
|
||||||
|
// Even draw all dependencies for non-intruder runs
|
||||||
|
// Real nice debugging :(
|
||||||
|
{
|
||||||
|
int run;
|
||||||
|
|
||||||
|
run = 0;
|
||||||
|
while (run < sys->maxruns)
|
||||||
|
{
|
||||||
|
int ev;
|
||||||
|
|
||||||
|
ev = 0;
|
||||||
|
while (ev < sys->runs[run].length)
|
||||||
|
{
|
||||||
|
int run2;
|
||||||
|
int notfirstrun;
|
||||||
|
|
||||||
|
eprintf ("// precedence: r%ii%i <- ", run,ev);
|
||||||
|
run2 = 0;
|
||||||
|
notfirstrun = 0;
|
||||||
|
while (run2 < sys->maxruns)
|
||||||
|
{
|
||||||
|
int notfirstev;
|
||||||
|
int ev2;
|
||||||
|
|
||||||
|
notfirstev = 0;
|
||||||
|
ev2 = 0;
|
||||||
|
while (ev2 < sys->runs[run2].length)
|
||||||
|
{
|
||||||
|
if (graph[graph_nodes (nodes, run2, ev2, run, ev)]
|
||||||
|
!= 0)
|
||||||
|
{
|
||||||
|
if (notfirstev)
|
||||||
|
eprintf (",");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (notfirstrun)
|
||||||
|
eprintf (" ");
|
||||||
|
eprintf ("r%i:", run2);
|
||||||
|
}
|
||||||
|
eprintf ("%i", ev2);
|
||||||
|
notfirstrun = 1;
|
||||||
|
notfirstev = 1;
|
||||||
|
}
|
||||||
|
ev2++;
|
||||||
|
}
|
||||||
|
run2++;
|
||||||
|
}
|
||||||
|
eprintf ("\n");
|
||||||
|
ev++;
|
||||||
|
}
|
||||||
|
run++;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Draw graph
|
// Draw graph
|
||||||
@ -870,23 +926,19 @@ dotSemiState ()
|
|||||||
{
|
{
|
||||||
// Is this run before the event?
|
// Is this run before the event?
|
||||||
int ev2;
|
int ev2;
|
||||||
int ev2_found;
|
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
found = 0;
|
found = 0;
|
||||||
ev2 = 0;
|
ev2 = sys->runs[run2].length;
|
||||||
ev2_found = 0;
|
while (found == 0 && ev2 > 0)
|
||||||
while (ev2 < sys->runs[run2].length)
|
|
||||||
{
|
{
|
||||||
|
ev2--;
|
||||||
if (graph[graph_nodes (nodes, run2, ev2, run, ev)]
|
if (graph[graph_nodes (nodes, run2, ev2, run, ev)]
|
||||||
!= 0)
|
!= 0)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
ev2_found = ev2;
|
|
||||||
}
|
}
|
||||||
ev2++;
|
|
||||||
}
|
}
|
||||||
ev2 = ev2_found;
|
|
||||||
|
|
||||||
if (found == 1)
|
if (found == 1)
|
||||||
{
|
{
|
||||||
@ -898,17 +950,17 @@ dotSemiState ()
|
|||||||
* so we can simplify stuff a bit.
|
* so we can simplify stuff a bit.
|
||||||
* Nevertheless, using Floyd first would probably be faster.
|
* Nevertheless, using Floyd first would probably be faster.
|
||||||
*/
|
*/
|
||||||
int run3;
|
|
||||||
int other_route;
|
int other_route;
|
||||||
|
int run3;
|
||||||
|
int ev3;
|
||||||
|
|
||||||
other_route = 0;
|
other_route = 0;
|
||||||
run3 = 0;
|
run3 = 0;
|
||||||
|
ev3 = 0;
|
||||||
while (other_route == 0 && run3 < sys->maxruns)
|
while (other_route == 0 && run3 < sys->maxruns)
|
||||||
{
|
{
|
||||||
if (sys->runs[run3].protocol != INTRUDER)
|
if (sys->runs[run3].protocol != INTRUDER)
|
||||||
{
|
{
|
||||||
int ev3;
|
|
||||||
|
|
||||||
ev3 = 0;
|
ev3 = 0;
|
||||||
while (other_route == 0
|
while (other_route == 0
|
||||||
&& ev3 < sys->runs[run3].length)
|
&& ev3 < sys->runs[run3].length)
|
||||||
@ -980,6 +1032,18 @@ dotSemiState ()
|
|||||||
// close up
|
// close up
|
||||||
eprintf (";\n");
|
eprintf (";\n");
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// for debugging: show other route
|
||||||
|
run3--;
|
||||||
|
ev3--;
|
||||||
|
|
||||||
|
eprintf ("\t// HIDDEN r%ii%i -> r%ii%i because route through r%ii%i\n",
|
||||||
|
run2, ev2, run, ev, run3, ev3);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
run2++;
|
run2++;
|
||||||
|
@ -511,7 +511,10 @@ int
|
|||||||
labels_ordered (Termmap runs, Termlist labels)
|
labels_ordered (Termmap runs, Termlist labels)
|
||||||
{
|
{
|
||||||
goal_graph_create ();
|
goal_graph_create ();
|
||||||
warshall (graph, nodes);
|
if (warshall (graph, nodes) == 0)
|
||||||
|
{
|
||||||
|
error ("Testing ordering of label set for a graph with a cycle.");
|
||||||
|
}
|
||||||
|
|
||||||
while (labels != NULL)
|
while (labels != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user