From e6fb64d26717ec66e375579927a25d426b41c762 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Wed, 14 May 2025 10:22:47 -0700 Subject: [PATCH 1/3] [lldb] Reduce max-children-depth default for readability Decrease `target.max-children-depth` from 6 to 4. Often the value of 6 produces too much output, particularly with Swift data where, unlike ObjC, classes are not treated as pointers and thus are traversed just like structs. For a hypothetical recursive struct with just two members/properties, a depth of 6 results in 63 (2^6-1) child values printed. In practice, data types commonly have more than two fields, and so hundred of child values can be printed. An output of only 63 would be closer to a best case scenario. This doesn't factor in lldb's data output syntax, which adds additional non-data lines to the output. When all children must be shown, frame variable and expression both support the -A (--show-all-children) flag. rdar://145327522 --- lldb/source/Target/TargetProperties.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td index d4ad0996745f3..79f9b7c356456 100644 --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -123,7 +123,7 @@ let Definition = "target" in { DefaultUnsignedValue<256>, Desc<"Maximum number of children to expand in any level of depth.">; def MaxChildrenDepth: Property<"max-children-depth", "UInt64">, - DefaultUnsignedValue<6>, + DefaultUnsignedValue<4>, Desc<"Maximum depth to expand children.">; def MaxSummaryLength: Property<"max-string-summary-length", "UInt64">, DefaultUnsignedValue<1024>, From a3898edf9711bf113076923c68f2f5cfc2caec6f Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Wed, 14 May 2025 15:00:28 -0700 Subject: [PATCH 2/3] Fix tests for max-children-depth --- .../data-formatter-advanced/TestDataFormatterAdv.py | 4 ++-- .../nsdictionarysynth/TestNSDictionarySynthetic.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py index 589e38087a3f2..c5ee21571dc20 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py @@ -357,13 +357,13 @@ def cleanup(): self.runCmd("type format delete int") # First, check the following: - # 1. Verify the default max-children-depth (6) is applied + # 1. Verify the default max-children-depth (4) is applied # 2. Ensure the one-time warning is printed warning = "*** Some of the displayed variables have a greater depth" self.expect( "frame variable quite_nested", matching=True, - substrs=["six ={...}", warning], + substrs=["four ={...}", warning], ) self.expect( "frame variable quite_nested", diff --git a/lldb/test/API/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py b/lldb/test/API/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py index 9ac41d67eb9ab..72e25f0feb10f 100644 --- a/lldb/test/API/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py +++ b/lldb/test/API/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py @@ -120,6 +120,8 @@ def cleanup(): '@"2 elements"', ], ) + + self.runCmd("settings set target.max-children-depth 6") self.expect( "frame variable mutabledict --ptr-depth 3", substrs=[ From 9eda2f989e8bbd309f19bbc2d408ea8e41e9a52f Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Tue, 27 May 2025 11:29:11 -0700 Subject: [PATCH 3/3] Fix test/Shell/SymbolFile/PDB/udt-layout.test --- lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script index 91de55f4ade4a..b893ab9410915 100644 --- a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script +++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script @@ -1,3 +1,4 @@ +settings set target.max-children-depth 6 breakpoint set --file UdtLayoutTest.cpp --line 60 run target variable