about summary refs log tree commit diff
path: root/gmon
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /gmon
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'gmon')
-rw-r--r--gmon/Makefile12
-rw-r--r--gmon/bb_init_func.c54
-rw-r--r--gmon/gmon.c14
-rw-r--r--gmon/mcount.c2
-rw-r--r--gmon/prof-freq.c55
-rw-r--r--gmon/profil.c42
-rw-r--r--gmon/sprofil.c36
-rw-r--r--gmon/tst-profile-static.c10
8 files changed, 13 insertions, 212 deletions
diff --git a/gmon/Makefile b/gmon/Makefile
index 969edd5575..80a79456f7 100644
--- a/gmon/Makefile
+++ b/gmon/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995,1996,1997,2001,2002,2005 Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -27,15 +27,7 @@ routines := gmon mcount profil sprofil bb_init_func bb_exit_func prof-freq
 
 elide-routines.os = bb_init_func bb_exit_func
 
-include ../Makeconfig
-
-tests	= tst-sprofil
-ifeq ($(build-profile),yes)
-tests	+= tst-profile-static
-tests-static	+= tst-profile-static
-
-LDFLAGS-tst-profile-static = -profile
-endif
+tests	:= tst-sprofil
 
 # The mcount code won't work without a frame pointer.
 CFLAGS-mcount.c := -fno-omit-frame-pointer
diff --git a/gmon/bb_init_func.c b/gmon/bb_init_func.c
deleted file mode 100644
index 19901d8d09..0000000000
--- a/gmon/bb_init_func.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger (davidm@cs.arizona.edu).
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* __bb_init_func is invoked at the beginning of each function, before
-   any registers have been saved.  This generic routine should work
-   provided that calling this function doesn't mangle the arguments
-   passed to the function being called.  If that's not the case, a
-   system specific routine must be provided.  */
-
-#include <sys/types.h>
-#include <sys/gmon.h>
-
-#include <stdlib.h>
-
-void
-__bb_init_func (struct __bb *bb)
-{
-  struct gmonparam *p = &_gmonparam;
-
-  if (bb->zero_word != 0)
-    {
-      return;	/* handle common case quickly */
-    }
-
-  /* insert this basic-block into basic-block list: */
-  bb->zero_word = 1;
-  bb->next = __bb_head;
-  __bb_head = bb;
-
-  if (bb->next == 0 && p->state != GMON_PROF_ON)
-    {
-      /* we didn't register _mcleanup yet and pc profiling doesn't seem
-	 to be active, so let's register it now: */
-      extern void *__dso_handle __attribute__ ((__weak__));
-      __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
-		    &__dso_handle ? __dso_handle : NULL);
-    }
-}
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 1e94aaba5f..575adbcd8b 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -171,7 +171,7 @@ __monstartup (lowpc, highpc)
 
   __moncontrol(1);
 }
-weak_alias (__monstartup, monstartup)
+weak_alias(__monstartup, monstartup)
 
 
 static void
@@ -331,7 +331,7 @@ write_gmon (void)
       {
 	size_t len = strlen (env);
 	char buf[len + 20];
-	__snprintf (buf, sizeof (buf), "%s.%u", env, __getpid ());
+	sprintf (buf, "%s.%u", env, __getpid ());
 	fd = open_not_cancel (buf, O_CREAT|O_TRUNC|O_WRONLY|O_NOFOLLOW, 0666);
       }
 
@@ -343,8 +343,14 @@ write_gmon (void)
 	  {
 	    char buf[300];
 	    int errnum = errno;
-	    __fxprintf (NULL, "_mcleanup: gmon.out: %s\n",
-			__strerror_r (errnum, buf, sizeof buf));
+#ifdef USE_IN_LIBIO
+	    if (_IO_fwide (stderr, 0) > 0)
+	      __fwprintf (stderr, L"_mcleanup: gmon.out: %s\n",
+			  __strerror_r (errnum, buf, sizeof buf));
+	    else
+#endif
+	      fprintf (stderr, "_mcleanup: gmon.out: %s\n",
+		       __strerror_r (errnum, buf, sizeof buf));
 	    return;
 	  }
       }
diff --git a/gmon/mcount.c b/gmon/mcount.c
index 32a5f1ea0f..e18bf86e83 100644
--- a/gmon/mcount.c
+++ b/gmon/mcount.c
@@ -37,7 +37,7 @@ static char sccsid[] = "@(#)mcount.c	8.1 (Berkeley) 6/4/93";
 
 /* This file provides the machine-dependent definitions of the _MCOUNT_DECL
    and MCOUNT macros.  */
-#include <machine-gmon.h>
+#include "machine-gmon.h"
 
 #include <atomic.h>
 
diff --git a/gmon/prof-freq.c b/gmon/prof-freq.c
deleted file mode 100644
index ffcc67931b..0000000000
--- a/gmon/prof-freq.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Return frequency of ticks reported by profil.  Generic version. */
-/*-
- * Copyright (c) 1983, 1992, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <libc-internal.h>
-
-int
-__profile_frequency (void)
-{
-  /*
-   * Discover the tick frequency of the machine if something goes wrong,
-   * we return 0, an impossible hertz.
-   */
-  struct itimerval tim;
-
-  tim.it_interval.tv_sec = 0;
-  tim.it_interval.tv_usec = 1;
-  tim.it_value.tv_sec = 0;
-  tim.it_value.tv_usec = 0;
-  __setitimer(ITIMER_REAL, &tim, 0);
-  __setitimer(ITIMER_REAL, 0, &tim);
-  if (tim.it_interval.tv_usec < 2)
-    return 0;
-  return (1000000 / tim.it_interval.tv_usec);
-}
-libc_hidden_def (__profile_frequency)
diff --git a/gmon/profil.c b/gmon/profil.c
deleted file mode 100644
index 8736375858..0000000000
--- a/gmon/profil.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Low-level statistical profiling support function.  Stub version.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-
-/* Enable statistical profiling, writing samples of the PC into at most
-   SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
-   is enabled, the system examines the user PC and increments
-   SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536].  If SCALE is zero,
-   disable profiling.  Returns zero on success, -1 on error.  */
-
-int
-__profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
-{
-  if (scale == 0)
-    /* Disable profiling.  */
-    return 0;
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__profil, profil)
-stub_warning (profil)
-#include <stub-tag.h>
diff --git a/gmon/sprofil.c b/gmon/sprofil.c
deleted file mode 100644
index 037ed4672e..0000000000
--- a/gmon/sprofil.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-
-#include <sys/profil.h>
-#include <sys/time.h>
-
-int
-__sprofil (struct prof *profp, int profcnt, struct timeval *tvp,
-	   unsigned int flags)
-{
-  if (profcnt == 0)
-    return 0;
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__sprofil, sprofil)
diff --git a/gmon/tst-profile-static.c b/gmon/tst-profile-static.c
deleted file mode 100644
index b2f371e782..0000000000
--- a/gmon/tst-profile-static.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-static int
-do_test (void)
-{
-  puts ("Hello world");
-  return 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"