brintos

brintos / llvm-project-archived public Read only

0
0
Text · 932 B · c8fb4a1 Raw
33 lines · python
1import lldb2 3 4class FooSyntheticProvider:5    def __init__(self, valobj, dict):6        self.valobj = valobj7        self.update()8 9    def update(self):10        self.adjust_for_architecture()11 12    def num_children(self):13        return 114 15    def get_child_at_index(self, index):16        if index != 0:17            return None18        return self.i_ptr.Dereference()19 20    def get_child_index(self, name):21        if name == "*i_ptr":22            return 023        return None24 25    def adjust_for_architecture(self):26        self.lp64 = self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 827        self.is_little = (28            self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle29        )30        self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize()31        self.bar = self.valobj.GetChildMemberWithName("b")32        self.i_ptr = self.bar.GetChildMemberWithName("i_ptr")33