summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-10-31 18:42:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-10-31 18:42:03 +0000
commit6405260fedcb91c720fc498be637c4c99a033265 (patch)
treef4c56fc73eef01bb08fd8b8b11ef31736cfd85ea /contrib
parent3b82cf0e189ea1bca1a8cacba6334684e106abd9 (diff)
downloadsrc-test2-6405260fedcb91c720fc498be637c4c99a033265.tar.gz
src-test2-6405260fedcb91c720fc498be637c4c99a033265.zip
Notes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/llvm-project/lldb/source/Target/Target.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/contrib/llvm-project/lldb/source/Target/Target.cpp b/contrib/llvm-project/lldb/source/Target/Target.cpp
index 83e6f3062666..47e4c78496ab 100644
--- a/contrib/llvm-project/lldb/source/Target/Target.cpp
+++ b/contrib/llvm-project/lldb/source/Target/Target.cpp
@@ -2412,21 +2412,13 @@ lldb::addr_t Target::GetPersistentSymbol(ConstString name) {
llvm::Expected<lldb_private::Address> Target::GetEntryPointAddress() {
Module *exe_module = GetExecutableModulePointer();
- llvm::Error error = llvm::Error::success();
- assert(!error); // Check the success value when assertions are enabled.
- if (!exe_module || !exe_module->GetObjectFile()) {
- error = llvm::make_error<llvm::StringError>("No primary executable found",
- llvm::inconvertibleErrorCode());
- } else {
+ // Try to find the entry point address in the primary executable.
+ const bool has_primary_executable = exe_module && exe_module->GetObjectFile();
+ if (has_primary_executable) {
Address entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress();
if (entry_addr.IsValid())
return entry_addr;
-
- error = llvm::make_error<llvm::StringError>(
- "Could not find entry point address for executable module \"" +
- exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
- llvm::inconvertibleErrorCode());
}
const ModuleList &modules = GetImages();
@@ -2437,14 +2429,21 @@ llvm::Expected<lldb_private::Address> Target::GetEntryPointAddress() {
continue;
Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
- if (entry_addr.IsValid()) {
- // Discard the error.
- llvm::consumeError(std::move(error));
+ if (entry_addr.IsValid())
return entry_addr;
- }
}
- return std::move(error);
+ // We haven't found the entry point address. Return an appropriate error.
+ if (!has_primary_executable)
+ return llvm::make_error<llvm::StringError>(
+ "No primary executable found and could not find entry point address in "
+ "any executable module",
+ llvm::inconvertibleErrorCode());
+
+ return llvm::make_error<llvm::StringError>(
+ "Could not find entry point address for primary executable module \"" +
+ exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
+ llvm::inconvertibleErrorCode());
}
lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,