[Lldb-commits] [PATCH] D75753: Simplified return type of getBuildIDFromModule
Konrad Wilhelm Kleine via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 6 08:46:20 PST 2020
kwk created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
kwk added a child revision: D75754: Fix typo.
kwk abandoned this revision.
kwk added a comment.
I didn't intend to create a new revision.
Depends on D75750 <https://reviews.llvm.org/D75750>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75753
Files:
lldb/include/lldb/Host/DebugInfoD.h
lldb/source/Core/SourceManager.cpp
lldb/source/Host/common/DebugInfoD.cpp
Index: lldb/source/Host/common/DebugInfoD.cpp
===================================================================
--- lldb/source/Host/common/DebugInfoD.cpp
+++ lldb/source/Host/common/DebugInfoD.cpp
@@ -11,6 +11,7 @@
#include "lldb/Symbol/ObjectFile.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
+#include "lldb/Host/DebugInfoD.h"
#if LLDB_ENABLE_DEBUGINFOD
#include "elfutils/debuginfod.h"
@@ -26,7 +27,7 @@
#if !LLDB_ENABLE_DEBUGINFOD
bool isAvailable() { return false; }
-llvm::Expected<UUID> getBuildIDFromModule(const ModuleSP &module) {
+UUID getBuildIDFromModule(const ModuleSP &module) {
llvm_unreachable("debuginfod::getBuildIDFromModule is unavailable");
};
@@ -39,7 +40,7 @@
bool isAvailable() { return true; }
-llvm::Expected<UUID> getBuildIDFromModule(const ModuleSP &module) {
+UUID getBuildIDFromModule(const ModuleSP &module) {
UUID buildID;
if (!module)
Index: lldb/source/Core/SourceManager.cpp
===================================================================
--- lldb/source/Core/SourceManager.cpp
+++ lldb/source/Core/SourceManager.cpp
@@ -460,25 +460,18 @@
// Try finding the file using elfutils' debuginfod
if (!FileSystem::Instance().Exists(m_file_spec) &&
debuginfod::isAvailable() && sc.module_sp) {
- llvm::Expected<UUID> buildID =
- debuginfod::getBuildIDFromModule(sc.module_sp);
- if (auto err = buildID.takeError()) {
- sc.module_sp->ReportWarning("An error occurred while getting the "
- "build ID from the module: %s",
+ UUID buildID = debuginfod::getBuildIDFromModule(sc.module_sp);
+ std::string cache_path;
+ llvm::Error err =
+ debuginfod::findSource(buildID, file_spec.GetCString(), cache_path);
+ if (err) {
+ sc.module_sp->ReportWarning("An error occurred while finding the "
+ "source file %s using debuginfod: %s",
+ file_spec.GetCString(),
llvm::toString(std::move(err)).c_str());
} else {
- std::string cache_path;
- err = debuginfod::findSource(*buildID, file_spec.GetCString(),
- cache_path);
- if (err) {
- sc.module_sp->ReportWarning("An error occurred while finding the "
- "source file %s using debuginfod: %s",
- file_spec.GetCString(),
- llvm::toString(std::move(err)).c_str());
- } else {
- m_file_spec = FileSpec(cache_path);
- m_mod_time = FileSystem::Instance().GetModificationTime(cache_path);
- }
+ m_file_spec = FileSpec(cache_path);
+ m_mod_time = FileSystem::Instance().GetModificationTime(cache_path);
}
}
}
Index: lldb/include/lldb/Host/DebugInfoD.h
===================================================================
--- lldb/include/lldb/Host/DebugInfoD.h
+++ lldb/include/lldb/Host/DebugInfoD.h
@@ -21,7 +21,7 @@
bool isAvailable();
-llvm::Expected<UUID> getBuildIDFromModule(const lldb::ModuleSP &module);
+UUID getBuildIDFromModule(const lldb::ModuleSP &module);
llvm::Error findSource(UUID buildID, const std::string &path,
std::string &result_path);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75753.248742.patch
Type: text/x-patch
Size: 3445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200306/1b375b5a/attachment-0001.bin>
More information about the lldb-commits
mailing list