[Lldb-commits] [lldb] r271545 - 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.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 2 10:22:43 PDT 2016


Author: gclayton
Date: Thu Jun  2 12:22:42 2016
New Revision: 271545

URL: http://llvm.org/viewvc/llvm-project?rev=271545&view=rev
Log:
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> 


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=271545&r1=271544&r2=271545&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Jun  2 12:22:42 2016
@@ -1834,9 +1834,25 @@ SymbolFileDWARF::UpdateExternalModuleLis
                     {
                         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;
                 }




More information about the lldb-commits mailing list