Add a .parent property to SBFrame's Python interface which allows easy access to...
authorEnrico Granata <egranata@apple.com>
Tue, 16 Jun 2015 21:07:52 +0000 (21:07 +0000)
committerEnrico Granata <egranata@apple.com>
Tue, 16 Jun 2015 21:07:52 +0000 (21:07 +0000)
llvm-svn: 239853

lldb/scripts/interface/SBFrame.i

index 5a5bbf4..2211dd1 100644 (file)
@@ -273,6 +273,13 @@ public:
     %pythoncode %{
         def get_all_variables(self):
             return self.GetVariables(True,True,True,True)
+        
+        def get_parent_frame(self):
+            parent_idx = self.idx + 1
+            if parent_idx >= 0 and parent_idx < len(self.thread.frame):
+                return self.thread.frame[parent_idx]
+            else:
+                return SBFrame()
 
         def get_arguments(self):
             return self.GetVariables(True,False,False,False)
@@ -382,6 +389,9 @@ public:
         __swig_getmethods__["reg"] = get_registers_access
         if _newclass: reg = property(get_registers_access, None, doc='''A read only property that returns an helper object providing a flattened indexable view of the CPU registers for this stack frame''')
 
+        __swig_getmethods__["parent"] = get_parent_frame
+        if _newclass: parent = property(get_parent_frame, None, doc='''A read only property that returns the parent (caller) frame of the current frame.''')
+
     %}
 };