Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [RFA] Add support for --enable-lmcheck configure option.
Date: Mon, 11 Jun 2012 20:39:00 -0000	[thread overview]
Message-ID: <1339447127-314-1-git-send-email-brobecker@adacore.com> (raw)

Hello,

This allows the user to enable this option at configure time if building
a release, or to disable it if building a snapshot. It might be useful
later on, when debugging memory problems on a release version of GDB.
I don't think I'll personally use the --disable-libmcheck on a snapshot,
but someone distributing a snaphot version might enjoy it too. The
default is to preserve the current behavior.

Also, I went the minimal route: If --enable-libmcheck is specified,
but AC_CHECK_LIB(mcheck) fails, configure is not going to fail. I think
it's OK, given the relative importance of this feature. I suppose
I could add an extra check when --enable-libmcheck is set but libmcheck
support could not be found, if people think it's important.

gdb/ChangeLog:

        * configure.ac: Add --enable-lmcheck configure option.
        * configure: Regenerate.

Tested on x86_64-linux, with and without --disable-lmcheck.
OK?

---
 gdb/configure    |   23 ++++++++++++++++++++++-
 gdb/configure.ac |   21 +++++++++++++++++++--
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/gdb/configure.ac b/gdb/configure.ac
index e48ec05..5771825 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -645,8 +645,25 @@ AC_SUBST(READLINE_DEPS)
 AC_SUBST(READLINE_CFLAGS)
 AC_SUBST(READLINE_TEXI_INCFLAG)
 
-dnl -lmcheck provides cheap enough memory mangling for debugging purposes.
-if $development; then
+# Provide a --enable-libmcheck/--disable-libmcheck set of options
+# allowing a user to enable this option even when building releases,
+# or to disable it when building a snapshot.
+AC_ARG_ENABLE(libmcheck,
+  AS_HELP_STRING([--enable-libmcheck],
+                 [Try building GDB with -lmcheck if available]),
+  [case "${enableval}" in
+     yes | y) ENABLE_LIBMCHECK="yes" ;;
+     no | n)  ENABLE_LIBMCHECK="no" ;;
+     *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmcheck) ;;
+   esac])
+
+# Enable -lmcheck by default (it provides cheap-enough memory mangling),
+# but turn it off for releases.
+if test -z "${ENABLE_LIBMCHECK}" && $development; then
+    ENABLE_LIBMCHECK=yes
+fi
+
+if test "$ENABLE_LIBMCHECK" = "yes" ; then
   AC_CHECK_LIB(mcheck, main)
 fi
 
diff --git a/gdb/configure b/gdb/configure
index 1d03188..1ea4ee9 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -795,6 +795,7 @@ with_zlib
 with_libiconv_prefix
 with_iconv_bin
 with_system_readline
+enable_libmcheck
 with_jit_reader_dir
 with_expat
 with_gnu_ld
@@ -1465,6 +1466,7 @@ Optional Features:
   --enable-tui            enable full-screen terminal user interface (TUI)
   --enable-gdbtk          enable gdbtk graphical user interface (GUI)
   --enable-profiling      enable profiling of GDB
+  --enable-libmcheck      Try building GDB with -lmcheck if available
   --disable-rpath         do not hardcode runtime library paths
   --enable-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings if gcc is used
@@ -7039,7 +7041,26 @@ fi
 
 
 
-if $development; then
+# Provide a --enable-libmcheck/--disable-libmcheck set of options
+# allowing a user to enable this option even when building releases,
+# or to disable it when building a snapshot.
+# Check whether --enable-libmcheck was given.
+if test "${enable_libmcheck+set}" = set; then :
+  enableval=$enable_libmcheck; case "${enableval}" in
+     yes | y) ENABLE_LIBMCHECK="yes" ;;
+     no | n)  ENABLE_LIBMCHECK="no" ;;
+     *) as_fn_error "bad value ${enableval} for --enable-libmcheck" "$LINENO" 5 ;;
+   esac
+fi
+
+
+# Enable -lmcheck by default (it provides cheap-enough memory mangling),
+# but turn it off for releases.
+if test -z "${ENABLE_LIBMCHECK}" && $development; then
+    ENABLE_LIBMCHECK=yes
+fi
+
+if test "$ENABLE_LIBMCHECK" = "yes" ; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5
 $as_echo_n "checking for main in -lmcheck... " >&6; }
 if test "${ac_cv_lib_mcheck_main+set}" = set; then :
-- 
1.7.1


             reply	other threads:[~2012-06-11 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11 20:39 Joel Brobecker [this message]
2012-06-12  7:42 ` Jan Kratochvil
2012-06-12 16:55   ` Joel Brobecker
2012-06-12 17:00     ` Jan Kratochvil
2012-07-25 18:39 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339447127-314-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox