[Lldb-commits] [lldb] r361064 - [CommandInterpreter] Fix trailing blanks after `all` or [0-9]+ for bt

Stella Stamenova via lldb-commits lldb-commits at lists.llvm.org
Fri May 17 11:52:42 PDT 2019


Author: stella.stamenova
Date: Fri May 17 11:52:42 2019
New Revision: 361064

URL: http://llvm.org/viewvc/llvm-project?rev=361064&view=rev
Log:
[CommandInterpreter] Fix trailing blanks after `all` or [0-9]+ for bt

The change that was committed for this used \\s to match spaces which does not work correctly on all platforms. Using [:space:] makes the test pass on both Linux and Windows

Modified:
    lldb/trunk/lit/Commands/command-backtrace.test
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/lit/Commands/command-backtrace.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/command-backtrace.test?rev=361064&r1=361063&r2=361064&view=diff
==============================================================================
--- lldb/trunk/lit/Commands/command-backtrace.test (original)
+++ lldb/trunk/lit/Commands/command-backtrace.test Fri May 17 11:52:42 2019
@@ -7,6 +7,6 @@ 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.
+# Blank characters after the 'all' are important, as we're testing the parser.
 bt all       
 # CHECK: error: invalid target

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=361064&r1=361063&r2=361064&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri May 17 11:52:42 2019
@@ -758,12 +758,12 @@ void CommandInterpreter::LoadCommandDict
     // 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:]]+)\\s*$",
+    if (bt_regex_cmd_up->AddRegexCommand("^([[:digit:]]+)[[:space:]]*$",
                                          "thread backtrace -c %1") &&
-        bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)\\s*$",
+        bt_regex_cmd_up->AddRegexCommand("^-c ([[:digit:]]+)[[:space:]]*$",
                                          "thread backtrace -c %1") &&
-        bt_regex_cmd_up->AddRegexCommand("^all\\s*$", "thread backtrace all") &&
-        bt_regex_cmd_up->AddRegexCommand("^\\s*$", "thread backtrace")) {
+        bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread backtrace all") &&
+        bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread backtrace")) {
       CommandObjectSP command_sp(bt_regex_cmd_up.release());
       m_command_dict[command_sp->GetCommandName()] = command_sp;
     }




More information about the lldb-commits mailing list