[Lldb-commits] [lldb] Clarify error messages on corefiles that no plugin handles (PR #72559)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 16 11:29:12 PST 2023


https://github.com/jasonmolenda created https://github.com/llvm/llvm-project/pull/72559

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.

>From cb79d7e6490db770b6be4fad5ad841f30ac66504 Mon Sep 17 00:00:00 2001
From: Jason Molenda <jmolenda at apple.com>
Date: Thu, 16 Nov 2023 11:17:13 -0800
Subject: [PATCH] Clarify error messages on corefiles that no plugin handles

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.
---
 lldb/source/Commands/CommandObjectTarget.cpp             | 8 +++-----
 lldb/source/Core/IOHandlerCursesGUI.cpp                  | 4 ++--
 lldb/test/API/commands/target/basic/TestTargetCommand.py | 2 +-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e2..58785cde3ec7c63 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -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(
@@ -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(
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 22b8cc3582eae78..abf0b6b801f37fc 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -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;
     }
   }
diff --git a/lldb/test/API/commands/target/basic/TestTargetCommand.py b/lldb/test/API/commands/target/basic/TestTargetCommand.py
index 96e7fe86ac5aee5..cb7a5f33f6643e8 100644
--- a/lldb/test/API/commands/target/basic/TestTargetCommand.py
+++ b/lldb/test/API/commands/target/basic/TestTargetCommand.py
@@ -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.



More information about the lldb-commits mailing list