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;


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;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to