[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 <jonas@devlieghere.com>
This commit is contained in:
parent
67a20745d6
commit
6dfd733723
1 changed files with 10 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue