From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7049 invoked by alias); 22 Jan 2014 16:00:41 -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 7036 invoked by uid 89); 22 Jan 2014 16:00:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 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 16:00:40 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0MG0bgE027377 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Jan 2014 11:00:38 -0500 Received: from barimba.redhat.com (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0MG01PD031078; Wed, 22 Jan 2014 11:00:27 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 3/3] avoid python exception in FrameDecorator.py Date: Wed, 22 Jan 2014 16:00:00 -0000 Message-Id: <1390406399-26664-4-git-send-email-tromey@redhat.com> In-Reply-To: <1390406399-26664-1-git-send-email-tromey@redhat.com> References: <1390406399-26664-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-01/txt/msg00860.txt.bz2 This fixes a bug in FrameDecorator.py. FrameVars seems to assume that Frame.block can return None if there is no block. However, it actually throws an exception. I saw this bug while developing a frame filter, but unfortunately I don't know how to reproduce it. It seems to me that the SAL tests in _is_limited_frame should exclude the bad cases; and in my attempts to write a test they do. Nevertheless I think the fix is reasonably obvious and ought to go in. 2014-01-22 Tom Tromey PR python/16485: * python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args): Handle exception from frame.block. (FrameVars.fetch_frame_locals): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/python/lib/gdb/FrameDecorator.py | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gdb/python/lib/gdb/FrameDecorator.py b/gdb/python/lib/gdb/FrameDecorator.py index 1b8b4ed..1bbc5ab 100644 --- a/gdb/python/lib/gdb/FrameDecorator.py +++ b/gdb/python/lib/gdb/FrameDecorator.py @@ -258,7 +258,10 @@ class FrameVars(object): are no frame local variables, return an empty list.""" lvars = [] - block = self.frame.block() + try: + block = self.frame.block() + except RuntimeError: + block = None while block != None: if block.is_global or block.is_static: @@ -279,7 +282,12 @@ class FrameVars(object): there are no frame argument variables, return an empty list.""" args = [] - block = self.frame.block() + + try: + block = self.frame.block() + except RuntimeError: + block = None + while block != None: if block.function != None: break -- 1.8.1.4