avoid python exception in FrameDecorator.py
authorTom Tromey <tromey@redhat.com>
Wed, 22 Jan 2014 15:52:15 +0000 (08:52 -0700)
committerTom Tromey <tromey@redhat.com>
Thu, 23 Jan 2014 15:03:52 +0000 (08:03 -0700)
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-23  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
gdb/python/lib/gdb/FrameDecorator.py

index 2e09ef6c46121c1016c05340c3e8e48eb0fde697..b4acab81fa6cc39eb8c2da52364b606226ff911a 100644 (file)
@@ -1,3 +1,10 @@
+2014-01-23  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.
+
 2014-01-23  Tom Tromey  <tromey@redhat.com>
 
        PR python/16487:
index 1b8b4eda3cdd0a9ea4fa902fee82816be3dfb4fa..1bbc5ab1ce7c2f3caa580aae5d097b172fdabbb4 100644 (file)
@@ -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