Author: Charles Zablit
Date: 2026-08-01T18:03:40+02:00
New Revision: 6dfd7337239f82e19aad65a899e862bf31a8b180

URL: 
https://github.com/llvm/llvm-project/commit/6dfd7337239f82e19aad65a899e862bf31a8b180
DIFF: 
https://github.com/llvm/llvm-project/commit/6dfd7337239f82e19aad65a899e862bf31a8b180.diff

LOG: [lldb][Windows] Improve error messages in PlatformWindows.cpp (#213011)

The reason for the failure is known but is not in the log. Add a helper
function to map the error to a string and log it.

---------

Co-authored-by: Jonas Devlieghere <[email protected]>

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index f471a957e8361..497a78e85ed58 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -34,10 +34,12 @@
 #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"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/FormatVariadic.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -433,7 +435,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("failed to execute LoadLibrary helper "
+                      "({0}):",
+                      toString(result))
+            .str()));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -941,7 +946,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})", 
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