This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][13570] Suppress creation of gmon files.


Hi, this bug ask if we could provide support of controling gmon.out
files. I would prefer to solve this issue by overriding _mcleanup with
LD_PRELOAD library like:

void _mcleanup (void)
{
  if (user condition)
    {
      void (*p)() = dlsym (RTLD_NEXT, "_mcleanup");
      p ();
    }
}

This could cause problems when compiler decides not return plt version.
If that would not work then next solution could be adding a environment
variable for it.

Makes sense?

	[BZ #13570]
	* gmon/gmon.c (_mcleanup): Do not write gmon file when
	GLIBC_NOGMON_OUT is defined.

diff --git a/gmon/gmon.c b/gmon/gmon.c
index 9774d57..35d0cee 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -424,7 +424,7 @@ _mcleanup (void)
 {
   __moncontrol (0);
 
-  if (_gmonparam.state != GMON_PROF_ERROR)
+  if (!getenv ("GLIBC_NOGMON_OUT") && _gmonparam.state != GMON_PROF_ERROR)
     write_gmon ();
 
   /* free the memory. */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]