summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-12-14 14:56:45 +0000
committerPavel Labath <labath@google.com>2017-12-14 14:56:45 +0000
commitf1208e7aefc1c36620370e058af932b7b9bf3bb8 (patch)
tree623b098685e75d3dc80731c3cf93b5694310a0cb
parent8630d3871d7d3de07a2615835b3b6e1357aa564a (diff)
downloadbcm5719-llvm-f1208e7aefc1c36620370e058af932b7b9bf3bb8.tar.gz
bcm5719-llvm-f1208e7aefc1c36620370e058af932b7b9bf3bb8.zip
ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion
Summary: These two functions were calling each other, while handling different branches of the if(IsInMemory()). This had a reason at some point in the past, but right now it's just confusing. I resolve this by removing the MemoryMapSectionData function and inlining the !IsInMemory branch into ReadSectionData. There isn't anything mmap-related in this function anyway, as the decision whether to mmap is handled at a higher level. This is a preparatory step to make ObjectFileELF be able to decompress compressed sections (I want to make sure that all calls reading section data are routed through a single piece of code). Reviewers: clayborg Subscribers: emaste, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D41169 llvm-svn: 320705
-rw-r--r--lldb/include/lldb/Symbol/ObjectFile.h3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp4
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp16
3 files changed, 1 insertions, 22 deletions
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index 60a748bb39d..0708b7c47f3 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -805,9 +805,6 @@ public:
virtual size_t ReadSectionData(Section *section,
DataExtractor &section_data);
- size_t MemoryMapSectionData(Section *section,
- DataExtractor &section_data);
-
bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
// Strip linker annotations (such as @@VERSION) from symbol names.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index d7e13edeecd..f149ec354f0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -444,10 +444,8 @@ void SymbolFileDWARF::InitializeObject() {
Section *section =
section_list->FindSectionByName(GetDWARFMachOSegmentName()).get();
- // Memory map the DWARF mach-o segment so we have everything mmap'ed
- // to keep our heap memory usage down.
if (section)
- m_obj_file->MemoryMapSectionData(section, m_dwarf_data);
+ m_obj_file->ReadSectionData(section, m_dwarf_data);
}
get_apple_names_data();
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 39593bc6e2b..7d73cb19d50 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -561,25 +561,9 @@ size_t ObjectFile::ReadSectionData(Section *section,
} else {
// The object file now contains a full mmap'ed copy of the object file data,
// so just use this
- return MemoryMapSectionData(section, section_data);
- }
-}
-
-size_t ObjectFile::MemoryMapSectionData(Section *section,
- DataExtractor &section_data) {
- // If some other objectfile owns this data, pass this to them.
- if (section->GetObjectFile() != this)
- return section->GetObjectFile()->MemoryMapSectionData(section,
- section_data);
-
- if (IsInMemory()) {
- return ReadSectionData(section, section_data);
- } else {
if (!section->IsRelocated())
RelocateSection(section);
- // The object file now contains a full mmap'ed copy of the object file data,
- // so just use this
return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
}
OpenPOWER on IntegriCloud