[Lldb-commits] [lldb] af96914 - [lldb] Pin the shared cache when iterating over its images
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 11 15:26:38 PST 2022
Author: Jonas Devlieghere
Date: 2022-02-11T15:26:33-08:00
New Revision: af969141fa285157044e34fb6b27963c3278241b
URL: https://github.com/llvm/llvm-project/commit/af969141fa285157044e34fb6b27963c3278241b
DIFF: https://github.com/llvm/llvm-project/commit/af969141fa285157044e34fb6b27963c3278241b.diff
LOG: [lldb] Pin the shared cache when iterating over its images
Use the dyld_shared_cache_(un)pin_mapping SPI to map the whole shared
cache in memory (if possible) to avoid repeated calls to mmap.
rdar://81189015
Added:
Modified:
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 10137e714861d..131d1932fe142 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2711,7 +2711,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
if (process_shared_cache_uuid.IsValid() &&
process_shared_cache_uuid != UUID::fromOptionalData(&cache_uuid, 16))
return;
-
+ const bool pinned = dyld_shared_cache_pin_mapping(shared_cache);
dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) {
uuid_t dsc_image_uuid;
if (found_image)
@@ -2768,6 +2768,8 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
nlist_count = nlistCount;
});
});
+ if (pinned)
+ dyld_shared_cache_unpin_mapping(shared_cache);
});
if (nlist_buffer) {
DataExtractor dsc_local_symbols_data(nlist_buffer,
More information about the lldb-commits
mailing list