From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1790 invoked by alias); 27 Jan 2003 14:38:06 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1783 invoked from network); 27 Jan 2003 14:38:05 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by 172.16.49.205 with SMTP; 27 Jan 2003 14:38:05 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18dCHf-00037K-00 for ; Mon, 27 Jan 2003 10:38:55 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18dAPA-0000L3-00 for ; Mon, 27 Jan 2003 09:38:32 -0500 Date: Mon, 27 Jan 2003 14:38:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Fix a goof in the profiling code Message-ID: <20030127143831.GA1282@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-SW-Source: 2003-01/txt/msg00729.txt.bz2 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 * 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