From 62deee41592d7522d7fc3c3686d657bc36d80638 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Thu, 20 Nov 2025 10:05:19 -0800 Subject: [PATCH] [LLDB] Add a child property to compliment the existing parent property (#168619) I've been working on some scripts that evaluate the parent and child frame. It's been very annoying that the parent frame has a property but not the child. So I've added this to the extensions, I would've preferred to return None, but because the existing impl returns an invalid SBFrame, so I'm conforming to that API. ``` (lldb) script Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D. >>> lldb.frame frame #0: 0x0000555555555200 fib.out`main >>> lldb.frame.parent frame #1: 0x00007ffff782a610 libc.so.6`__libc_start_call_main + 128 >>> lldb.frame.parent.child frame #0: 0x0000555555555200 fib.out`main ``` --- lldb/bindings/interface/SBFrameExtensions.i | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lldb/bindings/interface/SBFrameExtensions.i b/lldb/bindings/interface/SBFrameExtensions.i index 38d03abaee8f..0c79b98b290f 100644 --- a/lldb/bindings/interface/SBFrameExtensions.i +++ b/lldb/bindings/interface/SBFrameExtensions.i @@ -24,6 +24,13 @@ STRING_EXTENSION_OUTSIDE(SBFrame) else: return SBFrame() + def get_child_frame(self): + child_idx = self.idx - 1 + if child_idx >= 0: + return self.thread.frame[child_idx] + else: + return SBFrame() + def get_arguments(self): return self.GetVariables(True,False,False,False) @@ -92,6 +99,7 @@ STRING_EXTENSION_OUTSIDE(SBFrame) register = 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.''') 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''') parent = property(get_parent_frame, None, doc='''A read only property that returns the parent (caller) frame of the current frame.''') + child = property(get_child_frame, None, doc='''A read only property that returns the child (callee) frame of the current frame.''') %} #endif }