diff --git a/lldb/include/lldb/Host/DebugInfoD.h b/lldb/include/lldb/Host/DebugInfoD.h --- a/lldb/include/lldb/Host/DebugInfoD.h +++ b/lldb/include/lldb/Host/DebugInfoD.h @@ -21,7 +21,7 @@ bool isAvailable(); -llvm::Expected getBuildIDFromModule(const lldb::ModuleSP &module); +UUID getBuildIDFromModule(const lldb::ModuleSP &module); llvm::Error findSource(UUID buildID, const std::string &path, std::string &result_path); diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp --- a/lldb/source/Core/SourceManager.cpp +++ b/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 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); } } } diff --git a/lldb/source/Host/common/DebugInfoD.cpp b/lldb/source/Host/common/DebugInfoD.cpp --- a/lldb/source/Host/common/DebugInfoD.cpp +++ b/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 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 getBuildIDFromModule(const ModuleSP &module) { +UUID getBuildIDFromModule(const ModuleSP &module) { UUID buildID; if (!module)