This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Unconditionally increment depth when printing children
ClosedPublic

Authored by augusto2112 on Jun 1 2023, 5:04 PM.

Details

Summary

The target.max-children-depth setting and --depth flag would be
ignored if treating pointer as arrays, fix that by always incrementing
the current depth when printing a new child.

Diff Detail

Event Timeline

augusto2112 created this revision.Jun 1 2023, 5:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 5:04 PM
augusto2112 requested review of this revision.Jun 1 2023, 5:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 5:04 PM

Is ity possible to test this with a nested C++ type?

+1 to a test

thanks for the fix!

lldb/source/DataFormatters/ValueObjectPrinter.cpp
593

seems this is now used with m_omit_summary_depth, maybe name it consumed_summary_depth?

kastiglione accepted this revision.Jun 7 2023, 4:53 PM

thanks!

This revision is now accepted and ready to land.Jun 7 2023, 4:53 PM
aprantl accepted this revision.Jun 8 2023, 8:31 AM
aprantl added inline comments.
lldb/source/DataFormatters/ValueObjectPrinter.cpp
610

I would probably factor out:

if (does_consume_ptr_depth)
   --curr_ptr_depth;
lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/main.cpp
15 ↗(On Diff #529463)

Setting a breakpoint on the return is risky because there may not be any code associated with it. Something like

int puts(const char *s);

puts("break here");

is safer.

augusto2112 marked an inline comment as done.

Addressed comments