<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I would like to write a data formatter for LLDB, for a class which is very close to std::array. Here it is:</div><div class=""><br class=""></div><div class="">template <typename T, int n></div><div class="">class StaticArray {</div><div class=""> private:</div><div class=""> T data_[n];</div><div class="">}</div><div class=""><br class=""></div><div class="">I wrote the following data formatter adapted from my own “std::vector” data formatter but I still have blanks to fill :</div><div class=""><br class=""></div><div class="">class StaticArrayProvider:<br class=""> def __init__(self, valobj, internal_dict):<br class=""> self.valobj = valobj<br class=""> self.data = self.valobj.GetChildMemberWithName('data_').GetChildAtIndex(0)<br class=""> self.data_type = self.data.GetType()<br class=""> self.type_size = self.data_type.GetByteSize()<br class=""> self.size = #???<br class=""><br class=""> def num_children(self):<br class=""> return self.size<br class=""><br class=""> def get_child_index(self, name):<br class=""> try:<br class=""> return int(name.lstrip('[').rstrip(']'))<br class=""> except:<br class=""> return -1<br class=""><br class=""> def get_child_at_index(self, index):<br class=""> if index < 0:<br class=""> return None<br class=""> if index >= self.num_children():<br class=""> return None<br class=""> try:<br class=""> return #???<br class=""> except:<br class=""> return None</div><div class=""><br class=""></div><div class="">Could you please give me a hand to fill those blanks?</div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">François Fayard<br class=""><b class="">Founder & Consultant</b> - +33 (0)6 01 44 06 93<br class=""><b class="">Inside Loop</b> - Scaling up Computational Science<br class=""><b class="">Paris</b> - 38 rue Desbordes-Valmore, 75116 Paris<br class=""><b class="">Lyon/Grenoble</b> - 34 route de Four, 38090 Vaulx-Milieu</div></div></div></div></div></div></div></div></div></div></div></div>
</div>
<br class=""></div></body></html>