Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH 3/3] avoid python exception in FrameDecorator.py
Date: Wed, 22 Jan 2014 16:00:00 -0000	[thread overview]
Message-ID: <1390406399-26664-4-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1390406399-26664-1-git-send-email-tromey@redhat.com>

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  <tromey@redhat.com>

	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


  reply	other threads:[~2014-01-22 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 17:51 [PATCH 0/3] frame filter fixes, proposed for 7.7 Tom Tromey
2014-01-22 16:00 ` Tom Tromey [this message]
2014-01-22 16:00 ` [PATCH 1/3] fix crash in frame filters Tom Tromey
2014-01-22 19:58   ` Phil Muldoon
2014-01-23  6:04     ` Joel Brobecker
2014-01-22 16:50 ` [PATCH 2/3] fix erroneous error-handling in frame filter code Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390406399-26664-4-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox