[Lldb-commits] [lldb] r239853 - Add a .parent property to SBFrame's Python interface which allows easy access to the caller frame of the current frame

Enrico Granata egranata at apple.com
Tue Jun 16 14:07:52 PDT 2015


Author: enrico
Date: Tue Jun 16 16:07:52 2015
New Revision: 239853

URL: http://llvm.org/viewvc/llvm-project?rev=239853&view=rev
Log:
Add a .parent property to SBFrame's Python interface which allows easy access to the caller frame of the current frame


Modified:
    lldb/trunk/scripts/interface/SBFrame.i

Modified: lldb/trunk/scripts/interface/SBFrame.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBFrame.i?rev=239853&r1=239852&r2=239853&view=diff
==============================================================================
--- lldb/trunk/scripts/interface/SBFrame.i (original)
+++ lldb/trunk/scripts/interface/SBFrame.i Tue Jun 16 16:07:52 2015
@@ -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.''')
+
     %}
 };
 





More information about the lldb-commits mailing list