Skip to content

Commit

Permalink
Clarify error messages on corefiles that no plugin handles (#72559)
Browse files Browse the repository at this point in the history
These error messages are written in a way that makes sense to an lldb
developer, but not to an end user who asks lldb to run on a compressed
corefile or whatever. Simplfy the messages.
  • Loading branch information
jasonmolenda committed Nov 16, 2023
1 parent 102f7fc commit 5f64b94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions lldb/source/Commands/CommandObjectTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,7 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
error = process_sp->LoadCore();

if (error.Fail()) {
result.AppendError(
error.AsCString("can't find plug-in for core file"));
result.AppendError(error.AsCString("unknown core file format"));
return;
} else {
result.AppendMessageWithFormatv(
Expand All @@ -447,9 +446,8 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
on_error.release();
}
} else {
result.AppendErrorWithFormatv(
"Unable to find process plug-in for core file '{0}'\n",
core_file.GetPath());
result.AppendErrorWithFormatv("Unknown core file format '{0}'\n",
core_file.GetPath());
}
} else {
result.AppendMessageWithFormat(
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Core/IOHandlerCursesGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3178,13 +3178,13 @@ class TargetCreateFormDelegate : public FormDelegate {
m_debugger.GetListener(), llvm::StringRef(), &core_file_spec, false));

if (!process_sp) {
SetError("Unable to find process plug-in for core file!");
SetError("Unknown core file format!");
return;
}

Status status = process_sp->LoadCore();
if (status.Fail()) {
SetError("Can't find plug-in for core file!");
SetError("Unknown core file format!");
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lldb/test/API/commands/target/basic/TestTargetCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def test_target_create_invalid_core_file(self):
self.expect(
"target create -c '" + invalid_core_path + "'",
error=True,
substrs=["Unable to find process plug-in for core file '"],
substrs=["Unknown core file format '"],
)

# Write only files don't seem to be supported on Windows.
Expand Down

0 comments on commit 5f64b94

Please sign in to comment.