<div dir="ltr">Or is the concern here that the curr_ptr_depth isn't getting incremented yet we go and show children for it?<div><br></div><div>If so, why have the check for is_ref in this:</div><div><br></div><div>else if (is_ref && m_curr_depth == 0 && curr_ptr_depth == 0)</div>
<div>{</div><div>    curr_ptr_depth = 1;</div><div>}</div><div><br></div><div>My issue would probably be fixed by removing the check for is_ref there as well.</div><div><br></div><div> - Bruce</div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Jun 23, 2014 at 7:10 AM, Bruce Mitchener <span dir="ltr"><<a href="mailto:bruce.mitchener@gmail.com" target="_blank">bruce.mitchener@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Sun, Jun 22, 2014 at 11:29 PM, Enrico Granata <span dir="ltr"><<a href="mailto:egranata@apple.com" target="_blank">egranata@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Bruce,<br>
your patch seems to essentially implement the algorithm "display children of pointer types if within the pointer depth OR there is a formatter that wants them shown"<br>
<br>
That's somewhat worrisome. The reason for having a pointer depth is that pointers potentially introduce recursion - i.e. you can have a pointer that points to itself. Limiting how deep you look into pointer values has the benefit that lldb will not hang in such situations trying to display an i infinitely recursive structure - which is especially useful if the infinite recursion was accidental and unexpected.<br>

</blockquote><div><br></div></div><div>That isn't the case with my patch as I understand things.</div><div><br></div><div>Looking at the code, but stripped of comments:</div><div><br></div><div>bool</div><div>ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description,</div>

<div>                                         uint32_t& curr_ptr_depth)</div><div>{</div><div>    const bool is_ref = IsRef ();</div><div>    const bool is_ptr = IsPtr ();</div><div><br></div><div>    if (is_failed_description || m_curr_depth < options.m_max_depth)</div>

<div>    {</div><div>        bool print_children = false;</div><div>        if (is_ptr || is_ref)<br></div><div>        {</div><div>            AddressType ptr_address_type;<br></div><div>            if (m_valobj->GetPointerValue (&ptr_address_type) == 0)</div>

<div>                return false;</div><div><br></div><div>            else if (is_ref && m_curr_depth == 0 && curr_ptr_depth == 0)</div><div>            {</div><div>                curr_ptr_depth = 1;<br>

</div><div>            }</div><div><br></div><div>            print_children = (curr_ptr_depth > 0);</div><div>        }</div><div><br></div><div>        TypeSummaryImpl* entry = GetSummaryFormatter();</div><div><br></div>

<div>        return (print_children || !entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty());</div><div>    }</div><div>    return false;</div><div>} </div><div><br></div><div>You can see that my change is squarely within the depth check, so it won't allow infinite recursion.  If m_curr_depth >= options.m_max_depth, it will still return false.</div>

<div><br></div><div>The only situation where my patch actually changes things with regards to pointer depth is that now, a pointer at depth 0 will result in checking the summary formatter.</div><span class="HOEnZb"><font color="#888888"><div>
<br></div><div> - Bruce</div>
<div><br></div></font></span></div></div></div>
</blockquote></div><br></div>