paulf@xxxxxxx wrote:
Hi
I'm trying to use gcov. No problems building executables and running them. But when I get to running gcov, at least on one object file, gcov gets stuck in an infinite loop. I've tried running it overnight, but no sign of progress by the morning.
Hi
I built a version of gcov without inlining, and traced the problem. In
the gcov source there's this comment:
/* Find the loops. This uses the algorithm described in
Tiernan 'An Efficient Search Algorithm to Find the
Elementary Circuits of a Graph', CACM Dec 1970. We hold
the P array by having each block point to the arc that
connects to the previous block. The H array is implicitly
held because of the arc ordering, and the block's
previous arc pointer.
Although the algorithm is O(N^3) for highly connected
graphs, at worst we'll have O(N^2), as most blocks have
only one or two exits. Most graphs will be small.
For each loop we find, locate the arc with the smallest
transition count, and add that to the cumulative
count. Decrease flow over the cycle and remove the arc
from consideration. */
The point where gcov stops is a line containing a macro that expands to
almost 30K characters. I didn't bother to confirm whether it was just
the O(N^2)-ness or if it was really stuck. I just changed the Makefile
to add -DNDEBUG for that file, and the long line (with a lot of asserts)
shrunk to 2K characters, and gcov can handle it relatively easily.
A+
Paul