<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 7, 2020, at 5:29 PM, Greg Clayton <<a href="mailto:clayborg@gmail.com" class="">clayborg@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="Apple-interchange-newline"><br class=""><blockquote type="cite" class=""><div class="">On Oct 7, 2020, at 12:16 PM, Jim Ingham via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class="" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><blockquote type="cite" class="" style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">On Oct 7, 2020, at 12:11 PM, Pavel Labath <<a href="mailto:pavel@labath.sk" class="">pavel@labath.sk</a>> wrote:<br class=""><br class="">On 07/10/2020 21:01, Jim Ingham wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Oct 7, 2020, at 11:44 AM, Pavel Labath <<a href="mailto:pavel@labath.sk" class="">pavel@labath.sk</a><span class="Apple-converted-space"> </span><<a href="mailto:pavel@labath.sk" class="">mailto:pavel@labath.sk</a>>> wrote:<br class=""><br class="">On 07/10/2020 20:42, Jim Ingham via lldb-dev wrote:<br class=""><blockquote type="cite" class="">There isn’t a built-in summary formatter for two dimensional arrays of chars, but the type is matching the regex for the one-dimensional StringSummaryFormat, but that doesn’t actually know how to format two dimensional arrays of chars.  The type regex for StringSummaryFormat:<br class="">char [[0-9]+]<br class="">We should refine this regex so it doesn’t catch up two dimensional strings.  We could also write a formatter for two-dimensional strings.<br class=""></blockquote><br class="">Do we need a special formatter for two-dimensional strings? What about 3D?<br class=""><br class="">I'd hope that this could be handled by a combination of the simple string formatter and the generic array dumping code...<br class=""></blockquote>That works as expected, for instance if you do:<br class="">(lldb) frame var z.i<br class="">(char [2][4]) z.i = {<br class=""> [0] = "FOO"<br class=""> [1] = "BAR"<br class="">}<br class="">The thing that isn’t working is when the array doesn’t get auto-expanded by lldb, then you see the summary instead,<br class=""></blockquote><br class="">Ah, interesting. I didn't realize that.<br class=""><br class=""><blockquote type="cite" class="">which is what you are seeing with:<br class="">(lldb) frame var z<br class="">(b) z = (i = char [2][4] @ 0x00007ffeefbff5f0)<br class="">You can fix this either by having a summary string for char [][] or by telling lldb to expand more pointer like children for you:<br class="">(lldb) frame var -P2 z<br class="">(b) z = {<br class=""> i = {<br class="">   [0] = "FOO"<br class="">   [1] = "BAR"<br class=""> }<br class="">}<br class="">I’m hesitant to up the default pointer depth, I have gotten lots of complaints already about lldb disclosing too many subfields when printing structures.<br class=""></blockquote><br class="">Yeah, I don't think we'd want to increase that.<br class=""><br class=""><blockquote type="cite" class="">We could also try to be smarter about what constitutes a “pointer” so the arrays don’t count against the pointer depth? Not sure how workable that would be.<br class=""></blockquote><br class="">This sounds workable. I mean, an array struct member is not really a pointer (it only decays to a pointer) and does not suffer from the issues that pointers do -- infinite recursion with recursive data structures, etc.<br class=""></blockquote><br class="" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span class="" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">In any case we should not have the simple string formatter trying to format these arrays, which it clearly doesn’t know how to do.</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div></blockquote></div><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">Should be easy to modify the regex to:</div><div class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span class="" style="background-color: rgb(255, 255, 255);">^char \[[0-9]+\]$</span></div></div></blockquote><br class=""></div><div>I don’t think you want the ^ or this wouldn’t match “const char [5]”.  I wasn’t sure there were any post-decorators we might care about, but I can’t think of any.</div><div><br class=""></div><div>Jim</div><div><br class=""></div><br class=""></body></html>