summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <shal1t712@gmail.com>2017-09-12 22:14:36 +0000
committerAlexander Shaposhnikov <shal1t712@gmail.com>2017-09-12 22:14:36 +0000
commitff7b03fc854b7b0fd9f8ea2f1ceee9299dd6628e (patch)
treea3dcfcd60270625bbd3d3dd23479867d15b4d60b
parent760ad5ce0354cd56a465361bf5ef83791d72e629 (diff)
downloadbcm5719-llvm-ff7b03fc854b7b0fd9f8ea2f1ceee9299dd6628e.tar.gz
bcm5719-llvm-ff7b03fc854b7b0fd9f8ea2f1ceee9299dd6628e.zip
[lldb] Adjust UpdateExternalModuleListIfNeeded method for the case of *.dwo
When LLDB loads "external" modules it looks at the presence of DW_AT_GNU_dwo_name. However, when the already created module (corresponding to .dwo itself) is being processed, it will see the presence of DW_AT_GNU_dwo_name (which contains the name of dwo file) and will try to call ModuleList::GetSharedModule again. In some cases (i.e. for empty files) Clang 4.0 generates a *.dwo file which has DW_AT_GNU_dwo_name, but no DW_AT_comp_dir. In this case the method ModuleList::GetSharedModule will fail and the warning will be printed. To workaround this issue, one can notice that in this case we don't actually need to try to load the already loaded module (corresponding to .dwo). Test plan: make check-all Differential revision: https://reviews.llvm.org/D37295 llvm-svn: 313083
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b4056d0a7b9..b2e37c41c84 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1640,7 +1640,29 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
}
dwo_module_spec.GetArchitecture() =
m_obj_file->GetModule()->GetArchitecture();
- // printf ("Loading dwo = '%s'\n", dwo_path);
+
+ // When LLDB loads "external" modules it looks at the
+ // presence of DW_AT_GNU_dwo_name.
+ // However, when the already created module
+ // (corresponding to .dwo itself) is being processed,
+ // it will see the presence of DW_AT_GNU_dwo_name
+ // (which contains the name of dwo file) and
+ // will try to call ModuleList::GetSharedModule again.
+ // In some cases (i.e. for empty files) Clang 4.0
+ // generates a *.dwo file which has DW_AT_GNU_dwo_name,
+ // but no DW_AT_comp_dir. In this case the method
+ // ModuleList::GetSharedModule will fail and
+ // the warning will be printed. However, as one can notice
+ // in this case we don't actually need to try to load the already
+ // loaded module (corresponding to .dwo) so we simply skip it.
+ 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) {
OpenPOWER on IntegriCloud