This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Patch: --enable-profiling
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: Patch: --enable-profiling
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 29 Oct 1999 14:43:09 -0600
- Reply-To: tromey at cygnus dot com
This patch adds a `--enable-profiling' option to gdb's configure
script. If given, this defines ENABLE_PROFILE and builds gdb with
`-pg'. ENABLE_PROFILE adds a new maintenance command which can be
used to enable or disable profiling from the command line. (By
default profiling is turned off in main()).
Ok to check in?
1999-10-29 Tom Tromey <tromey@cygnus.com>
* config.in: Rebuilt.
* acconfig.h (ENABLE_PROFILE): New #undef.
* Makefile.in (PROFILE_CFLAGS): New macro.
* configure: Rebuilt.
* configure.in: Added --enable-profiling. Define ENABLE_PROFILE
if provided. Set and subst PROFILE_CFLAGS.
* maint.c (maint_moncontrol): New function.
(_initialize_maint_cmds): Add `moncontrol' command if profiling
support is enabled.
* main.c (main): Turn off profiling if profiling support is
enabled.
Tom
Index: Makefile.in
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/Makefile.in,v
retrieving revision 1.662.2.4
diff -u -r1.662.2.4 Makefile.in
--- Makefile.in 1999/06/15 17:57:51 1.662.2.4
+++ Makefile.in 1999/10/29 20:04:26
@@ -206,7 +206,7 @@
# M{H,T}_CFLAGS, if defined, have host- and target-dependent CFLAGS
# from the config directory.
GLOBAL_CFLAGS = $(MT_CFLAGS) $(MH_CFLAGS)
-#PROFILE_CFLAGS = -pg
+PROFILE_CFLAGS = @PROFILE_CFLAGS@
# CFLAGS is specifically reserved for setting from the command line
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
Index: acconfig.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/acconfig.h,v
retrieving revision 2.19
diff -u -r2.19 acconfig.h
--- acconfig.h 1999/03/24 00:57:12 2.19
+++ acconfig.h 1999/10/29 20:04:34
@@ -96,3 +96,6 @@
/* Set to true if the save_state_t structure has the ss_wide member */
#define HAVE_STRUCT_MEMBER_SS_WIDE 0
+
+/* Define if profiling support should be enabled. */
+#undef ENABLE_PROFILE
Index: config.in
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/config.in,v
retrieving revision 2.34
diff -u -r2.34 config.in
--- config.in 1999/03/24 00:57:12 2.34
+++ config.in 1999/10/29 20:04:36
@@ -129,6 +129,9 @@
/* Set to true if the save_state_t structure has the ss_wide member */
#define HAVE_STRUCT_MEMBER_SS_WIDE 0
+/* Define if profiling support should be enabled. */
+#undef ENABLE_PROFILE
+
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
Index: configure.in
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/configure.in,v
retrieving revision 1.385.2.1
diff -u -r1.385.2.1 configure.in
--- configure.in 1999/04/15 22:53:46 1.385.2.1
+++ configure.in 1999/10/29 20:04:46
@@ -330,7 +330,16 @@
dnl Handle optional features that can be enabled.
ENABLE_CFLAGS=
+PROFILE_CFLAGS=
+AC_ARG_ENABLE(profiling,
+[ --enable-profiling Turn on profiling of gdb])
+
+if test "$enable_profiling" = yes; then
+ AC_DEFINE(ENABLE_PROFILE)
+ PROFILE_CFLAGS=-pg
+fi
+
AC_ARG_ENABLE(tui,
[ --enable-tui Enable full-screen terminal user interface],
[
@@ -681,6 +690,7 @@
AC_SUBST(IGNORE_SIM_OBS)
AC_SUBST(ENABLE_CFLAGS)
+AC_SUBST(PROFILE_CFLAGS)
AC_SUBST(CONFIG_OBS)
AC_SUBST(CONFIG_DEPS)
Index: main.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/main.c,v
retrieving revision 1.164.2.1
diff -u -r1.164.2.1 main.c
--- main.c 1999/04/15 22:53:48 1.164.2.1
+++ main.c 1999/10/29 20:04:52
@@ -128,6 +128,10 @@
int gdb_file_size;
+#ifdef ENABLE_PROFILE
+ moncontrol (0);
+#endif
+
START_PROGRESS (argv[0], 0);
#ifdef MPW
Index: maint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/maint.c,v
retrieving revision 2.27
diff -u -r2.27 maint.c
--- maint.c 1999/04/02 23:11:57 2.27
+++ maint.c 1999/10/29 20:04:56
@@ -339,6 +339,24 @@
return;
}
+#ifdef ENABLE_PROFILE
+/* "maintenance moncontrol <on|off>" */
+static void
+maint_moncontrol (char *arg, int from_tty)
+{
+ int val;
+ if (arg == NULL || ! *arg)
+ error ("requires argument");
+ if (! strcmp (arg, "on"))
+ val = 1;
+ else if (! strcmp (arg, "off"))
+ val = 0;
+ else
+ error ("unrecognized argument");
+ moncontrol (val);
+}
+#endif
+
void
_initialize_maint_cmds ()
{
@@ -431,6 +449,12 @@
add_cmd ("translate-address", class_maintenance, maintenance_translate_address,
"Translate a section name and address to a symbol.",
&maintenancelist);
+
+#ifdef ENABLE_PROFILE
+ add_cmd ("moncontrol", class_maintenance, maint_moncontrol,
+ "Enable or disable profiling.",
+ &maintenancelist);
+#endif
add_show_from_set (
add_set_cmd ("watchdog", class_maintenance, var_zinteger, (char *)&watchdog,