* gcov in infinite loop
@ 2011-03-03 15:28 paulf
2011-03-03 16:23 ` Andi Hellmund
2011-03-12 13:58 ` Paul Floyd
0 siblings, 2 replies; 4+ messages in thread
From: paulf @ 2011-03-03 15:28 UTC (permalink / raw)
To: gcc-help
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.
A few more details:
We mostly use RHEL 4.0 to 5.3. We're using GCC 4.5.1 built inhouse.
Any ideas where the problem might be? I haven't yet tried GCC 4.5.3.
A+
Paul Floyd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcov in infinite loop
2011-03-03 15:28 gcov in infinite loop paulf
@ 2011-03-03 16:23 ` Andi Hellmund
2011-03-03 23:32 ` Paul Floyd
2011-03-12 13:58 ` Paul Floyd
1 sibling, 1 reply; 4+ messages in thread
From: Andi Hellmund @ 2011-03-03 16:23 UTC (permalink / raw)
To: paulf; +Cc: gcc-help
>
> 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.
>
> A few more details:
> We mostly use RHEL 4.0 to 5.3. We're using GCC 4.5.1 built inhouse.
>
> Any ideas where the problem might be? I haven't yet tried GCC 4.5.3.
>
>
Hey Paul,
it's hard to say what could be wrong without more details. Testing 4.5.3
would be indeed a good idea to check if this misbehavior has already
been fixed.
If not, you should try to get and post a stack trace of the infinite
loop, e.g. using gdb or pstack(1) ...
Which gcov options are you using, by the way?
Thanks,
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcov in infinite loop
2011-03-03 16:23 ` Andi Hellmund
@ 2011-03-03 23:32 ` Paul Floyd
0 siblings, 0 replies; 4+ messages in thread
From: Paul Floyd @ 2011-03-03 23:32 UTC (permalink / raw)
To: gcc-help
Hi
> Hey Paul,
>
> it's hard to say what could be wrong without more details. Testing 4.5.3
> would be indeed a good idea to check if this misbehavior has already
> been fixed.
I've started.
> If not, you should try to get and post a stack trace of the infinite
> loop, e.g. using gdb or pstack(1) ...
pstack is not very helpful:
#0 0x00000000412d22 in main ()
gdb is better
#0 accumulate_line_counts (argc=8, argv=0x7fffffffc7f8)
at /free/NEW_GNU_BUILD/devenv_g3_package/src/gcc-4.5.1/gcc/gcov.c:1737
#1 generate_results (argc=8, argv=0x7fffffffc7f8)
at /free/NEW_GNU_BUILD/devenv_g3_package/src/gcc-4.5.1/gcc/gcov.c:566
#2 main (argc=8, argv=0x7fffffffc7f8)
at /free/NEW_GNU_BUILD/devenv_g3_package/src/gcc-4.5.1/gcc/gcov.c:377
> Which gcov options are you using, by the way?
lcov -c -d . -o sim.info
wich according to ps runs gcov with
gcov adms_search.gcda -o sim -b -c -a -p
Trying those options one at a time, -b -c -p pass, -a doesn't.
Looking at the man page, -a determines block counts within a line.
Thanks to our chronic macro abuse, we have some pretty enormous single
lines, so it is conceivable that I'm hitting a performance problem and
gcov isn't stuck in an infinite loop.
A+
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcov in infinite loop
2011-03-03 15:28 gcov in infinite loop paulf
2011-03-03 16:23 ` Andi Hellmund
@ 2011-03-12 13:58 ` Paul Floyd
1 sibling, 0 replies; 4+ messages in thread
From: Paul Floyd @ 2011-03-12 13:58 UTC (permalink / raw)
To: gcc-help
paulf@free.fr 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-12 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 15:28 gcov in infinite loop paulf
2011-03-03 16:23 ` Andi Hellmund
2011-03-03 23:32 ` Paul Floyd
2011-03-12 13:58 ` Paul Floyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).