Skip to content

Commit 1e7ec35

Browse files
authored
[lldb] Adjust default target.max-children-depth (#149282)
Deeply nested structs can be noisy, so Apple's LLDB fork sets the default to `4`: https://github.com/swiftlang/llvm-project/blob/9c93adbb283005ab416fd155b75fd43e6a8288ca/lldb/source/Target/TargetProperties.td#L134-L136 Thought it would be useful to upstream this. Though happy to pick a different default or keep it as-is.
1 parent b0c6148 commit 1e7ec35

File tree

3 files changed

+86
-1
lines changed

3 files changed

+86
-1
lines changed

lldb/source/Target/TargetProperties.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ let Definition = "target" in {
9999
DefaultUnsignedValue<24>,
100100
Desc<"Maximum number of children to expand in any level of depth.">;
101101
def MaxChildrenDepth: Property<"max-children-depth", "UInt64">,
102-
DefaultUnsignedValue<0xFFFFFFFF>,
102+
DefaultUnsignedValue<4>,
103103
Desc<"Maximum depth to expand children.">;
104104
def MaxSummaryLength: Property<"max-string-summary-length", "UInt64">,
105105
DefaultUnsignedValue<1024>,
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Test that we warn the user about truncated output
2+
# when target.max-children-depth wasn't explicitly set.
3+
4+
# RUN: split-file %s %t
5+
# RUN: %clang_host -g -gdwarf %t/main.cpp -o %t.out
6+
# RUN: %lldb -x -b -s %t/dwim-commands.input %t.out -o exit 2>&1 \
7+
# RUN: | FileCheck %s --check-prefix=DWIM
8+
#
9+
# RUN: %lldb -x -b -s %t/expr-commands.input %t.out -o exit 2>&1 \
10+
# RUN: | FileCheck %s --check-prefix=EXPR
11+
#
12+
# RUN: %lldb -x -b -s %t/frame-var-commands.input %t.out -o exit 2>&1 \
13+
# RUN: | FileCheck %s --check-prefix=VAR
14+
#
15+
# RUN: %lldb -x -b -s %t/with-setting-commands.input %t.out -o exit 2>&1 \
16+
# RUN: | FileCheck %s --check-prefix=SETTING
17+
18+
#--- main.cpp
19+
20+
struct L1 {
21+
int w;
22+
struct L2 {
23+
int x;
24+
struct L3 {
25+
int y;
26+
struct L4 {
27+
int z;
28+
struct L5 {
29+
int a;
30+
} l5;
31+
} l4;
32+
} l3;
33+
} l2;
34+
};
35+
36+
int main() {
37+
L1 nested;
38+
__builtin_debugtrap();
39+
}
40+
41+
#--- dwim-commands.input
42+
43+
run
44+
dwim-print nested
45+
frame variable nested
46+
47+
DWIM: (lldb) dwim-print nested
48+
DWIM: *** Some of the displayed variables have a greater depth of members
49+
DWIM-SAME: use the --depth option to dwim-print
50+
DWIM: (lldb) frame variable nested
51+
DWIM-NOT: *** Some of the displayed variables have a greater depth of members
52+
53+
#--- expr-commands.input
54+
55+
run
56+
expression nested
57+
frame variable nested
58+
59+
EXPR: (lldb) expression nested
60+
EXPR: *** Some of the displayed variables have a greater depth of members
61+
EXPR-SAME: use the --depth option to expression
62+
EXPR: (lldb) frame variable nested
63+
EXPR-NOT: *** Some of the displayed variables have a greater depth of members
64+
65+
#--- frame-var-commands.input
66+
67+
run
68+
frame variable nested
69+
frame variable nested
70+
71+
VAR: (lldb) frame variable nested
72+
VAR: *** Some of the displayed variables have a greater depth of members
73+
VAR-SAME: use the --depth option to frame variable
74+
VAR: (lldb) frame variable nested
75+
VAR-NOT: *** Some of the displayed variables have a greater depth of members
76+
77+
#--- with-setting-commands.input
78+
79+
run
80+
settings set target.max-children-depth 1
81+
frame variable nested
82+
83+
SETTING: (lldb) frame variable nested
84+
SETTING-NOT: *** Some of the displayed variables have a greater depth of members

lldb/test/Shell/SymbolFile/NativePDB/Inputs/class_layout.lldbinit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
settings set target.max-children-depth 10
12
expr a
23
expr b.c
34
expr b.u.c

0 commit comments

Comments
 (0)