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