[Lldb-commits] [PATCH] D37295: [lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo

Alexander Shaposhnikov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 30 06:16:42 PDT 2017


alexshap created this revision.
Herald added a subscriber: JDevlieghere.

A *.dwo file itself can have DW_AT_GNU_dwo_name (but no DW_AT_comp_dir) 
(clang 4.0 generates such DWOs). In this case there is no need to try to get a new module, 
and, more over, if we try (below) the method ModuleList::GetSharedModule will return
an error + nullptr since the path is ill-formed (because comp_dir is null (since DW_AT_comp_dir is not present)).

Test plan: built a toy example + "br set --name f" + "p LocaVariable" (lld will search recursively for types and will call UpdateExternalModuleListIfNeeded)


Repository:
  rL LLVM

https://reviews.llvm.org/D37295

Files:
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1640,7 +1640,21 @@
             }
             dwo_module_spec.GetArchitecture() =
                 m_obj_file->GetModule()->GetArchitecture();
-            // printf ("Loading dwo = '%s'\n", dwo_path);
+
+            // A *.dwo file itself can have DW_AT_GNU_dwo_name (but no
+            // DW_AT_comp_dir) (clang 4.0 generates such DWOs). In this case
+            // there is no need to try to get a new module, and, more over, if
+            // we try (below) the method ModuleList::GetSharedModule will return
+            // an error + nullptr since the path is ill-formed (because comp_dir
+            // is null (since DW_AT_comp_dir is not present)).
+            if (m_obj_file->GetFileSpec()
+                        .GetFileNameExtension()
+                        .GetStringRef() == "dwo" &&
+                llvm::StringRef(m_obj_file->GetFileSpec().GetPath())
+                    .endswith(dwo_module_spec.GetFileSpec().GetPath())) {
+              continue;
+            }
+
             Status error = ModuleList::GetSharedModule(
                 dwo_module_spec, module_sp, NULL, NULL, NULL);
             if (!module_sp) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37295.113249.patch
Type: text/x-patch
Size: 1390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170830/81fff524/attachment.bin>


More information about the lldb-commits mailing list