aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Commands/CommandObjectDWIMPrint.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp3
-rw-r--r--lldb/test/Shell/Settings/TestChildCountTruncation.test67
3 files changed, 72 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index a110eec..a2c004d 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -150,6 +150,8 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
return;
}
}
+ m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
+ m_cmd_name);
result.SetStatus(eReturnStatusSuccessFinishResult);
};
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index a95dea6..c5b9167 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -470,6 +470,9 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
return false;
}
+ m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
+ m_cmd_name);
+
if (suppress_result)
if (auto result_var_sp =
target.GetPersistentVariable(result_valobj_sp->GetName())) {
diff --git a/lldb/test/Shell/Settings/TestChildCountTruncation.test b/lldb/test/Shell/Settings/TestChildCountTruncation.test
new file mode 100644
index 0000000..3b75498
--- /dev/null
+++ b/lldb/test/Shell/Settings/TestChildCountTruncation.test
@@ -0,0 +1,67 @@
+# Test that we warn the user about truncated output
+# when target.max-children-count wasn't explicitly set.
+
+# RUN: split-file %s %t
+# RUN: %clang_host -g -gdwarf %t/main.cpp -o %t.out
+# RUN: %lldb -x -b -s %t/dwim-commands.input %t.out -o exit 2>&1 \
+# RUN: | FileCheck %s --check-prefix=DWIM
+#
+# RUN: %lldb -x -b -s %t/expr-commands.input %t.out -o exit 2>&1 \
+# RUN: | FileCheck %s --check-prefix=EXPR
+#
+# RUN: %lldb -x -b -s %t/frame-var-commands.input %t.out -o exit 2>&1 \
+# RUN: | FileCheck %s --check-prefix=VAR
+#
+# RUN: %lldb -x -b -s %t/with-setting-commands.input %t.out -o exit 2>&1 \
+# RUN: | FileCheck %s --check-prefix=SETTING
+
+#--- main.cpp
+
+int main() {
+ int arr[512] = { 3 };
+ __builtin_debugtrap();
+}
+
+#--- dwim-commands.input
+
+run
+dwim-print arr
+frame variable arr
+
+DWIM: (lldb) dwim-print arr
+DWIM: *** Some of the displayed variables have more members
+DWIM-SAME: use the --show-all-children option to dwim-print
+DWIM: (lldb) frame variable arr
+DWIM-NOT: *** Some of the displayed variables have more members
+
+#--- expr-commands.input
+
+run
+expression arr
+frame variable arr
+
+EXPR: (lldb) expression arr
+EXPR: *** Some of the displayed variables have more members
+EXPR-SAME: use the --show-all-children option to expression
+EXPR: (lldb) frame variable arr
+EXPR-NOT: *** Some of the displayed variables have more members
+
+#--- frame-var-commands.input
+
+run
+frame variable arr
+
+VAR: (lldb) frame variable arr
+VAR: *** Some of the displayed variables have more members
+VAR-SAME: use the --show-all-children option to frame variable
+VAR: (lldb) frame variable arr
+VAR-NOT: *** Some of the displayed variables have more members
+
+#--- with-setting-commands.input
+
+run
+settings set target.max-children-count 1
+frame variable arr
+
+SETTING: (lldb) frame variable arr
+SETTING-NOT: *** Some of the displayed variables have more members