summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachProcess.h2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachProcess.mm45
2 files changed, 47 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
index 7e361172ce7..094c13b8f0a 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -69,6 +69,8 @@ public:
struct mach_header_64 mach_header;
std::vector<struct mach_o_segment> segments;
uuid_t uuid;
+ std::string min_version_os_name;
+ std::string min_version_os_version;
};
struct binary_image_information
diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index fc796376b01..c5d1ce0942f 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -631,6 +631,44 @@ MachProcess::GetMachOInformationFromMemory (nub_addr_t mach_o_header_addr, int w
if (ReadMemory (load_cmds_p, sizeof (struct uuid_command), &uuidcmd) == sizeof (struct uuid_command))
uuid_copy (inf.uuid, uuidcmd.uuid);
}
+ if (lc.cmd == LC_VERSION_MIN_IPHONEOS || lc.cmd == LC_VERSION_MIN_MACOSX
+ || lc.cmd == LC_VERSION_MIN_WATCHOS || lc.cmd == LC_VERSION_MIN_TVOS)
+ {
+ struct version_min_command vers_cmd;
+ if (ReadMemory (load_cmds_p, sizeof (struct version_min_command), &vers_cmd) != sizeof (struct version_min_command))
+ {
+ return false;
+ }
+ switch (lc.cmd)
+ {
+ case LC_VERSION_MIN_IPHONEOS:
+ inf.min_version_os_name = "iphoneos";
+ break;
+ case LC_VERSION_MIN_MACOSX:
+ inf.min_version_os_name = "macosx";
+ break;
+ case LC_VERSION_MIN_TVOS:
+ inf.min_version_os_name = "tvos";
+ break;
+ case LC_VERSION_MIN_WATCHOS:
+ inf.min_version_os_name = "watchos";
+ break;
+ default:
+ return false;
+ }
+ uint32_t xxxx = vers_cmd.sdk >> 16;
+ uint32_t yy = (vers_cmd.sdk >> 8) & 0xffu;
+ uint32_t zz = vers_cmd.sdk & 0xffu;
+ inf.min_version_os_version = "";
+ inf.min_version_os_version += std::to_string(xxxx);
+ inf.min_version_os_version += ".";
+ inf.min_version_os_version += std::to_string(yy);
+ if (zz != 0)
+ {
+ inf.min_version_os_version += ".";
+ inf.min_version_os_version += std::to_string(zz);
+ }
+ }
load_cmds_p += lc.cmdsize;
}
return true;
@@ -657,6 +695,13 @@ MachProcess::FormatDynamicLibrariesIntoJSON (const std::vector<struct binary_ima
uuid_unparse_upper (image_infos[i].macho_info.uuid, uuidstr);
image_info_dict_sp->AddStringItem ("uuid", uuidstr);
+ if (image_infos[i].macho_info.min_version_os_name.empty() == false
+ && image_infos[i].macho_info.min_version_os_version.empty() == false)
+ {
+ image_info_dict_sp->AddStringItem ("min_version_os_name", image_infos[i].macho_info.min_version_os_name);
+ image_info_dict_sp->AddStringItem ("min_version_os_sdk", image_infos[i].macho_info.min_version_os_version);
+ }
+
JSONGenerator::DictionarySP mach_header_dict_sp (new JSONGenerator::Dictionary());
mach_header_dict_sp->AddIntegerItem ("magic", image_infos[i].macho_info.mach_header.magic);
mach_header_dict_sp->AddIntegerItem ("cputype", (uint32_t) image_infos[i].macho_info.mach_header.cputype);
OpenPOWER on IntegriCloud