summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/lit/Commands/command-backtrace.test12
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp8
2 files changed, 16 insertions, 4 deletions
diff --git a/lldb/lit/Commands/command-backtrace.test b/lldb/lit/Commands/command-backtrace.test
new file mode 100644
index 00000000000..85cd3c81966
--- /dev/null
+++ b/lldb/lit/Commands/command-backtrace.test
@@ -0,0 +1,12 @@
+# Check basic functionality of command bt.
+# RUN: %lldb -s %s 2>&1 | FileCheck %s
+
+# Make sure this is not rejected by the parser as invalid syntax.
+# Blank characters after the '1' are important, as we're testing the parser.
+bt 1
+# CHECK: error: invalid target
+
+# Make sure this is not rejected by the parser as invalid syntax.
+# Blank characters after the '1' are important, as we're testing the parser.
+bt all
+# CHECK: error: invalid target
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index df583bc72dc..4a132622faa 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -758,12 +758,12 @@ void CommandInterpreter::LoadCommandDictionary() {
// command if you wanted to backtrace three frames you would do "bt -c 3"
// but the intention is to have this emulate the gdb "bt" command and so
// now "bt 3" is the preferred form, in line with gdb.
- if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)$",
+ if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)\\s*$",
"thread backtrace -c %1") &&
- bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)$",
+ bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)\\s*$",
"thread backtrace -c %1") &&
- bt_regex_cmd_up->AddRegexCommand("^all$", "thread backtrace all") &&
- bt_regex_cmd_up->AddRegexCommand("^$", "thread backtrace")) {
+ bt_regex_cmd_up->AddRegexCommand("^all\\s*$", "thread backtrace all") &&
+ bt_regex_cmd_up->AddRegexCommand("^\\s*$", "thread backtrace")) {
CommandObjectSP command_sp(bt_regex_cmd_up.release());
m_command_dict[command_sp->GetCommandName()] = command_sp;
}
OpenPOWER on IntegriCloud