diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/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 ::\n" + " main.c:12:21 // Break at line 12 and column " + "21 of main.c\n\n" "_regexp-break :\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 ::\n" + " main.c:12:21 // Break at line 12 and column " + "21 of main.c\n\n" "_regexp-break :\n" " main.c:12 // Break at line 12 of " "main.c\n\n" diff --git a/lldb/test/Shell/Commands/command-breakpoint-col.test b/lldb/test/Shell/Commands/command-breakpoint-col.test --- a/lldb/test/Shell/Commands/command-breakpoint-col.test +++ b/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 ) -# 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 ) +# HELP: Specifies the column number on which to set this breakpoint. +# HELP-REGEX: _regexp-break :: +# HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c # CHECK: at main.c:2:21