[Lldb-commits] [lldb] [lldb][Breakpoint] Allow whitespace in breakpoint address expression (PR #126053)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 6 03:51:50 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Michael Buch (Michael137)
<details>
<summary>Changes</summary>
Setting a breakpoint on `<symbol> + <offset>` used to work until `2c76e88e9eb284d17cf409851fb01f1d583bb22a`, where this regex was reworked. Now we only accept `<symbol>+ <offset>`.
This patch fixes the regression by adding yet another `[[:space:]]*` component to the regex.
One could probably simplify the regex (or even replace the regex by just calling the relevent `consumeXXX` APIs on `llvm::StringRef`). Though I left that for the future.
rdar://130780342
---
Full diff: https://github.com/llvm/llvm-project/pull/126053.diff
1 Files Affected:
- (modified) lldb/source/Interpreter/OptionArgParser.cpp (+3-1)
``````````diff
diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp
index 800f22b6169dc62..2d393a57452ee56 100644
--- a/lldb/source/Interpreter/OptionArgParser.cpp
+++ b/lldb/source/Interpreter/OptionArgParser.cpp
@@ -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:]]*)$");
+ // clang-format on
llvm::SmallVector<llvm::StringRef, 4> matches;
if (g_symbol_plus_offset_regex.Execute(sref, &matches)) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/126053
More information about the lldb-commits
mailing list