diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/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; diff --git a/lldb/source/Utility/RegularExpression.cpp b/lldb/source/Utility/RegularExpression.cpp --- a/lldb/source/Utility/RegularExpression.cpp +++ b/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::inconvertibleErrorCode(), - error); + return llvm::make_error(error, + llvm::inconvertibleErrorCode()); return llvm::Error::success(); } diff --git a/lldb/test/API/commands/breakpoint/set/func-regex/TestBreakpointRegexError.py b/lldb/test/API/commands/breakpoint/set/func-regex/TestBreakpointRegexError.py new file mode 100644 --- /dev/null +++ b/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"])