• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import lldb
2
3
4class FooSyntheticProvider:
5
6    def __init__(self, valobj, dict):
7        self.valobj = valobj
8        self.update()
9
10    def update(self):
11        self.adjust_for_architecture()
12
13    def num_children(self):
14        return 1
15
16    def get_child_at_index(self, index):
17        if index != 0:
18            return None
19        return self.i_ptr.Dereference()
20
21    def get_child_index(self, name):
22        if name == "*i_ptr":
23            return 0
24        return None
25
26    def adjust_for_architecture(self):
27        self.lp64 = (
28            self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8)
29        self.is_little = (self.valobj.GetTarget().GetProcess(
30        ).GetByteOrder() == lldb.eByteOrderLittle)
31        self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize()
32        self.bar = self.valobj.GetChildMemberWithName('b')
33        self.i_ptr = self.bar.GetChildMemberWithName('i_ptr')
34