[lldb] Add setting for max depth of value object printing (NFC)
This adds a setting (`target.max-children-depth`) that will provide a default value for the `--depth` flag used by `expression` and `frame variable`. The new setting uses the same default that's currently fixed in source: `UINT32_MAX`. This provides two purposes: 1. Allowing downstream forks to provide a customized default. 2. Allowing users to set their own default. Following `target.max-children-count`, a warning is emitted when the max depth is reached. The warning lets users know which flags or settings they can customize. This warning is shown only when the limit is the default value. rdar://87466495 Differential Revision: https://reviews.llvm.org/D123954
This commit is contained in:
@@ -500,7 +500,7 @@ bool ValueObjectPrinter::ShouldPrintChildren(
|
||||
if (m_options.m_use_objc)
|
||||
return false;
|
||||
|
||||
if (is_failed_description || m_curr_depth < m_options.m_max_depth) {
|
||||
if (is_failed_description || !HasReachedMaximumDepth()) {
|
||||
// We will show children for all concrete types. We won't show pointer
|
||||
// contents unless a pointer depth has been specified. We won't reference
|
||||
// contents unless the reference is the root object (depth of zero).
|
||||
@@ -786,9 +786,22 @@ void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
|
||||
m_stream->EOL();
|
||||
} else
|
||||
PrintChildren(value_printed, summary_printed, curr_ptr_depth);
|
||||
} else if (m_curr_depth >= m_options.m_max_depth && IsAggregate() &&
|
||||
} else if (HasReachedMaximumDepth() && IsAggregate() &&
|
||||
ShouldPrintValueObject()) {
|
||||
m_stream->PutCString("{...}\n");
|
||||
// The maximum child depth has been reached. If `m_max_depth` is the default
|
||||
// (i.e. the user has _not_ customized it), then lldb presents a warning to
|
||||
// the user. The warning tells the user that the limit has been reached, but
|
||||
// more importantly tells them how to expand the limit if desired.
|
||||
if (m_options.m_max_depth_is_default)
|
||||
m_valobj->GetTargetSP()
|
||||
->GetDebugger()
|
||||
.GetCommandInterpreter()
|
||||
.SetReachedMaximumDepth();
|
||||
} else
|
||||
m_stream->EOL();
|
||||
}
|
||||
|
||||
bool ValueObjectPrinter::HasReachedMaximumDepth() {
|
||||
return m_curr_depth >= m_options.m_max_depth;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user