[Lldb-commits] [PATCH] D73314: [lldb/Commands] Make column available through _regexp-break

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 23 17:01:15 PST 2020


JDevlieghere created this revision.
JDevlieghere added a reviewer: jingham.
Herald added a subscriber: teemperor.
Herald added a project: LLDB.

Update `_regexp-break` to interpret `main.c:8:21` as `breakpoint set --line 8 --column 21`.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D73314

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/Shell/Commands/command-breakpoint-col.test


Index: lldb/test/Shell/Commands/command-breakpoint-col.test
===================================================================
--- lldb/test/Shell/Commands/command-breakpoint-col.test
+++ lldb/test/Shell/Commands/command-breakpoint-col.test
@@ -1,7 +1,10 @@
 # UNSUPPORTED: system-windows
 #
 # RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
-# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s
-# CHECK: -u <column> ( --column <column> )
-# CHECK: Specifies the column number on which to set this breakpoint.
+# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s --check-prefix HELP --check-prefix CHECK
+# RUN: %lldb -b -o 'help _regexp-break' -o 'b main.c:2:21' %t.out | FileCheck %s --check-prefix HELP-REGEX --check-prefix CHECK
+# HELP: -u <column> ( --column <column> )
+# HELP: Specifies the column number on which to set this breakpoint.
+# HELP-REGEX: _regexp-break <filename>:<linenum>:<colnum>
+# HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c
 # CHECK: at main.c:2:21
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -500,7 +500,10 @@
   m_command_dict["language"] =
       CommandObjectSP(new CommandObjectLanguage(*this));
 
+  // clang-format off
   const char *break_regexes[][2] = {
+      {"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
+       "breakpoint set --file '%1' --line %2 --column %3"},
       {"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
        "breakpoint set --file '%1' --line %2"},
       {"^/([^/]+)/$", "breakpoint set --source-pattern-regexp '%1'"},
@@ -515,6 +518,7 @@
        "breakpoint set --name '%1' --skip-prologue=0"},
       {"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
        "breakpoint set --name '%1'"}};
+  // clang-format on
 
   size_t num_regexes = llvm::array_lengthof(break_regexes);
 
@@ -523,6 +527,9 @@
           *this, "_regexp-break",
           "Set a breakpoint using one of several shorthand formats.",
           "\n"
+          "_regexp-break <filename>:<linenum>:<colnum>\n"
+          "              main.c:12:21          // Break at line 12 and column "
+          "21 of main.c\n\n"
           "_regexp-break <filename>:<linenum>\n"
           "              main.c:12             // Break at line 12 of "
           "main.c\n\n"
@@ -546,7 +553,7 @@
           "current file\n"
           "                                    // containing text 'break "
           "here'.\n",
-          2,
+          3,
           CommandCompletions::eSymbolCompletion |
               CommandCompletions::eSourceFileCompletion,
           false));
@@ -573,6 +580,9 @@
           *this, "_regexp-tbreak",
           "Set a one-shot breakpoint using one of several shorthand formats.",
           "\n"
+          "_regexp-break <filename>:<linenum>:<colnum>\n"
+          "              main.c:12:21          // Break at line 12 and column "
+          "21 of main.c\n\n"
           "_regexp-break <filename>:<linenum>\n"
           "              main.c:12             // Break at line 12 of "
           "main.c\n\n"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73314.240063.patch
Type: text/x-patch
Size: 3386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200124/e156c785/attachment.bin>


More information about the lldb-commits mailing list