From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2314 invoked by alias); 31 Aug 2012 01:32:28 -0000 Received: (qmail 2298 invoked by uid 22791); 31 Aug 2012 01:32:25 -0000 X-SWARE-Spam-Status: No, hits=-3.6 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; Fri, 31 Aug 2012 01:32:11 +0000 Received: from [192.168.32.3] (pool-108-48-101-140.washdc.fios.verizon.net [108.48.101.140]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id B7369B40DF3; Thu, 30 Aug 2012 21:32:07 -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-13-849823155 From: Khoo Yit Phang In-Reply-To: <184D5CC3-BC35-4CA1-BE77-FC4D30D50E84@cs.umd.edu> Date: Fri, 31 Aug 2012 01:32:00 -0000 Cc: Jan Kratochvil , Hui Zhu , gdb-patches@sourceware.org, David Malcolm Message-Id: <5567AD5F-AB82-4002-8A36-BFFF776093BD@cs.umd.edu> References: <20120719073959.GA10044@host2.jankratochvil.net> <20120830164317.GA27381@host2.jankratochvil.net> <310D6419-544D-4D08-BB8B-21BC87C8241A@cs.umd.edu> <20120830182122.GA31421@host2.jankratochvil.net> <5C297339-3CCE-4350-9C7B-2C99B9FA01CA@cs.umd.edu> <20120830190523.GA781@host2.jankratochvil.net> <184D5CC3-BC35-4CA1-BE77-FC4D30D50E84@cs.umd.edu> To: Khoo Yit Phang X-CSD-MailScanner-ID: B7369B40DF3.A0AC3 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: 1346981529.20403@uSdC4pQAzgUhvDuOpdTtfQ 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/msg00880.txt.bz2 --Apple-Mail-13-849823155 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 239 Hi, Here's another update to my patch: it checks whether Python has threads usi= ng the same technique as in gdb/Python/python-internal.h, that is by testin= g if WITH_THREAD is defined in Python.h. Is this better? Yit August 30, 2012 --Apple-Mail-13-849823155 Content-Disposition: attachment; filename=mcheck-python.txt Content-Type: text/plain; name="mcheck-python.txt" Content-Transfer-Encoding: quoted-printable Content-length: 3462 # HG changeset patch # Parent 70f7f4713a0f0828f9b8c3a7163ee881f01de122 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 if WITH_THREAD is defined in Python.h. 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 @@ -1017,6 +995,18 @@ fi ;; esac + + AC_MSG_CHECKING(whether python supports threads) + saved_CPPFLAGS=3D"${CPPFLAGS}" + CPPFLAGS=3D"${PYTHON_CPPFLAGS}" + AC_PREPROC_IFELSE(AC_LANG_SOURCE([[ +#include +#ifndef WITH_THREAD +#error +#endif + ]]), [python_has_threads=3Dyes], [python_has_threads=3Dno]) + AC_MSG_RESULT(${python_has_threads}) + CPPFLAGS=3D"${saved_CPPFLAGS}" else # Even if Python support is not compiled in, we need to have these files # included. @@ -1028,6 +1018,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-13-849823155--