summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/RNBRemote.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2018-03-06 00:27:41 +0000
committerJason Molenda <jmolenda@apple.com>2018-03-06 00:27:41 +0000
commita1bd9508e02c9c59dff0962e15abbbd1e0e677b7 (patch)
treeccedb9df015535f516654f6d3097b3da629e523c /lldb/tools/debugserver/source/RNBRemote.cpp
parent15e814f687e42c3bc41e6454c86087eb3373d39f (diff)
downloadbcm5719-llvm-a1bd9508e02c9c59dff0962e15abbbd1e0e677b7.tar.gz
bcm5719-llvm-a1bd9508e02c9c59dff0962e15abbbd1e0e677b7.zip
Upstreaming avx512 register support in debugserver. These changes
were originally written by Chris Bieneman, they've undergone a number of changes since then. Also including the debugserver bridgeos support, another arm environment that runs Darwin akin to ios. These codepaths are activated when running in a bridgeos environment which we're not set up to test today. There's additional (small) lldb changes to handle bridgeos binaries that still need to be merged up. Tested on a darwin system with avx512 hardware and without. <rdar://problem/36424951> llvm-svn: 326756
Diffstat (limited to 'lldb/tools/debugserver/source/RNBRemote.cpp')
-rw-r--r--lldb/tools/debugserver/source/RNBRemote.cpp61
1 files changed, 60 insertions, 1 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index cba00052d80..28792343bbc 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4651,6 +4651,8 @@ rnb_err_t RNBRemote::HandlePacket_qHostInfo(const char *p) {
strm << "ostype:tvos;";
#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
strm << "ostype:watchos;";
+#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
+ strm << "ostype:bridgeos;";
#else
strm << "ostype:ios;";
#endif
@@ -6130,8 +6132,61 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) {
}
load_command_addr = load_command_addr + lc.cmdsize;
}
+
+// Test that the PLATFORM_* defines are available from mach-o/loader.h
+#if defined (PLATFORM_MACOS)
+ for (uint32_t i = 0; i < mh.ncmds && !os_handled; ++i)
+ {
+ nub_size_t bytes_read =
+ DNBProcessMemoryRead(pid, load_command_addr, sizeof(lc), &lc);
+ uint32_t raw_cmd = lc.cmd & ~LC_REQ_DYLD;
+ if (bytes_read != sizeof(lc))
+ break;
+
+ if (raw_cmd == LC_BUILD_VERSION)
+ {
+ uint32_t platform; // first field of 'struct build_version_command'
+ bytes_read = DNBProcessMemoryRead(pid, load_command_addr + 8, sizeof(platform), &platform);
+ if (bytes_read != sizeof (platform))
+ break;
+ switch (platform)
+ {
+ case PLATFORM_MACOS:
+ os_handled = true;
+ rep << "ostype:macosx;";
+ DNBLogThreadedIf(LOG_RNB_PROC,
+ "LC_BUILD_VERSION PLATFORM_MACOS -> 'ostype:macosx;'");
+ break;
+ case PLATFORM_IOS:
+ os_handled = true;
+ rep << "ostype:ios;";
+ DNBLogThreadedIf(LOG_RNB_PROC,
+ "LC_BUILD_VERSION PLATFORM_IOS -> 'ostype:ios;'");
+ break;
+ case PLATFORM_TVOS:
+ os_handled = true;
+ rep << "ostype:tvos;";
+ DNBLogThreadedIf(LOG_RNB_PROC,
+ "LC_BUILD_VERSION PLATFORM_TVOS -> 'ostype:tvos;'");
+ break;
+ case PLATFORM_WATCHOS:
+ os_handled = true;
+ rep << "ostype:watchos;";
+ DNBLogThreadedIf(LOG_RNB_PROC,
+ "LC_BUILD_VERSION PLATFORM_WATCHOS -> 'ostype:watchos;'");
+ break;
+ case PLATFORM_BRIDGEOS:
+ os_handled = true;
+ rep << "ostype:bridgeos;";
+ DNBLogThreadedIf(LOG_RNB_PROC,
+ "LC_BUILD_VERSION PLATFORM_BRIDGEOS -> 'ostype:bridgeos;'");
+ break;
+ }
}
-#endif
+ }
+#endif // PLATFORM_MACOS
+ }
+#endif // when compiling this on x86 targets
}
// If we weren't able to find the OS in a LC_VERSION_MIN load command, try
@@ -6145,6 +6200,8 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) {
rep << "ostype:tvos;";
#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
rep << "ostype:watchos;";
+#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
+ rep << "ostype:bridgeos;";
#else
rep << "ostype:ios;";
#endif
@@ -6196,6 +6253,8 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) {
rep << "ostype:tvos;";
#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
rep << "ostype:watchos;";
+#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
+ rep << "ostype:bridgeos;";
#else
rep << "ostype:ios;";
#endif
OpenPOWER on IntegriCloud