From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1739 invoked by alias); 22 Jan 2014 19:58:07 -0000 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 Received: (qmail 1630 invoked by uid 89); 22 Jan 2014 19:58:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Jan 2014 19:58:05 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0MJw4AZ022625 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Jan 2014 14:58:04 -0500 Received: from localhost.localdomain (ovpn-112-23.ams2.redhat.com [10.36.112.23]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0MJvxit012941 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 22 Jan 2014 14:58:03 -0500 Date: Wed, 22 Jan 2014 19:58:00 -0000 From: Phil Muldoon To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] fix crash in frame filters Message-ID: <20140122195759.GE24832@localhost.localdomain> Reply-To: pmuldoon@redhat.com References: <1390406399-26664-1-git-send-email-tromey@redhat.com> <1390406399-26664-2-git-send-email-tromey@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1390406399-26664-2-git-send-email-tromey@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00880.txt.bz2 On Wed, 22 Jan 2014, Tom Tromey wrote: > apply_frame_filter calls ensure_python_env before computing the > gdbarch to use. This means that python_gdbarch can be NULL while in > Python code, and if a frame filter depends on this somehow (easy to > do), gdb will crash. > > The fix is to compute the gdbarch first. > > Built and regtested on x86-64 Fedora 18. > New test case included. > > 2014-01-22 Tom Tromey > > PR python/16491: > * python/py-framefilter.c (apply_frame_filter): Call > ensure_python_env after computing gdbarch. > > 2014-01-22 Tom Tromey > > PR python/16491: > * gdb.python/py-framefilter.py (Reverse_Function.function): Read a > string from an inferior frame. > * gdb.python/py-framefilter-mi.exp: Update. These are all fine, and thanks for fixing them. I think they should proceed into 7.7 too. Especially this one: > diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c > index 76ce4e5..c6a29ef 100644 > --- a/gdb/python/py-framefilter.c > +++ b/gdb/python/py-framefilter.c > @@ -1477,18 +1477,18 @@ apply_frame_filter (struct frame_info *frame, int flags, > if (!gdb_python_initialized) > return PY_BT_NO_FILTERS; > > - cleanups = ensure_python_env (gdbarch, current_language); > - > TRY_CATCH (except, RETURN_MASK_ALL) > { > gdbarch = get_frame_arch (frame); > } > if (except.reason < 0) > { > - gdbpy_convert_exception (except); > - goto error; > + /* Let gdb try to print the stack trace. */ > + return PY_BT_NO_FILTERS; > } > > + cleanups = ensure_python_env (gdbarch, current_language); > + Ugh ugly. Ssing gdbarch when it is NULL before querying the frame for an architecture is especially clumsy. :( mea culpa. Cheers, Phil