DebugClients/Python3/DebugBase.py

changeset 4309
cc9c62f55413
parent 4293
125a75cfd249
child 4365
d97f2e05ae1b
--- a/DebugClients/Python3/DebugBase.py	Sat Jul 04 14:46:40 2015 +0200
+++ b/DebugClients/Python3/DebugBase.py	Sat Jul 04 17:31:46 2015 +0200
@@ -89,13 +89,23 @@
         """
         return self.currentFrame
     
-    def getCurrentFrameLocals(self):
+    def getFrameLocals(self, frmnr=0):
         """
-        Public method to return the locals dictionary of the current frame.
+        Public method to return the locals dictionary of the current frame
+        or a frame below.
         
-        @return locals dictionary of the current frame
+        @keyparam frmnr distance of frame to get locals dictionary of. 0 is
+            the current frame (int)
+        @return locals dictionary of the frame
         """
-        return self.currentFrameLocals
+        if frmnr:
+            f = self.currentFrame
+            while f is not None and frmnr > 0:
+                f = f.f_back
+                frmnr -= 1
+            return f.f_locals
+        else:
+            return self.currentFrameLocals
     
     def step(self, traceMode):
         """
@@ -824,7 +834,7 @@
         if fn[0] == '<':
             return True
 
-        #XXX - think of a better way to do this.  It's only a convience for
+        #XXX - think of a better way to do this.  It's only a convenience for
         #debugging the debugger - when the debugger code is in the current
         #directory.
         if os.path.basename(fn) in [

eric ide

mercurial