summaryrefslogtreecommitdiff
path: root/lldb/bindings
diff options
context:
space:
mode:
authorMichael Kruse <llvm-project@meinersbur.de>2025-01-03 10:22:51 +0100
committerMichael Kruse <llvm-project@meinersbur.de>2025-01-03 10:22:51 +0100
commit38500d63e14ce340236840f60d356cdefb56a52c (patch)
tree17edbec446ce9b50d2f215a483b83afb293a635d /lldb/bindings
parent1a3d5daaef7a6a63448a497da3eff7fc9e23df26 (diff)
parent27f30029741ecf023baece7b3dde1ff9011ffefc (diff)
Merge branch 'main' into users/meinersbur/flang_runtime_split-headersusers/meinersbur/flang_runtime_split-headers
Diffstat (limited to 'lldb/bindings')
-rw-r--r--lldb/bindings/interface/SBValueExtensions.i16
1 files changed, 15 insertions, 1 deletions
diff --git a/lldb/bindings/interface/SBValueExtensions.i b/lldb/bindings/interface/SBValueExtensions.i
index bee9c27775d4..f0c8797bd5f7 100644
--- a/lldb/bindings/interface/SBValueExtensions.i
+++ b/lldb/bindings/interface/SBValueExtensions.i
@@ -7,7 +7,7 @@ STRING_EXTENSION_OUTSIDE(SBValue)
return self.GetDynamicValue (eDynamicCanRunTarget)
class children_access(object):
- '''A helper object that will lazily hand out thread for a process when supplied an index.'''
+ '''A helper object that will lazily hand out child values when supplied an index.'''
def __init__(self, sbvalue):
self.sbvalue = sbvalue
@@ -29,6 +29,19 @@ STRING_EXTENSION_OUTSIDE(SBValue)
'''An accessor function that returns a children_access() object which allows lazy member variable access from a lldb.SBValue object.'''
return self.children_access (self)
+ def get_member_access_object(self):
+ '''An accessor function that returns an interface which provides subscript based lookup of child members.'''
+ class member_access:
+ def __init__(self, valobj):
+ self.valobj = valobj
+
+ def __getitem__(self, key):
+ if isinstance(key, str):
+ return self.valobj.GetChildMemberWithName(key)
+ raise TypeError("member key must be a string")
+
+ return member_access(self)
+
def get_value_child_list(self):
'''An accessor function that returns a list() that contains all children in a lldb.SBValue object.'''
children = []
@@ -50,6 +63,7 @@ STRING_EXTENSION_OUTSIDE(SBValue)
children = property(get_value_child_list, None, doc='''A read only property that returns a list() of lldb.SBValue objects for the children of the value.''')
child = property(get_child_access_object, None, doc='''A read only property that returns an object that can access children of a variable by index (child_value = value.children[12]).''')
+ member = property(get_member_access_object, None, doc='''A read only property that returns an object that can access child members by name.''')
name = property(GetName, None, doc='''A read only property that returns the name of this value as a string.''')
type = property(GetType, None, doc='''A read only property that returns a lldb.SBType object that represents the type for this value.''')
size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this value.''')