4 class PythonObjectSyntheticChildProvider(object):
5 def __init__(self
, value
, internal_dict
):
7 self
.values
= self
.make_children()
9 self
.bo
= self
.value
.target
.byte_order
10 self
.ps
= self
.value
.target
.addr_size
12 def make_children(self
):
15 def num_children(self
):
16 return len(self
.values
)
18 def get_child_index(self
, name
):
20 for N
, value
in self
.values
:
29 def has_children(self
):
30 return len(self
.values
) > 0
32 def gen_child(self
, name
, value
):
35 if isinstance(value
, int):
36 data
= lldb
.SBData
.CreateDataFromUInt64Array(self
.bo
, self
.ps
, [value
])
37 type = self
.value
.target
.GetBasicType(lldb
.eBasicTypeLong
)
38 elif isinstance(value
, float):
39 data
= lldb
.SBData
.CreateDataFromDoubleArray(self
.bo
, self
.ps
, [value
])
40 type = self
.value
.target
.GetBasicType(lldb
.eBasicTypeDouble
)
41 elif isinstance(value
, str):
42 data
= lldb
.SBData
.CreateDataFromCString(self
.bo
, self
.ps
, value
)
43 type = self
.value
.target
.GetBasicType(lldb
.eBasicTypeChar
).GetArrayType(
46 if (data
is not None) and (type is not None):
47 return self
.value
.CreateValueFromData(name
, data
, type)
50 def get_child_at_index(self
, index
):
51 if index
in self
.built_values
:
52 return self
.built_values
[index
]
56 name
, value
= self
.values
[index
]
57 bv
= self
.gen_child(name
, value
)
58 self
.built_values
[index
] = bv