Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lldb/source/Interpreter/OptionArgParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,10 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
// 3: The symbol/reg name if there is an offset
// 4: +/-
// 5: The offset value.
// clang-format off
static RegularExpression g_symbol_plus_offset_regex(
"^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$");
"^(\\$[^ +-]+)|(([^ +-]+)[[:space:]]*([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is using (in [^ +-])and :space: in the same regex, which seems oddly inconsistent?
Apart from Pavel's comment, this seems fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think the regex can be simplified. But it's was using :space: already and I didn't want to make drive-by changes to this regex in this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably prefer to just parse the string if we did want to simplify this logic

// clang-format on

llvm::SmallVector<llvm::StringRef, 4> matches;
if (g_symbol_plus_offset_regex.Execute(sref, &matches)) {
Expand Down
14 changes: 14 additions & 0 deletions lldb/test/Shell/Commands/command-breakpoint-by-addr.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
# RUN: %lldb %t.out -b -s %s | FileCheck %s

breakpoint set -a "main+26"
breakpoint set -a "main+ 26"
breakpoint set -a "main +26"
breakpoint set -a "main + 26"
breakpoint set -a "main + 26"

# CHECK: Breakpoint 1: address =
# CHECK: Breakpoint 2: address =
# CHECK: Breakpoint 3: address =
# CHECK: Breakpoint 4: address =
# CHECK: Breakpoint 5: address =