This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

Fix a goof in the profiling code


Joel pointed out to me that the profile patch had evolved to the point where
the checks in configure weren't really being used; we called monstartup()
regardless of --enable-profiling but only checked for it if the option was
given.  HP/UX lacks them.  Oops.

Fixed thus.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-01-27  Daniel Jacobowitz  <drow@mvista.com>

	* configure.in: Check that -pg works if using --enable-profiling.
	Check for monstartup and _mcleanup regardless of --enable-profiling.
	* maint.c: Check for monstartup and _mcleanup before using them.
	* config.in: Regenerated.
	* configure: Regenerated.

Index: maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.31
diff -u -p -r1.31 maint.c
--- maint.c	22 Jan 2003 23:50:35 -0000	1.31
+++ maint.c	27 Jan 2003 14:27:46 -0000
@@ -642,6 +642,9 @@ maintenance_show_cmd (char *args, int fr
 /* Profiling support.  */
 
 static int maintenance_profile_p;
+
+#if defined (HAVE_MONSTARTUP) && defined (HAVE__MCLEANUP)
+
 static int profiling_state;
 
 static void
@@ -685,6 +688,13 @@ maintenance_set_profile_cmd (char *args,
       _mcleanup ();
     }
 }
+#else
+static void
+maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element *c)
+{
+  warning ("Profiling support is not available on this system.");
+}
+#endif
 
 void
 _initialize_maint_cmds (void)
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.118
diff -u -p -r1.118 configure.in
--- configure.in	22 Jan 2003 23:50:35 -0000	1.118
+++ configure.in	27 Jan 2003 14:33:34 -0000
@@ -194,16 +194,22 @@ AC_ARG_ENABLE(profiling,
   esac],
  [enable_profiling=no])
 
+AC_CHECK_FUNCS(monstartup _mcleanup)
 if test "$enable_profiling" = yes ; then
+  if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
+    AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
+  fi
   PROFILE_CFLAGS=-pg
   OLD_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $PROFILE_CFLAGS"
 
-  AC_CHECK_FUNC(monstartup, [],
-    AC_MSG_ERROR(monstartup necessary to use --enable-profiling.))
+  AC_CACHE_CHECK([whether $CC supports -pg], ac_cv_cc_supports_pg,
+    [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
+     ac_cv_cc_supports_pg=no)])
 
-  AC_CHECK_FUNC(_mcleanup, [],
-    AC_MSG_ERROR(_mcleanup necessary to use --enable-profiling.))
+  if test $ac_cv_cc_supports_pg = no; then
+    AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
+  fi
 
   CFLAGS="$OLD_CFLAGS"
 fi


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