diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2022-02-11 15:25:12 -0800 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2022-02-11 15:26:33 -0800 |
commit | af969141fa285157044e34fb6b27963c3278241b (patch) | |
tree | 98d452516620164726837be431837bb8716e91c6 | |
parent | da2a16f702efe3307d407d5c6db6c8c18ef6bd9b (diff) |
[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
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 10137e714861..131d1932fe14 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, |