【发布时间】:2017-10-02 14:32:15
【问题描述】:
我想为我自己的对象编写一个 LLDB 数据格式化程序,如下所示:
template <typename T, int n>
class StaticArray {
T data_[n];
}
这是我的合成数据格式化程序到目前为止的样子:
class StaticArrayProvider:
def __init__(self, valobj, internal_dict):
self.valobj = valobj
self.data = self.valobj.GetChildMemberWithName('data_').GetChildAtIndex(0)
self.data_type = self.data.GetType()
self.type_size = self.data_type.GetByteSize()
self.size = # ???
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:
return None
if index >= self.num_children():
return None
try:
offset = index * self.type_size
return # ???
except:
return None
我不知道该怎么做才能填补空白# ???。你有什么解决办法吗?
【问题讨论】:
标签: c++ lldb pretty-print