[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 18 19:25:49 PDT 2023
================
@@ -1742,20 +1742,37 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
if (std::shared_ptr<SymbolFileDWARFDwo> dwp_sp = GetDwpSymbolFile())
return dwp_sp;
- FileSpec dwo_file(dwo_name);
- FileSystem::Instance().Resolve(dwo_file);
- bool found = false;
+ const char *comp_dir =
+ cu_die.GetAttributeValueAsString(dwarf_cu, DW_AT_comp_dir, nullptr);
+
+ // Try locating the dwo via the callback first.
+ FileSpec dwo_file;
+ SymbolFile::LocateDwoCallback locate_dwo_callback =
+ SymbolFile::GetLocateDwoCallback();
+ if (locate_dwo_callback) {
+ const FileSpec &objfile_spec = m_objfile_sp->GetFileSpec();
+ Status error = locate_dwo_callback(objfile_spec, dwo_name, comp_dir,
+ dwarf_cu->GetDWOId().value(), dwo_file);
+ if (error.Fail()) {
+ GetObjectFile()->GetModule()->ReportWarning(
+ "locate DWO callback failed with error: {0}",
+ error.AsCString("unknown error"));
+ }
----------------
clayborg wrote:
I don't know if we should report a warning every time we fail to find a .dwo file. Probably best to use an appropriate log channel for this.
https://github.com/llvm/llvm-project/pull/69517
More information about the lldb-commits
mailing list