summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2018-09-06 00:55:27 +0000
committerJason Molenda <jmolenda@apple.com>2018-09-06 00:55:27 +0000
commitb0d33e9b3ceff6b80e7c3288a874540d952fa821 (patch)
tree7ee223f378c519874462834f41be7cddd5fac1a9 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parent26f23f8c25e92ea72ef4befa620a97b95ee708d0 (diff)
downloadbcm5719-llvm-b0d33e9b3ceff6b80e7c3288a874540d952fa821.tar.gz
bcm5719-llvm-b0d33e9b3ceff6b80e7c3288a874540d952fa821.zip
Re-instate a bit of code that was commented out in r188246 which
reads an ObjectFileMachO's string table in one chunk. Originally this was commented out because binaries in the system's shared cache all share a mega-string table and so reading the entire mega-strtab for each binary was a performance problem. In the reinstated code, I add a check that the binary we're reading from memory is not in the shared cache (there isn't a constant in <mach-o/loader.h> for this bit yet; we hardcode the value in one other place in ObjectFileMachO alread). For binaries that we're reading out of memory that are NOT in the shared cache, reading the string table in one chunk is a big performance improvement. Also have debugserver send up the flags value for binaries in its response to the jGetLoadedDynamicLibrariesInfos request. NFC. <rdar://problem/33604496> llvm-svn: 341511
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 7365f482c89..1bc9be0cce6 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2331,14 +2331,6 @@ size_t ObjectFileMachO::ParseSymtab() {
if (nlist_data_sp)
nlist_data.SetData(nlist_data_sp, 0,
nlist_data_sp->GetByteSize());
- // Load strings individually from memory when loading from memory
- // since shared cache string tables contain strings for all symbols
- // from all shared cached libraries DataBufferSP strtab_data_sp
- // (ReadMemory (process_sp, strtab_addr,
- // strtab_data_byte_size));
- // if (strtab_data_sp)
- // strtab_data.SetData (strtab_data_sp, 0,
- // strtab_data_sp->GetByteSize());
if (m_dysymtab.nindirectsyms != 0) {
const addr_t indirect_syms_addr = linkedit_load_addr +
m_dysymtab.indirectsymoff -
@@ -2350,6 +2342,22 @@ size_t ObjectFileMachO::ParseSymtab() {
indirect_symbol_index_data.SetData(
indirect_syms_data_sp, 0,
indirect_syms_data_sp->GetByteSize());
+ // If this binary is outside the shared cache,
+ // cache the string table.
+ // Binaries in the shared cache all share a giant string table, and
+ // we can't share the string tables across multiple ObjectFileMachO's,
+ // so we'd end up re-reading this mega-strtab for every binary
+ // in the shared cache - it would be a big perf problem.
+ // For binaries outside the shared cache, it's faster to read the
+ // entire strtab at once instead of piece-by-piece as we process
+ // the nlist records.
+ if ((m_header.flags & 0x80000000u) == 0) {
+ DataBufferSP strtab_data_sp (ReadMemory (process_sp, strtab_addr,
+ strtab_data_byte_size));
+ if (strtab_data_sp) {
+ strtab_data.SetData (strtab_data_sp, 0, strtab_data_sp->GetByteSize());
+ }
+ }
}
}
if (memory_module_load_level >=
OpenPOWER on IntegriCloud