Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Khoo Yit Phang <khooyp@cs.umd.edu>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Khoo Yit Phang <khooyp@cs.umd.edu>, Hui Zhu <teawater@gmail.com>,
	gdb-patches@sourceware.org
Subject: Re: [patch] Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk")
Date: Thu, 30 Aug 2012 18:05:00 -0000	[thread overview]
Message-ID: <310D6419-544D-4D08-BB8B-21BC87C8241A@cs.umd.edu> (raw)
In-Reply-To: <20120830164317.GA27381@host2.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 861 bytes --]

Hi,

On Aug 30, 2012, at 12:43 PM, Jan Kratochvil wrote:

> On Thu, 30 Aug 2012 18:00:46 +0200, Khoo Yit Phang wrote:
>> 2012-08-30  Khoo Yit Phang  <khooyp@cs.umd.edu>
> 
> This patch does not seem to require copyright assignment but it would be safer
> to complete one for example from Sergio Durigan Junior <sergiodj@redhat.com>.
> Also for any possible future contributions.

I have copyright assignment set up, and commit access.

I've attached a new patch with the following changes: 1) I reverted python-config.py and used a different method to test for threads ("python -m threading"); 2) -lmcheck is not enabled by default when Python is available with reads; and 3) running configure with --enable-lmcheck when Python is available with threads now leads to a warning, rather than disabling -lmcheck.

Thanks,

Yit
August 30, 2012


[-- Attachment #2: mcheck-python.txt --]
[-- Type: text/plain, Size: 3590 bytes --]

# HG changeset patch
# Parent 38ae59cbbba369e1b4bd78b4b2f378e26548b79d
Do not enable -lmcheck by default when Python is enabled with threading support.

gdb/ChangeLog:

2012-08-30  Khoo Yit Phang  <khooyp@cs.umd.edu>

	Do not enable -lmcheck by default when Python is enabled with
	threading support.
	* configure.ac: (python_has_threads) New variable, by testing
	"python -m threading".
	Move --enable-lmcheck after --with-python.
	Do not enable -lmcheck by default if python_has_threads=yes.
	Warn if --enable-lmcheck=yes and python_has_threads=yes.
	* configure: Regenerate.

diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -645,28 +645,6 @@
 AC_SUBST(READLINE_CFLAGS)
 AC_SUBST(READLINE_TEXI_INCFLAG)
 
-# 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
-
 # Generate jit-reader.h
 
 # This is typedeffed to GDB_CORE_ADDR in jit-reader.h
@@ -882,6 +860,11 @@
         AC_ERROR(failure running python-config --exec-prefix)
       fi
     fi
+    if ${python_prog} -m threading >/dev/null 2>/dev/null; then
+      python_has_threads=yes
+    else
+      python_has_threads=no
+    fi
   else
     # We do not have a python executable we can use to determine where
     # to find the Python headers and libs.  We cannot guess the include
@@ -890,6 +873,7 @@
     # do except assume that the compiler will be able to find those files.
     python_includes=
     python_libs=
+    python_has_threads=yes
     have_python_config=no
   fi
 
@@ -1028,6 +1012,34 @@
 AC_SUBST(PYTHON_CPPFLAGS)
 AC_SUBST(PYTHON_LIBS)
 
+# 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 if Python is enabled with threads, and for releases.
+if test -z "${ENABLE_LIBMCHECK}" \
+        -a \( "${have_libpython}" = "no" \
+	     -o "${python_has_threads}" = "no" \) \
+    && $development; then
+  ENABLE_LIBMCHECK=yes
+fi
+
+if test "$ENABLE_LIBMCHECK" = "yes" ; then
+  if test "${have_libpython}" != "no" -a "${python_has_threads}" = "yes" ; then
+    AC_MSG_WARN(--enable-libmcheck may lead to spurious crashes if threads are used in python)
+  fi
+  AC_CHECK_LIB(mcheck, main)
+fi
+
 # ------------------------- #
 # Checks for header files.  #
 # ------------------------- #

  reply	other threads:[~2012-08-30 18:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANFwon0wEXd+40H85veHyRTg+itYyL2jjgsCMYByxk5K0MTLHA@mail.gmail.com>
     [not found] ` <20120719073959.GA10044@host2.jankratochvil.net>
     [not found]   ` <A681786A-58A1-41E6-8410-8EBD8330E6BE@cs.umd.edu>
2012-08-30 16:43     ` Jan Kratochvil
2012-08-30 18:05       ` Khoo Yit Phang [this message]
2012-08-30 18:21         ` Jan Kratochvil
2012-08-30 18:58           ` Khoo Yit Phang
2012-08-30 19:05             ` Jan Kratochvil
2012-08-30 19:28               ` Khoo Yit Phang
2012-08-31  1:32                 ` Khoo Yit Phang
2012-08-31  8:14                   ` Jan Kratochvil
2012-08-31 15:30                     ` Khoo Yit Phang
2012-08-31 15:41                       ` Andreas Schwab
2012-08-31 16:08                         ` Khoo Yit Phang
2012-08-31 17:02                           ` Andreas Schwab
2012-08-31 18:03                             ` Khoo Yit Phang
2012-08-31 18:23                           ` Jan Kratochvil
2012-08-31 18:41                             ` Khoo Yit Phang
2012-09-02 15:37                               ` Jan Kratochvil
2012-09-06 19:31                                 ` Khoo Yit Phang
2012-08-30 18:22         ` Sergio Durigan Junior
2012-08-30 18:45           ` Khoo Yit Phang

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=310D6419-544D-4D08-BB8B-21BC87C8241A@cs.umd.edu \
    --to=khooyp@cs.umd.edu \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=teawater@gmail.com \
    /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