[Lldb-commits] [PATCH] D78808: [lldb] Improve error message when --func-regex parameter for the breakpoint command is invalid

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 27 01:01:44 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb58af8d254ee: [lldb] Improve error message when --func-regex parameter for the breakpoint… (authored by teemperor).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78808/new/

https://reviews.llvm.org/D78808

Files:
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Utility/RegularExpression.cpp
  lldb/test/API/commands/breakpoint/set/func-regex/TestBreakpointRegexError.py


Index: lldb/test/API/commands/breakpoint/set/func-regex/TestBreakpointRegexError.py
===================================================================
--- /dev/null
+++ lldb/test/API/commands/breakpoint/set/func-regex/TestBreakpointRegexError.py
@@ -0,0 +1,14 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    @no_debug_info_test
+    def test_error(self):
+        self.expect("breakpoint set --func-regex (", error=True,
+                    substrs=["error: Function name regular expression could " +
+                             "not be compiled: parentheses not balanced"])
Index: lldb/source/Utility/RegularExpression.cpp
===================================================================
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -35,7 +35,7 @@
 llvm::Error RegularExpression::GetError() const {
   std::string error;
   if (!m_regex.isValid(error))
-    return llvm::make_error<llvm::StringError>(llvm::inconvertibleErrorCode(),
-                                               error);
+    return llvm::make_error<llvm::StringError>(error,
+                                               llvm::inconvertibleErrorCode());
   return llvm::Error::success();
 }
Index: lldb/source/Commands/CommandObjectBreakpoint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -620,7 +620,7 @@
       RegularExpression regexp(m_options.m_func_regexp);
       if (llvm::Error err = regexp.GetError()) {
         result.AppendErrorWithFormat(
-            "Function name regular expression could not be compiled: \"%s\"",
+            "Function name regular expression could not be compiled: %s",
             llvm::toString(std::move(err)).c_str());
         result.SetStatus(eReturnStatusFailed);
         return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78808.260232.patch
Type: text/x-patch
Size: 2065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200427/216e4a36/attachment.bin>


More information about the lldb-commits mailing list