[PATCH] D82394: [debugserver] Initial support for Apple Silicon.

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 10:43:13 PDT 2020


davide created this revision.
davide added reviewers: friss, jasonmolenda, jingham.
davide added a subscriber: lldb-commits.
aprantl accepted this revision.
This revision is now accepted and ready to land.

Set the correct os type in the arch triple when running macOS. Debugserver currently always assumes macOS == x86_64. This patch generalizes the support to make sure it works on a different architecture.


https://reviews.llvm.org/D82394

Files:
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===================================================================
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4908,6 +4908,8 @@
     strm << "ostype:watchos;";
 #elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
     strm << "ostype:bridgeos;";
+#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
+    strm << "ostype:macosx;";
 #else
     strm << "ostype:ios;";
 #endif
@@ -6336,7 +6338,7 @@
   if (addr_size > 0) {
     rep << "ptrsize:" << std::dec << addr_size << ';';
 
-#if (defined(__x86_64__) || defined(__i386__))
+#if defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
     // Try and get the OS type by looking at the load commands in the main
     // executable and looking for a LC_VERSION_MIN load command. This is the
     // most reliable way to determine the "ostype" value when on desktop.
@@ -6366,7 +6368,7 @@
         load_command_addr = load_command_addr + lc.cmdsize;
       }
     }
-#endif // when compiling this on x86 targets
+#endif // TARGET_OS_OSX
   }
 
   // If we weren't able to find the OS in a LC_VERSION_MIN load command, try
@@ -6383,6 +6385,8 @@
       rep << "ostype:watchos;";
 #elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
       rep << "ostype:bridgeos;";
+#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
+      rep << "ostype:macosx;";
 #else
       rep << "ostype:ios;";
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82394.272767.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200623/38e6423a/attachment.bin>


More information about the llvm-commits mailing list