import lldb def Array_SummaryProvider(valobj, internal_dict): size = valobj.GetChildMemberWithName('arraySize').GetValueAsUnsigned(0) return f"Array(size={size})" class ArraySyntheticProvider: def __init__(self, valobj, internal_dict): self.valobj = valobj self.update() def num_children(self): return self.size def get_child_index(self, name): try: return int(name.lstrip('[').rstrip(']')) except: return -1 def get_child_at_index(self, index): if index < 0 or index >= self.size: return None offset = index * self.data.GetType().GetPointeeType().GetByteSize() return self.data.CreateChildAtOffset(f'[{index}]', offset, self.data.GetType().GetPointeeType()) def update(self): self.data = self.valobj.GetChildMemberWithName('_data') self.size = self.valobj.GetChildMemberWithName('arraySize').GetValueAsUnsigned(0) def has_children(self): return True def Vector_SummaryProvider(valobj, internal_dict): # Get the template parameters to determine vector length type_name = valobj.GetTypeName() # Extract components x = valobj.GetChildMemberWithName('x').GetValue() y = valobj.GetChildMemberWithName('y').GetValue() # Check if z and w exist z_child = valobj.GetChildMemberWithName('z') w_child = valobj.GetChildMemberWithName('w') comps = [x, y] if z_child.IsValid(): comps.append(z_child.GetValue()) if w_child.IsValid(): comps.append(w_child.GetValue()) return "(" + ", ".join(comps) + ")" def __lldb_init_module(debugger, internal_dict): # Register Array formatter debugger.HandleCommand('type summary add -F Seele_lldb.Array_SummaryProvider -x "^Seele::Array<.*>$"') debugger.HandleCommand('type synthetic add -l Seele_lldb.ArraySyntheticProvider -x "^Seele::Array<.*>$"') # Register Vector formatter debugger.HandleCommand('type summary add -F Seele_lldb.Vector_SummaryProvider -x "^glm::(detail::)?t?vec[234]?<.*>$"') print("Seele LLDB formatters loaded")