From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 310 invoked by alias); 31 Aug 2012 08:14:27 -0000 Received: (qmail 32753 invoked by uid 22791); 31 Aug 2012 08:14:23 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 31 Aug 2012 08:14:05 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7V8E1kH011691 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 31 Aug 2012 04:14:01 -0400 Received: from host2.jankratochvil.net (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7V8Dsqs029981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 31 Aug 2012 04:13:57 -0400 Date: Fri, 31 Aug 2012 08:14:00 -0000 From: Jan Kratochvil To: Khoo Yit Phang Cc: Hui Zhu , gdb-patches@sourceware.org, David Malcolm Subject: Re: [patch] Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk") Message-ID: <20120831081353.GA23421@host2.jankratochvil.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5567AD5F-AB82-4002-8A36-BFFF776093BD@cs.umd.edu> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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/msg00882.txt.bz2 On Fri, 31 Aug 2012 03:32:06 +0200, Khoo Yit Phang wrote: > 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=yes. > Warn if --enable-lmcheck=yes and python_has_threads=yes. > * configure: Regenerate. OK with the changes below. Be sure to use autoconf-2.64 so that configure gets regenerated without unrelated version changes. > 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 > @@ -1017,6 +995,18 @@ > fi > ;; > esac > + Put here a comment with reference to the Python issue why '-m threading' is not used. > + AC_MSG_CHECKING(whether python supports threads) > + saved_CPPFLAGS="${CPPFLAGS}" > + CPPFLAGS="${PYTHON_CPPFLAGS}" > + AC_PREPROC_IFELSE(AC_LANG_SOURCE([[ > +#include > +#ifndef WITH_THREAD > +#error > +#endif A nitpick but the indentation should be: #ifndef WITH_THREAD # error #endif > + ]]), [python_has_threads=yes], [python_has_threads=no]) Revert the condition. If for any reason the compilation fails then it is safer to default to 'python_has_threads=yes' than to 'no'. > + AC_MSG_RESULT(${python_has_threads}) > + CPPFLAGS="${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) > > +# 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. Here should be also comment with the PR libc/9939 to explain why to "turn it off if Python is enabled with threads". > +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. # > # ------------------------- # Thanks, Jan