LLDB needs to be able to handle DW_AT_GNU_dwo_name that are relative to the DW_AT_comp_dir when using -gmodules with DWARF in .o files on darwin.

<rdar://problem/26590227> 

llvm-svn: 271545
This commit is contained in:
Greg Clayton 2016-06-02 17:22:42 +00:00
parent 553a0d62f2
commit 218b3b9ac5
1 changed files with 16 additions and 0 deletions

View File

@ -1834,9 +1834,25 @@ SymbolFileDWARF::UpdateExternalModuleListIfNeeded()
{
ModuleSpec dwo_module_spec;
dwo_module_spec.GetFileSpec().SetFile(dwo_path, false);
if (dwo_module_spec.GetFileSpec().IsRelative())
{
const char *comp_dir = die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr);
if (comp_dir)
{
dwo_module_spec.GetFileSpec().SetFile(comp_dir, true);
dwo_module_spec.GetFileSpec().AppendPathComponent(dwo_path);
}
}
dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture();
//printf ("Loading dwo = '%s'\n", dwo_path);
Error error = ModuleList::GetSharedModule (dwo_module_spec, module_sp, NULL, NULL, NULL);
if (!module_sp)
{
GetObjectFile()->GetModule()->ReportWarning ("0x%8.8x: unable to locate module needed for external types: %s\nerror: %s\nDebugging will be degraded due to missing types. Rebuilding your project will regenerate the needed module files.",
die.GetOffset(),
dwo_module_spec.GetFileSpec().GetPath().c_str(),
error.AsCString("unknown error"));
}
}
m_external_type_modules[const_name] = module_sp;
}