Skip to content

[lldb] Improve error message when --func-regex parameter for the brea… #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
2 changes: 1 addition & 1 deletion lldb/source/Commands/CommandObjectBreakpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
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;
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Utility/RegularExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ llvm::StringRef RegularExpression::GetText() const { return m_regex_text; }
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();
}
Original file line number Diff line number Diff line change
@@ -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"])