Skip to content

Commit 8762dfa

Browse files
authored
Merge pull request #666 from JDevlieghere/🍒/223a209027b44daeac53508bea154bc29314bddb
[lldb/Commands] Make column available through _regexp-break
2 parents 62affab + d04cc50 commit 8762dfa

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# UNSUPPORTED: system-windows
22
#
33
# RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
4-
# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s
5-
# CHECK: -u <column> ( --column <column> )
6-
# CHECK: Specifies the column number on which to set this breakpoint.
4+
# 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
5+
# RUN: %lldb -b -o 'help _regexp-break' -o 'b main.c:2:21' %t.out | FileCheck %s --check-prefix HELP-REGEX --check-prefix CHECK
6+
# HELP: -u <column> ( --column <column> )
7+
# HELP: Specifies the column number on which to set this breakpoint.
8+
# HELP-REGEX: _regexp-break <filename>:<linenum>:<colnum>
9+
# HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c
710
# CHECK: at main.c:2:21

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,10 @@ void CommandInterpreter::LoadCommandDictionary() {
486486
m_command_dict["language"] =
487487
CommandObjectSP(new CommandObjectLanguage(*this));
488488

489+
// clang-format off
489490
const char *break_regexes[][2] = {
491+
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
492+
"breakpoint set --file '%1' --line %2 --column %3"},
490493
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
491494
"breakpoint set --file '%1' --line %2"},
492495
{"^/([^/]+)/$", "breakpoint set --source-pattern-regexp '%1'"},
@@ -501,6 +504,7 @@ void CommandInterpreter::LoadCommandDictionary() {
501504
"breakpoint set --name '%1' --skip-prologue=0"},
502505
{"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
503506
"breakpoint set --name '%1'"}};
507+
// clang-format on
504508

505509
size_t num_regexes = llvm::array_lengthof(break_regexes);
506510

@@ -509,6 +513,9 @@ void CommandInterpreter::LoadCommandDictionary() {
509513
*this, "_regexp-break",
510514
"Set a breakpoint using one of several shorthand formats.",
511515
"\n"
516+
"_regexp-break <filename>:<linenum>:<colnum>\n"
517+
" main.c:12:21 // Break at line 12 and column "
518+
"21 of main.c\n\n"
512519
"_regexp-break <filename>:<linenum>\n"
513520
" main.c:12 // Break at line 12 of "
514521
"main.c\n\n"
@@ -532,7 +539,7 @@ void CommandInterpreter::LoadCommandDictionary() {
532539
"current file\n"
533540
" // containing text 'break "
534541
"here'.\n",
535-
2,
542+
3,
536543
CommandCompletions::eSymbolCompletion |
537544
CommandCompletions::eSourceFileCompletion,
538545
false));
@@ -559,6 +566,9 @@ void CommandInterpreter::LoadCommandDictionary() {
559566
*this, "_regexp-tbreak",
560567
"Set a one-shot breakpoint using one of several shorthand formats.",
561568
"\n"
569+
"_regexp-break <filename>:<linenum>:<colnum>\n"
570+
" main.c:12:21 // Break at line 12 and column "
571+
"21 of main.c\n\n"
562572
"_regexp-break <filename>:<linenum>\n"
563573
" main.c:12 // Break at line 12 of "
564574
"main.c\n\n"

0 commit comments

Comments
 (0)