From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31042 invoked by alias); 31 Aug 2012 18:03:08 -0000 Received: (qmail 31000 invoked by uid 22791); 31 Aug 2012 18:03:05 -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; Fri, 31 Aug 2012 18:02:48 +0000 Received: from wireless-206-196-162-181.umd.edu (wireless-206-196-162-181.umd.edu [206.196.162.181]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 3C6FCB40228; Fri, 31 Aug 2012 14:02:45 -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-18-909259832 From: Khoo Yit Phang In-Reply-To: Date: Fri, 31 Aug 2012 18:03:00 -0000 Cc: Khoo Yit Phang , Jan Kratochvil , Hui Zhu , gdb-patches@sourceware.org, David Malcolm Message-Id: <040788AC-CFFC-4DC7-B6B8-302E38B72F6D@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> <5567AD5F-AB82-4002-8A36-BFFF776093BD@cs.umd.edu> <20120831081353.GA23421@host2.jankratochvil.net> <292C2B59-D40B-451F-B69B-0730BFB06619@cs.umd.edu> <630BF15A-54CB-421E-94D2-0CB1C188E7F1@cs.umd.edu> To: Andreas Schwab X-CSD-MailScanner-ID: 3C6FCB40228.AA16A 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: 1347040965.40361@aFLEbmifIjUPmiNsNNHrsA 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/msg00898.txt.bz2 --Apple-Mail-18-909259832 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 283 Hi, Here's an update patch that does not use -a/-o, as per autoconf recommendat= ions (http://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/L= imitations-of-Builtins.html#index-g_t_0040command_007btest_007d-1583). Does= it look good? Thanks, Yit August 31, 2012 --Apple-Mail-18-909259832 Content-Disposition: attachment; filename=mcheck-python.txt Content-Type: text/plain; name="mcheck-python.txt" Content-Transfer-Encoding: quoted-printable Content-length: 3822 # HG changeset patch # Parent 8db089d9c7da1d50e6cb2732cef1f7ed226a1889 Do not enable -lmcheck by default when Python is enabled with threading sup= port. gdb/ChangeLog: 2012-08-31 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 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,23 @@ fi ;; esac + + # Note that "python -m threading" cannot be used to check for + # threading support due to a bug in Python 2.7.3 + # (http://bugs.python.org/issue15567). + AC_MSG_CHECKING(whether python supports threads) + saved_CPPFLAGS=3D"${CPPFLAGS}" + CPPFLAGS=3D"${PYTHON_CPPFLAGS}" + # Note that the test is reversed so that python_has_threads=3Dyes on + # unexpected failures. + AC_PREPROC_IFELSE(AC_LANG_SOURCE([[ +#include +#ifdef WITH_THREAD +# error +#endif + ]]), [python_has_threads=3Dno], [python_has_threads=3Dyes]) + 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 +1023,37 @@ 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, since -lmcheck is +# not thread safe (http://sourceware.org/bugzilla/show_bug.cgi?id=3D9939), +# and for releases. +if test -z "${ENABLE_LIBMCHECK}" \ + && { test "${have_libpython}" =3D "no" \ + || test "${python_has_threads}" =3D "no"; } \ + && $development; then + ENABLE_LIBMCHECK=3Dyes +fi + +if test "$ENABLE_LIBMCHECK" =3D "yes" ; then + if test "${have_libpython}" !=3D "no" \ + && test "${python_has_threads}" =3D "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. # # ------------------------- # --Apple-Mail-18-909259832--