From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11194 invoked by alias); 30 Aug 2012 18:58:39 -0000 Received: (qmail 11180 invoked by uid 22791); 30 Aug 2012 18:58:38 -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:58:25 +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 A34F3B40793; Thu, 30 Aug 2012 14:58:22 -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-9-826198139 From: Khoo Yit Phang In-Reply-To: <20120830182122.GA31421@host2.jankratochvil.net> Date: Thu, 30 Aug 2012 18:58:00 -0000 Cc: Khoo Yit Phang , Hui Zhu , gdb-patches@sourceware.org Message-Id: <5C297339-3CCE-4350-9C7B-2C99B9FA01CA@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> To: Jan Kratochvil X-CSD-MailScanner-ID: A34F3B40793.A8015 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: 1346957903.02607@Hax+pEPqVxDID5pnlu9VPw 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/msg00876.txt.bz2 --Apple-Mail-9-826198139 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 1685 Hi, On Aug 30, 2012, at 2:21 PM, Jan Kratochvil wrote: > On Thu, 30 Aug 2012 20:05:01 +0200, Khoo Yit Phang wrote: >> 1) I reverted python-config.py and used a different method to test for >> threads ("python -m threading"); >=20 > Unfortunately it does not work for me with python-2.7, only with python-3= .3, > tested on Fedora 18 x86_64: >=20 > $ python3 -m threading;echo $? > 0 > $ python3 -m threadin;echo $? > /usr/bin/python3: No module named threadin > 1 >=20 > but: >=20 > $ python2 -m threading;echo $? > Traceback (most recent call last): > File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main > "__main__", fname, loader, pkg_name) > File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code > exec code in run_globals > File "/usr/lib64/python2.7/threading.py", line 985, in > _test() > File "/usr/lib64/python2.7/threading.py", line 969, in _test > Q =3D BoundedQueue(QL) > File "/usr/lib64/python2.7/threading.py", line 912, in __init__ > self.queue =3D deque() > NameError: global name 'deque' is not defined > 255 >=20 > python3-3.3.0-0.3.b2.fc18.x86_64 > python-2.7.3-13.fc18.x86_64 >=20 > GDB moveover currently is not compatible with python3.x at all. >=20 > I do not know much Python but I would guess thread-less Pythons are rare, > aren't they? There would be also a possibility to assume Python is threa= ded, > if one already links with Python. That's strange, it works for me under Ubuntu 11.04 with Python 2.7.1 and RH= EL5 with Python 2.6.6. I suppose it would be easier to just assume Python i= s threaded, this new patch does that. I'll check it in if it looks alright. Thanks, Yit August 30, 2012 --Apple-Mail-9-826198139 Content-Disposition: attachment; filename=mcheck-python.txt Content-Type: text/plain; name="mcheck-python.txt" Content-Transfer-Encoding: quoted-printable Content-length: 2704 # HG changeset patch # Parent 38ae59cbbba369e1b4bd78b4b2f378e26548b79d Do not enable -lmcheck by default when Python is enabled. gdb/ChangeLog: 2012-08-30 Khoo Yit Phang Do not enable -lmcheck by default when Python is enabled. * configure.ac: Move --enable-lmcheck after --with-python. Do not enable -lmcheck by default if have_libpython=3Dyes. Warn if --enable-lmcheck=3Dyes and have_libpython=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 @@ -1028,6 +1006,32 @@ 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" \ + && $development ; then + ENABLE_LIBMCHECK=3Dyes +fi + +if test "$ENABLE_LIBMCHECK" =3D "yes" ; then + if test "${have_libpython}" !=3D "no" ; 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-9-826198139 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-length: 3 --Apple-Mail-9-826198139--