Skip to content

Commit 223a209

Browse files
committed
[lldb/Commands] Make column available through _regexp-break
Update _regexp-break to interpret main.c:8:21 as: breakpoint set --line 8 --column 21 Differential revision: https://reviews.llvm.org/D73314
1 parent 94ec56b commit 223a209

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

lldb/source/Interpreter/CommandInterpreter.cpp

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

503+
// clang-format off
503504
const char *break_regexes[][2] = {
505+
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
506+
"breakpoint set --file '%1' --line %2 --column %3"},
504507
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
505508
"breakpoint set --file '%1' --line %2"},
506509
{"^/([^/]+)/$", "breakpoint set --source-pattern-regexp '%1'"},
@@ -515,6 +518,7 @@ void CommandInterpreter::LoadCommandDictionary() {
515518
"breakpoint set --name '%1' --skip-prologue=0"},
516519
{"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
517520
"breakpoint set --name '%1'"}};
521+
// clang-format on
518522

519523
size_t num_regexes = llvm::array_lengthof(break_regexes);
520524

@@ -523,6 +527,9 @@ void CommandInterpreter::LoadCommandDictionary() {
523527
*this, "_regexp-break",
524528
"Set a breakpoint using one of several shorthand formats.",
525529
"\n"
530+
"_regexp-break <filename>:<linenum>:<colnum>\n"
531+
" main.c:12:21 // Break at line 12 and column "
532+
"21 of main.c\n\n"
526533
"_regexp-break <filename>:<linenum>\n"
527534
" main.c:12 // Break at line 12 of "
528535
"main.c\n\n"
@@ -546,7 +553,7 @@ void CommandInterpreter::LoadCommandDictionary() {
546553
"current file\n"
547554
" // containing text 'break "
548555
"here'.\n",
549-
2,
556+
3,
550557
CommandCompletions::eSymbolCompletion |
551558
CommandCompletions::eSourceFileCompletion,
552559
false));
@@ -573,6 +580,9 @@ void CommandInterpreter::LoadCommandDictionary() {
573580
*this, "_regexp-tbreak",
574581
"Set a one-shot breakpoint using one of several shorthand formats.",
575582
"\n"
583+
"_regexp-break <filename>:<linenum>:<colnum>\n"
584+
" main.c:12:21 // Break at line 12 and column "
585+
"21 of main.c\n\n"
576586
"_regexp-break <filename>:<linenum>\n"
577587
" main.c:12 // Break at line 12 of "
578588
"main.c\n\n"
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

0 commit comments

Comments
 (0)