[Lldb-commits] [lldb] [lldb][Darwin] Fetch detailed binary info in chunks (PR #190720)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 7 11:37:50 PDT 2026


================
@@ -413,26 +440,43 @@ void DynamicLoaderMacOS::AddBinaries(
   Log *log = GetLog(LLDBLog::DynamicLoader);
   ImageInfo::collection image_infos;
 
-  LLDB_LOGF(log, "Adding %" PRId64 " modules.",
-            (uint64_t)load_addresses.size());
-  StructuredData::ObjectSP binaries_info_sp =
-      m_process->GetLoadedDynamicLibrariesInfos(load_addresses);
-  if (binaries_info_sp.get() && binaries_info_sp->GetAsDictionary() &&
-      binaries_info_sp->GetAsDictionary()->HasKey("images") &&
-      binaries_info_sp->GetAsDictionary()
-          ->GetValueForKey("images")
-          ->GetAsArray() &&
-      binaries_info_sp->GetAsDictionary()
-              ->GetValueForKey("images")
-              ->GetAsArray()
-              ->GetSize() == load_addresses.size()) {
-    if (JSONImageInformationIntoImageInfo(binaries_info_sp, image_infos)) {
-      auto images = PreloadModulesFromImageInfos(image_infos);
-      UpdateSpecialBinariesFromPreloadedModules(images);
-      AddModulesUsingPreloadedModules(images);
+  const size_t image_fetch_max = 600;
+  std::vector<addr_t> fetch_binaries;
+  size_t fetched = 0;
+  size_t total_image_size = load_addresses.size();
+  fetch_binaries.reserve(std::min(image_fetch_max, total_image_size));
+  while (fetched < total_image_size) {
+    size_t this_fetch_amt =
+        std::min(image_fetch_max, total_image_size - fetched);
+    fetch_binaries.resize(this_fetch_amt);
+    // `addr_t* + num_elem` -- pointer math is addr_t sized.
+    const addr_t *this_chunk_start = load_addresses.data() + fetched;
----------------
bulbazord wrote:

Doesn't this presuppose that the target and the host are using the same sized pointers? It might be better to write this independent of pointer size so semantics never shift under our feet.

https://github.com/llvm/llvm-project/pull/190720


More information about the lldb-commits mailing list