https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/213011

>From 6e6ca760f3c110d22aabb8cf5f54c3088a4af817 Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Thu, 30 Jul 2026 13:25:55 +0100
Subject: [PATCH 1/2] [lldb][Windows] Improve error messages in
 PlatformWindows.cpp

---
 .../Platform/Windows/PlatformWindows.cpp      | 37 ++++++++++++++++++-
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index fdf6983801ae5..df5d5a074ffb3 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -37,6 +37,7 @@
 
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/FormatVariadic.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -194,6 +195,32 @@ Status PlatformWindows::ConnectRemote(Args &args) {
   return error;
 }
 
+static llvm::StringRef ExpressionResultAsString(ExpressionResults result) {
+  switch (result) {
+  case eExpressionCompleted:
+    return "completed";
+  case eExpressionSetupError:
+    return "setup error";
+  case eExpressionParseError:
+    return "parse error";
+  case eExpressionDiscarded:
+    return "discarded";
+  case eExpressionInterrupted:
+    return "interrupted";
+  case eExpressionHitBreakpoint:
+    return "hit breakpoint";
+  case eExpressionTimedOut:
+    return "timed out";
+  case eExpressionResultUnavailable:
+    return "result unavailable";
+  case eExpressionStoppedForDebug:
+    return "stopped for debug";
+  case eExpressionThreadVanished:
+    return "thread vanished";
+  }
+  return "unknown error";
+}
+
 uint32_t PlatformWindows::DoLoadImage(Process *process,
                                       const FileSpec &remote_file,
                                       const std::vector<std::string> *paths,
@@ -430,7 +457,10 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (result != eExpressionCompleted) {
     error = Status::FromError(diagnostics.GetAsError(
         eExpressionSetupError,
-        "LoadLibrary error: failed to execute LoadLibrary helper:"));
+        llvm::formatv("LoadLibrary error: failed to execute LoadLibrary helper 
"
+                      "({0}):",
+                      ExpressionResultAsString(result))
+            .str()));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -936,7 +966,10 @@ extern "C" {
   ExpressionResults result = UserExpression::Evaluate(
       context, options, expression, kLoaderDecls, value);
   if (result != eExpressionCompleted)
-    return value ? value->GetError().Clone() : Status("unknown error");
+    return value ? value->GetError().Clone()
+                 : Status::FromErrorStringWithFormatv(
+                       "failed to execute loader helper ({0})",
+                       ExpressionResultAsString(result));
 
   if (value && value->GetError().Fail())
     return value->GetError().Clone();

>From f4b3bd9c5835a83cd6afcdf1346aac6feeb05e4f Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Fri, 31 Jul 2026 17:55:08 +0100
Subject: [PATCH 2/2] fixup! [lldb][Windows] Improve error messages in
 PlatformWindows.cpp

---
 .../Platform/Windows/PlatformWindows.cpp      | 37 +++----------------
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index df5d5a074ffb3..dad0b16df05d5 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -33,6 +33,7 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Utility/ErrorMessages.h"
 #include "lldb/Utility/Status.h"
 
 #include "llvm/ADT/ScopeExit.h"
@@ -195,32 +196,6 @@ Status PlatformWindows::ConnectRemote(Args &args) {
   return error;
 }
 
-static llvm::StringRef ExpressionResultAsString(ExpressionResults result) {
-  switch (result) {
-  case eExpressionCompleted:
-    return "completed";
-  case eExpressionSetupError:
-    return "setup error";
-  case eExpressionParseError:
-    return "parse error";
-  case eExpressionDiscarded:
-    return "discarded";
-  case eExpressionInterrupted:
-    return "interrupted";
-  case eExpressionHitBreakpoint:
-    return "hit breakpoint";
-  case eExpressionTimedOut:
-    return "timed out";
-  case eExpressionResultUnavailable:
-    return "result unavailable";
-  case eExpressionStoppedForDebug:
-    return "stopped for debug";
-  case eExpressionThreadVanished:
-    return "thread vanished";
-  }
-  return "unknown error";
-}
-
 uint32_t PlatformWindows::DoLoadImage(Process *process,
                                       const FileSpec &remote_file,
                                       const std::vector<std::string> *paths,
@@ -459,7 +434,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
         eExpressionSetupError,
         llvm::formatv("LoadLibrary error: failed to execute LoadLibrary helper 
"
                       "({0}):",
-                      ExpressionResultAsString(result))
+                      toString(result))
             .str()));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
@@ -966,10 +941,10 @@ extern "C" {
   ExpressionResults result = UserExpression::Evaluate(
       context, options, expression, kLoaderDecls, value);
   if (result != eExpressionCompleted)
-    return value ? value->GetError().Clone()
-                 : Status::FromErrorStringWithFormatv(
-                       "failed to execute loader helper ({0})",
-                       ExpressionResultAsString(result));
+    return value
+               ? value->GetError().Clone()
+               : Status::FromErrorStringWithFormatv(
+                     "failed to execute loader helper ({0})", 
toString(result));
 
   if (value && value->GetError().Fail())
     return value->GetError().Clone();

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to