bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] re: Overflow problem in gmon/mcount profiler.


From: dank
Subject: [PATCH] re: Overflow problem in gmon/mcount profiler.
Date: Mon, 01 Jul 2002 22:58:05 -0700

Jim wrote (http://sources.redhat.com/ml/bug-glibc/2001-07/msg00131.html):
> When call-graph profiling an executable with a large number of
> called routines, the file gmon.out is not produced.
> [test case snipped]

I have a patch against glibc-2.2.5 that seems to fix this:
  http://www.kegel.com/gmon.patch

I believe the problem was a thinko confusing the types used to represent
the sampling counters and indices into the call graph table; this patch
adds a defined type, ARCINDEX, for the latter, and uses it uniformly.

The heuristic used to size the call graph table (tos[])
might be a suprise to some users, so I've added a line to 
output a message to stderr when the heuristic picks too low a
value, causing table overflow.

The heuristic does pick too low a value when running Jim's regression
test; to work around this, tweak the constant ARCDENSITY up to 3 from 2,
and link the test program statically (which just happens to
make the heuristic allocate a much larger call graph table, due to the
increased text size).

I must say, the table sizing and indexing in gmon is a bit tricky to
understand.   Thus I don't trust my patch yet.  There may be some table
sizing or indexing bug lurking still.  

I have yet to use this on the real program that caused me to look
into the problem, but it does seem to let Jim's regression test pass.

Comments welcome.
- Dan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]