Author: jmolenda Date: Tue Feb 6 17:28:29 2018 New Revision: 324437 URL: http://llvm.org/viewvc/llvm-project?rev=324437&view=rev Log: lldb running on an ios device is using the _dyld_get_all_image_infos() SPI call to to find its own shared cache's UUID. On newer sytems we need to use the a new SPI which will return the UUID directly.
<rdar://problem/36625871> Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=324437&r1=324436&r2=324437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Feb 6 17:28:29 2018 @@ -2113,6 +2113,11 @@ UUID ObjectFileMachO::GetSharedCacheUUID sizeof(uuid_t)); dsc_uuid.SetBytes(uuid_bytes); } + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + if (log && dsc_uuid.IsValid()) { + log->Printf("Shared cache %s has UUID %s", dyld_shared_cache.GetPath().c_str(), + dsc_uuid.GetAsString().c_str()); + } return dsc_uuid; } @@ -5684,6 +5689,9 @@ UUID ObjectFileMachO::GetProcessSharedCa dl->GetSharedCacheInformation(load_address, uuid, using_shared_cache, private_shared_cache); } + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS)); + if (log) + log->Printf("inferior process shared cache has a UUID of %s", uuid.GetAsString().c_str()); return uuid; } @@ -5714,7 +5722,20 @@ UUID ObjectFileMachO::GetLLDBSharedCache uuid.SetBytes(sharedCacheUUID_address); } } + } else { + // Exists in macOS 10.12 and later, iOS 10.0 and later - dyld SPI + bool *(*dyld_get_shared_cache_uuid)(uuid_t); + dyld_get_shared_cache_uuid = (bool *(*)(uuid_t)) + dlsym(RTLD_DEFAULT, "_dyld_get_shared_cache_uuid"); + if (dyld_get_shared_cache_uuid) { + uuid_t tmp_uuid; + if (dyld_get_shared_cache_uuid(tmp_uuid)) + uuid.SetBytes(tmp_uuid); + } } + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS)); + if (log && uuid.IsValid()) + log->Printf("lldb's in-memory shared cache has a UUID of %s", uuid.GetAsString().c_str()); #endif return uuid; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits