From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13381 invoked by alias); 30 Aug 2012 18:05:21 -0000 Received: (qmail 12937 invoked by uid 22791); 30 Aug 2012 18:05:18 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD,TW_BM X-Spam-Check-By: sourceware.org Received: from server-nat-6.cs.umd.edu (HELO bacon.cs.umd.edu) (128.8.127.149) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Aug 2012 18:05:04 +0000 Received: from wireless-206-196-164-53.umd.edu (wireless-206-196-164-53.umd.edu [206.196.164.53]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 04237B40CD3; Thu, 30 Aug 2012 14:05:02 -0400 (EDT) Subject: Re: [patch] Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk") Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/mixed; boundary=Apple-Mail-7-822997546 From: Khoo Yit Phang In-Reply-To: <20120830164317.GA27381@host2.jankratochvil.net> Date: Thu, 30 Aug 2012 18:05:00 -0000 Cc: Khoo Yit Phang , Hui Zhu , gdb-patches@sourceware.org Message-Id: <310D6419-544D-4D08-BB8B-21BC87C8241A@cs.umd.edu> References: <20120719073959.GA10044@host2.jankratochvil.net> <20120830164317.GA27381@host2.jankratochvil.net> To: Jan Kratochvil X-CSD-MailScanner-ID: 04237B40CD3.AA99C X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-50, required 5, autolearn=not spam, ALL_TRUSTED -50.00) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-CSD-MailScanner-Watermark: 1346954702.14796@jbQDUKCoTqz3Ox3WnimFHA Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00872.txt.bz2 --Apple-Mail-7-822997546 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 855 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 >=20 > This patch does not seem to require copyright assignment but it would be = safer > to complete one for example from Sergio Durigan Junior . > 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 threa= ding"); 2) -lmcheck is not enabled by default when Python is available with= reads; and 3) running configure with --enable-lmcheck when Python is avail= able with threads now leads to a warning, rather than disabling -lmcheck. Thanks, Yit August 30, 2012 --Apple-Mail-7-822997546 Content-Disposition: attachment; filename=mcheck-python.txt Content-Type: text/plain; name="mcheck-python.txt" Content-Transfer-Encoding: quoted-printable Content-length: 3542 # HG changeset patch # Parent 38ae59cbbba369e1b4bd78b4b2f378e26548b79d Do not enable -lmcheck by default when Python is enabled with threading sup= port. gdb/ChangeLog: 2012-08-30 Khoo Yit Phang 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=3Dyes. Warn if --enable-lmcheck=3Dyes and python_has_threads=3Dyes. * 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) =20 -# 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=3D"yes" ;; - no | n) ENABLE_LIBMCHECK=3D"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=3Dyes -fi - -if test "$ENABLE_LIBMCHECK" =3D "yes" ; then - AC_CHECK_LIB(mcheck, main) -fi - # Generate jit-reader.h =20 # 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=3Dyes + else + python_has_threads=3Dno + 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=3D python_libs=3D + python_has_threads=3Dyes have_python_config=3Dno fi =20 @@ -1028,6 +1012,34 @@ AC_SUBST(PYTHON_CPPFLAGS) AC_SUBST(PYTHON_LIBS) =20 +# 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=3D"yes" ;; + no | n) ENABLE_LIBMCHECK=3D"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}" =3D "no" \ + -o "${python_has_threads}" =3D "no" \) \ + && $development; then + ENABLE_LIBMCHECK=3Dyes +fi + +if test "$ENABLE_LIBMCHECK" =3D "yes" ; then + if test "${have_libpython}" !=3D "no" -a "${python_has_threads}" =3D "ye= s" ; 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. # # ------------------------- # --Apple-Mail-7-822997546--