From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7267 invoked by alias); 30 Aug 2012 16:43:40 -0000 Received: (qmail 7257 invoked by uid 22791); 30 Aug 2012 16:43:39 -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; Thu, 30 Aug 2012 16:43:25 +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 q7UGhMUo011057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 30 Aug 2012 12:43:22 -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 q7UGhHcZ028868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 30 Aug 2012 12:43:20 -0400 Date: Thu, 30 Aug 2012 16:43:00 -0000 From: Jan Kratochvil To: Khoo Yit Phang Cc: Hui Zhu , gdb-patches@sourceware.org Subject: [patch] Re: Disable -lmcheck when Python has threads (Re: [BUG] gdb crash when "python import gtk") Message-ID: <20120830164317.GA27381@host2.jankratochvil.net> References: <20120719073959.GA10044@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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/msg00869.txt.bz2 On Thu, 30 Aug 2012 18:00:46 +0200, Khoo Yit Phang wrote: > 2012-08-30 Khoo Yit Phang 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. > Disable -lmcheck when Python is enabled with threading support. > * configure.ac: Move --enable-lmcheck after --with-python, and > disable if python_has_threads=yes. Describe it more technically, new variable python_has_threads, check ${python_prog} --has-threads etc. [...] > +# 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 > + if test "${have_libpython}" != "no" -a "${python_has_threads}" = "yes" ; then > + AC_MSG_WARN(libmcheck disabled since python has threads) > + else > + AC_CHECK_LIB(mcheck, main) > + fi > +fi I am fine with this goal of disabling -lmcheck by default (when --enable-libmcheck was not specified) when threaded libpython is linked in. But when user explicitly specifies --enable-libmcheck it should give the warning but still enable libmcheck. In most of the uses of GDB libmcheck is safe with GDB. > --- a/gdb/python/python-config.py > +++ b/gdb/python/python-config.py > @@ -1,5 +1,5 @@ > # Program to fetch python compilation parameters. > -# Copied from python-config of the 2.7 release. > +# Copied from python-config of the 2.7 release, modified to test for threads. Please submit it also for Python. The commit in GDB sources is OK as long as it gets imported by upstream Python. They may also suggest some other solution if they do not agree with this one. Thanks for catching it. Jan