summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-09-04 17:23:15 +0000
committerAdrian Prantl <aprantl@apple.com>2019-09-04 17:23:15 +0000
commit2461061168f4ac4ca8a1823768a00d1c63355b1b (patch)
tree4e38a76bbb1f43efde95d83428162d3cafeb3469 /lldb/source/Plugins/Process/gdb-remote
parent40fe351cf699eda8d7d9a72c7bbbb37cef7f3164 (diff)
downloadbcm5719-llvm-2461061168f4ac4ca8a1823768a00d1c63355b1b.tar.gz
bcm5719-llvm-2461061168f4ac4ca8a1823768a00d1c63355b1b.zip
Upstream macCatalyst support in debugserver and the macOS dynamic loader
plugin. Unfortunately the test is currently XFAILed because of missing changes to the clang driver. Differential Revision: https://reviews.llvm.org/D67124 llvm-svn: 370931
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp28
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp9
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h1
5 files changed, 43 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index b00ecd7a5f3..40a88fb7de7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -931,6 +931,11 @@ llvm::VersionTuple GDBRemoteCommunicationClient::GetOSVersion() {
return m_os_version;
}
+llvm::VersionTuple GDBRemoteCommunicationClient::GetMacCatalystVersion() {
+ GetHostInfo();
+ return m_maccatalyst_version;
+}
+
bool GDBRemoteCommunicationClient::GetOSBuildString(std::string &s) {
if (GetHostInfo()) {
if (!m_os_build.empty()) {
@@ -1133,6 +1138,7 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
uint32_t sub = 0;
std::string arch_name;
std::string os_name;
+ std::string environment;
std::string vendor_name;
std::string triple;
std::string distribution_id;
@@ -1172,7 +1178,11 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
extractor.GetHexByteString(m_os_kernel);
++num_keys_decoded;
} else if (name.equals("ostype")) {
- os_name = value;
+ if (value.equals("maccatalyst")) {
+ os_name = "ios";
+ environment = "macabi";
+ } else
+ os_name = value;
++num_keys_decoded;
} else if (name.equals("vendor")) {
vendor_name = value;
@@ -1196,6 +1206,9 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
{
if (!m_os_version.tryParse(value))
++num_keys_decoded;
+ } else if (name.equals("maccatalyst_version")) {
+ if (!m_maccatalyst_version.tryParse(value))
+ ++num_keys_decoded;
} else if (name.equals("watchpoint_exceptions_received")) {
m_watchpoints_trigger_after_instruction =
llvm::StringSwitch<LazyBool>(value)
@@ -1233,6 +1246,8 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
llvm::StringRef(vendor_name));
if (!os_name.empty())
m_host_arch.GetTriple().setOSName(llvm::StringRef(os_name));
+ if (!environment.empty())
+ m_host_arch.GetTriple().setEnvironmentName(environment);
}
} else {
std::string triple;
@@ -1985,6 +2000,7 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
uint32_t sub = 0;
std::string arch_name;
std::string os_name;
+ std::string environment;
std::string vendor_name;
std::string triple;
std::string elf_abi;
@@ -2005,7 +2021,11 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
extractor.GetHexByteString(triple);
++num_keys_decoded;
} else if (name.equals("ostype")) {
- os_name = value;
+ if (value.equals("maccatalyst")) {
+ os_name = "ios";
+ environment = "macabi";
+ } else
+ os_name = value;
++num_keys_decoded;
} else if (name.equals("vendor")) {
vendor_name = value;
@@ -2046,6 +2066,8 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
} else if (cpu != LLDB_INVALID_CPUTYPE && !os_name.empty() &&
!vendor_name.empty()) {
llvm::Triple triple(llvm::Twine("-") + vendor_name + "-" + os_name);
+ if (!environment.empty())
+ triple.setEnvironmentName(environment);
assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat);
assert(triple.getObjectFormat() != llvm::Triple::Wasm);
@@ -2077,8 +2099,10 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
}
m_process_arch.GetTriple().setVendorName(llvm::StringRef(vendor_name));
m_process_arch.GetTriple().setOSName(llvm::StringRef(os_name));
+ m_process_arch.GetTriple().setEnvironmentName(llvm::StringRef(environment));
m_host_arch.GetTriple().setVendorName(llvm::StringRef(vendor_name));
m_host_arch.GetTriple().setOSName(llvm::StringRef(os_name));
+ m_host_arch.GetTriple().setEnvironmentName(llvm::StringRef(environment));
}
return true;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index de85c9f8b67..daee6805952 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -248,6 +248,8 @@ public:
llvm::VersionTuple GetOSVersion();
+ llvm::VersionTuple GetMacCatalystVersion();
+
bool GetOSBuildString(std::string &s);
bool GetOSKernelDescription(std::string &s);
@@ -548,6 +550,7 @@ protected:
ArchSpec m_host_arch;
ArchSpec m_process_arch;
llvm::VersionTuple m_os_version;
+ llvm::VersionTuple m_maccatalyst_version;
std::string m_os_build;
std::string m_os_kernel;
std::string m_hostname;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index 7c84bf418b9..d0ae5191efd 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -260,6 +260,15 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo(
response.PutChar(';');
}
+#if defined(__APPLE__)
+ llvm::VersionTuple maccatalyst_version = HostInfo::GetMacCatalystVersion();
+ if (!maccatalyst_version.empty()) {
+ response.Format("maccatalyst_version:{0}",
+ maccatalyst_version.getAsString());
+ response.PutChar(';');
+ }
+#endif
+
std::string s;
if (HostInfo::GetOSBuildString(s)) {
response.PutCString("os_build:");
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 69bcd8a21cd..fee7b3fd880 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4320,6 +4320,10 @@ llvm::VersionTuple ProcessGDBRemote::GetHostOSVersion() {
return m_gdb_comm.GetOSVersion();
}
+llvm::VersionTuple ProcessGDBRemote::GetHostMacCatalystVersion() {
+ return m_gdb_comm.GetMacCatalystVersion();
+}
+
namespace {
typedef std::vector<std::string> stringVec;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 1411469780b..84004c19566 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -199,6 +199,7 @@ public:
const llvm::Triple &triple) override;
llvm::VersionTuple GetHostOSVersion() override;
+ llvm::VersionTuple GetHostMacCatalystVersion() override;
llvm::Error LoadModules() override;
OpenPOWER on IntegriCloud