mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 14:50:05 +00:00
gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI
Otherwise, processes are likely to crash during concurrent updates to a new glibc version on the stable release branch. The test gmon/tst-mcount-overflow depends on those tunables, so it has to be removed as well.
This commit is contained in:
parent
e698e8bd8e
commit
7035f2174f
@ -26,7 +26,7 @@ include ../Makeconfig
|
||||
headers := sys/gmon.h sys/gmon_out.h sys/profil.h
|
||||
routines := gmon mcount profil sprofil prof-freq
|
||||
|
||||
tests = tst-sprofil tst-gmon tst-mcount-overflow tst-mcleanup
|
||||
tests = tst-sprofil tst-gmon tst-mcleanup
|
||||
ifeq ($(build-profile),yes)
|
||||
tests += tst-profile-static
|
||||
tests-static += tst-profile-static
|
||||
@ -57,18 +57,6 @@ ifeq ($(run-built-tests),yes)
|
||||
tests-special += $(objpfx)tst-gmon-gprof.out
|
||||
endif
|
||||
|
||||
CFLAGS-tst-mcount-overflow.c := -fno-omit-frame-pointer -pg
|
||||
tst-mcount-overflow-no-pie = yes
|
||||
CRT-tst-mcount-overflow := $(csu-objpfx)g$(start-installed-name)
|
||||
# Intentionally use invalid config where maxarcs<minarcs to check warning is printed
|
||||
tst-mcount-overflow-ENV := GMON_OUT_PREFIX=$(objpfx)tst-mcount-overflow.data \
|
||||
GLIBC_TUNABLES=glibc.gmon.minarcs=51:glibc.gmon.maxarcs=50
|
||||
# Send stderr into output file because we make sure expected messages are printed
|
||||
tst-mcount-overflow-ARGS := 2>&1 1>/dev/null | cat
|
||||
ifeq ($(run-built-tests),yes)
|
||||
tests-special += $(objpfx)tst-mcount-overflow-check.out
|
||||
endif
|
||||
|
||||
CFLAGS-tst-mcleanup.c := -fno-omit-frame-pointer -pg
|
||||
tst-mcleanup-no-pie = yes
|
||||
CRT-tst-mcleanup := $(csu-objpfx)g$(start-installed-name)
|
||||
|
16
gmon/gmon.c
16
gmon/gmon.c
@ -46,11 +46,6 @@
|
||||
#include <libc-internal.h>
|
||||
#include <not-cancel.h>
|
||||
|
||||
#if HAVE_TUNABLES
|
||||
# define TUNABLE_NAMESPACE gmon
|
||||
# include <elf/dl-tunables.h>
|
||||
#endif
|
||||
|
||||
#ifdef PIC
|
||||
# include <link.h>
|
||||
|
||||
@ -130,20 +125,9 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
struct gmonparam *p = &_gmonparam;
|
||||
long int minarcs, maxarcs;
|
||||
|
||||
#if HAVE_TUNABLES
|
||||
/* Read minarcs/maxarcs tunables. */
|
||||
minarcs = TUNABLE_GET (minarcs, int32_t, NULL);
|
||||
maxarcs = TUNABLE_GET (maxarcs, int32_t, NULL);
|
||||
if (maxarcs < minarcs)
|
||||
{
|
||||
ERR("monstartup: maxarcs < minarcs, setting maxarcs = minarcs\n");
|
||||
maxarcs = minarcs;
|
||||
}
|
||||
#else
|
||||
/* No tunables, we use hardcoded defaults */
|
||||
minarcs = MINARCS;
|
||||
maxarcs = MAXARCS;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we are incorrectly called twice in a row (without an
|
||||
|
@ -77,9 +77,6 @@ glibc.malloc.check: 0 (min: 0, max: 3)
|
||||
capabilities seen by @theglibc{}
|
||||
* Memory Related Tunables:: Tunables that control the use of memory by
|
||||
@theglibc{}.
|
||||
* gmon Tunables:: Tunables that control the gmon profiler, used in
|
||||
conjunction with gprof
|
||||
|
||||
@end menu
|
||||
|
||||
@node Tunable names
|
||||
@ -612,59 +609,3 @@ support in the kernel if this tunable has any non-zero value.
|
||||
|
||||
The default value is @samp{0}, which disables all memory tagging.
|
||||
@end deftp
|
||||
|
||||
@node gmon Tunables
|
||||
@section gmon Tunables
|
||||
@cindex gmon tunables
|
||||
|
||||
@deftp {Tunable namespace} glibc.gmon
|
||||
This tunable namespace affects the behaviour of the gmon profiler.
|
||||
gmon is a component of @theglibc{} which is normally used in
|
||||
conjunction with gprof.
|
||||
|
||||
When GCC compiles a program with the @code{-pg} option, it instruments
|
||||
the program with calls to the @code{mcount} function, to record the
|
||||
program's call graph. At program startup, a memory buffer is allocated
|
||||
to store this call graph; the size of the buffer is calculated using a
|
||||
heuristic based on code size. If during execution, the buffer is found
|
||||
to be too small, profiling will be aborted and no @file{gmon.out} file
|
||||
will be produced. In that case, you will see the following message
|
||||
printed to standard error:
|
||||
|
||||
@example
|
||||
mcount: call graph buffer size limit exceeded, gmon.out will not be generated
|
||||
@end example
|
||||
|
||||
Most of the symbols discussed in this section are defined in the header
|
||||
@code{sys/gmon.h}. However, some symbols (for example @code{mcount})
|
||||
are not defined in any header file, since they are only intended to be
|
||||
called from code generated by the compiler.
|
||||
@end deftp
|
||||
|
||||
@deftp Tunable glibc.mem.minarcs
|
||||
The heuristic for sizing the call graph buffer is known to be
|
||||
insufficient for small programs; hence, the calculated value is clamped
|
||||
to be at least a minimum size. The default minimum (in units of
|
||||
call graph entries, @code{struct tostruct}), is given by the macro
|
||||
@code{MINARCS}. If you have some program with an unusually complex
|
||||
call graph, for which the heuristic fails to allocate enough space,
|
||||
you can use this tunable to increase the minimum to a larger value.
|
||||
@end deftp
|
||||
|
||||
@deftp Tunable glibc.mem.maxarcs
|
||||
To prevent excessive memory consumption when profiling very large
|
||||
programs, the call graph buffer is allowed to have a maximum of
|
||||
@code{MAXARCS} entries. For some very large programs, the default
|
||||
value of @code{MAXARCS} defined in @file{sys/gmon.h} is too small; in
|
||||
that case, you can use this tunable to increase it.
|
||||
|
||||
Note the value of the @code{maxarcs} tunable must be greater or equal
|
||||
to that of the @code{minarcs} tunable; if this constraint is violated,
|
||||
a warning will printed to standard error at program startup, and
|
||||
the @code{minarcs} value will be used as the maximum as well.
|
||||
|
||||
Setting either tunable too high may result in a call graph buffer
|
||||
whose size exceeds the available memory; in that case, an out of memory
|
||||
error will be printed at program startup, the profiler will be
|
||||
disabled, and no @file{gmon.out} file will be generated.
|
||||
@end deftp
|
||||
|
Loading…
Reference in New Issue
Block a user