Skip to content
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: 0 additions & 2 deletions lldb/include/lldb/Interpreter/CommandReturnObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ class CommandReturnObject {

void AppendError(llvm::StringRef in_string);

void AppendRawError(llvm::StringRef in_string);

void AppendErrorWithFormat(const char *format, ...)
__attribute__((format(printf, 2, 3)));

Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Commands/CommandObjectMultiword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void CommandObjectMultiword::Execute(const char *args_string,
.str());
}
error_msg.append("\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppendError ends up trimming this "\n" from the end of the string, then putting another on on. So there's no reason to keep the append("\n") here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result.AppendRawError(error_msg.c_str());
result.AppendError(error_msg);
}

std::string CommandObjectMultiword::GetSubcommandsHintText() {
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Interpreter/CommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line,
for (uint32_t i = 0; i < num_matches; ++i) {
error_msg.Printf("\t%s\n", matches.GetStringAtIndex(i));
}
result.AppendRawError(error_msg.GetString());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also want to uncapitalize Ambiguous on line 3705 above as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remove the pointless \n at the end.

result.AppendError(error_msg.GetString());
}
} else {
// We didn't have only one match, otherwise we wouldn't get here.
Expand Down
9 changes: 0 additions & 9 deletions lldb/source/Interpreter/CommandReturnObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,6 @@ StructuredData::ObjectSP CommandReturnObject::GetErrorData() {
return Serialize(m_diagnostics);
}

// Similar to AppendError, but do not prepend 'Status: ' to message, and don't
// append "\n" to the end of it.

void CommandReturnObject::AppendRawError(llvm::StringRef in_string) {
SetStatus(eReturnStatusFailed);
assert(!in_string.empty() && "Expected a non-empty error message");
GetErrorStream() << in_string;
}

void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }

ReturnStatus CommandReturnObject::GetStatus() const { return m_status; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_command_abbreviations_and_aliases(self):
# "pl" could be "platform" or "plugin".
command_interpreter.ResolveCommand("pl", result)
self.assertFalse(result.Succeeded())
self.assertTrue(result.GetError().startswith("Ambiguous command"))
self.assertTrue(result.GetError().startswith("error: Ambiguous command"))

# Make sure an unabbreviated command is not mangled.
command_interpreter.ResolveCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_ambiguous_command_with_alias(self):
self.assertFalse(result.Succeeded())
self.assertEqual(
result.GetError(),
"Ambiguous command 'co'. Possible matches:\n\tcommand\n\tcontinue\n\tcorefile\n",
"error: Ambiguous command 'co'. Possible matches:\n\tcommand\n\tcontinue\n\tcorefile\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "error: ambiguous..." right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, already put up #171519. I'll do the same for the newline.

)

command_interpreter.HandleCommand("command unalias continue", result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def test_ambiguous_command(self):

command_interpreter.HandleCommand("g", result)
self.assertFalse(result.Succeeded())
self.assertRegex(result.GetError(), "Ambiguous command 'g'. Possible matches:")
self.assertRegex(
result.GetError(), "error: Ambiguous command 'g'. Possible matches:"
)
self.assertRegex(result.GetError(), "gui")
self.assertRegex(result.GetError(), "gdb-remote")
self.assertEqual(1, result.GetError().count("gdb-remote"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# RUN: not %lldb -b -o 'breakpoint foo' %t.out -o exit 2>&1 | FileCheck %s --check-prefix BP-MSG
# RUN: not %lldb -b -o 'watchpoint set foo' %t.out -o exit 2>&1 | FileCheck %s --check-prefix WP-MSG
# CHECK: at main.c:2:21
# BP-MSG: "foo" is not a valid subcommand of "breakpoint". Valid subcommands are: add, clear, command, delete, disable, and others. Use "help breakpoint" to find out more.
# WP-MSG: "foo" is not a valid subcommand of "watchpoint set". Valid subcommands are: expression, variable. Use "help watchpoint set" to find out more.
# BP-MSG: error: "foo" is not a valid subcommand of "breakpoint". Valid subcommands are: add, clear, command, delete, disable, and others. Use "help breakpoint" to find out more.
# WP-MSG: error: "foo" is not a valid subcommand of "watchpoint set". Valid subcommands are: expression, variable. Use "help watchpoint set" to find out more.
Loading