[Lldb-commits] [lldb] r330877 - [debugserver] Return 'ios' instead of 'iphoneos' for the ostype.

Frederic Riss via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 25 15:12:12 PDT 2018


Author: friss
Date: Wed Apr 25 15:12:12 2018
New Revision: 330877

URL: http://llvm.org/viewvc/llvm-project?rev=330877&view=rev
Log:
[debugserver] Return 'ios' instead of 'iphoneos' for the ostype.

When I merged the 2 codepaths that return an OS type, I hade
checked that the places accepting 'iphoneos' would also accept
'ios', but then I got it backwards and return 'iphoneos'.

We use this value to build triples, and there 'iphoneos' is
invalid.

This also makes the test slightly simpler.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
    lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=330877&r1=330876&r2=330877&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py Wed Apr 25 15:12:12 2018
@@ -13,14 +13,14 @@ class TestAppleSimulatorOSType(gdbremote
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def check_simulator_ostype(self, sdk, platform_names, arch='x86_64'):
+    def check_simulator_ostype(self, sdk, platform, arch='x86_64'):
         sim_devices_str = subprocess.check_output(['xcrun', 'simctl', 'list',
                                                    '-j', 'devices'])
         sim_devices = json.loads(sim_devices_str)['devices']
         # Find an available simulator for the requested platform
         deviceUDID = None
         for (runtime,devices) in sim_devices.items():
-            if not any(p in runtime.lower() for p in platform_names):
+            if not platform in runtime.lower():
                 continue
             for device in devices:
                 if device['availability'] != '(available)':
@@ -32,7 +32,7 @@ class TestAppleSimulatorOSType(gdbremote
 
         # Launch the process using simctl
         self.assertIsNotNone(deviceUDID)
-        exe_name = 'test_simulator_platform_{}'.format(platform_names[0])
+        exe_name = 'test_simulator_platform_{}'.format(platform)
         sdkroot = subprocess.check_output(['xcrun', '--show-sdk-path', '--sdk',
                                            sdk])
         self.build(dictionary={ 'EXE': exe_name, 'SDKROOT': sdkroot.strip(),
@@ -75,7 +75,7 @@ class TestAppleSimulatorOSType(gdbremote
         self.assertIsNotNone(process_info)
 
         # Check that ostype is correct
-        self.assertTrue(process_info['ostype'] in platform_names)
+        self.assertEquals(process_info['ostype'], platform)
 
         # Now for dylibs
         dylib_info_raw = context.get("dylib_info_raw")
@@ -90,23 +90,23 @@ class TestAppleSimulatorOSType(gdbremote
             break
 
         self.assertIsNotNone(image_info)
-        self.assertTrue(image['min_version_os_name'] in platform_names)
+        self.assertEquals(image['min_version_os_name'], platform)
 
 
     @apple_simulator_test('iphone')
     @debugserver_test
     def test_simulator_ostype_ios(self):
         self.check_simulator_ostype(sdk='iphonesimulator',
-                                    platform_names=['iphoneos', 'ios'])
+                                    platform='ios')
 
     @apple_simulator_test('appletv')
     @debugserver_test
     def test_simulator_ostype_tvos(self):
         self.check_simulator_ostype(sdk='appletvsimulator',
-                                    platform_names=['tvos'])
+                                    platform='tvos')
 
     @apple_simulator_test('watch')
     @debugserver_test
     def test_simulator_ostype_watchos(self):
         self.check_simulator_ostype(sdk='watchsimulator',
-                                    platform_names=['watchos'], arch='i386')
+                                    platform='watchos', arch='i386')

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=330877&r1=330876&r2=330877&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Wed Apr 25 15:12:12 2018
@@ -595,7 +595,7 @@ const char *MachProcess::GetDeploymentIn
 
     switch (cmd) {
     case LC_VERSION_MIN_IPHONEOS:
-      return "iphoneos";
+      return "ios";
     case LC_VERSION_MIN_MACOSX:
       return "macosx";
     case LC_VERSION_MIN_TVOS:
@@ -621,7 +621,7 @@ const char *MachProcess::GetDeploymentIn
     case PLATFORM_MACOS:
       return "macosx";
     case PLATFORM_IOS:
-      return "iphoneos";
+      return "ios";
     case PLATFORM_TVOS:
       return "tvos";
     case PLATFORM_WATCHOS:




More information about the lldb-commits mailing list