aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2016-07-22 00:17:55 +0000
committerJason Molenda <jmolenda@apple.com>2016-07-22 00:17:55 +0000
commit37397353cc610d47c566ad8fba16f36224a514c8 (patch)
tree9389efe67b1a38d5657901f7ae06344dccf61391 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parent0e2cec075c98fe33623229dcb6ee6275f2897de4 (diff)
downloadllvm-37397353cc610d47c566ad8fba16f36224a514c8.zip
llvm-37397353cc610d47c566ad8fba16f36224a514c8.tar.gz
llvm-37397353cc610d47c566ad8fba16f36224a514c8.tar.bz2
Add support to get the shared cache information from the new
debugserver jGetSharedCacheInfo packet instead of reading the dyld internal data structures directly. This code is (currently) only used for ios native lldb's - I should really move this ObjectFileMachO::GetProcessSharedCacheUUID method somewhere else, it makes less and less sense being in the file reader. <rdar://problem/25251243> llvm-svn: 276369
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 5f82422..2f2d34d 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -5449,6 +5449,33 @@ UUID
ObjectFileMachO::GetProcessSharedCacheUUID (Process *process)
{
UUID uuid;
+
+ // First see if we can get the shared cache details from debugserver
+ if (process)
+ {
+ StructuredData::ObjectSP info = process->GetSharedCacheInfo();
+ StructuredData::Dictionary *info_dict = nullptr;
+ if (info.get() && info->GetAsDictionary())
+ {
+ info_dict = info->GetAsDictionary();
+ }
+
+ // {"shared_cache_base_address":140735683125248,"shared_cache_uuid":"DDB8D70C-C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false}
+
+ if (info_dict
+ && info_dict->HasKey("shared_cache_uuid")
+ && info_dict->HasKey("no_shared_cache")
+ && info_dict->HasKey("shared_cache_base_address"))
+ {
+ bool process_using_shared_cache = info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() == false;
+ std::string uuid_str = info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue();
+
+ if (process_using_shared_cache && !uuid_str.empty() && uuid.SetFromCString (uuid_str.c_str()) == 0)
+ return uuid;
+ }
+ }
+
+ // Fall back to trying to read the shared cache info out of dyld's internal data structures
if (process)
{
addr_t all_image_infos = process->GetImageInfoAddress();