1 //===-- PlatformRemoteiOS.cpp -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "PlatformRemoteiOS.h"
11 
12 // C Includes
13 // C++ Includes
14 // Other libraries and framework includes
15 // Project includes
16 #include "lldb/Breakpoint/BreakpointLocation.h"
17 #include "lldb/Core/ArchSpec.h"
18 #include "lldb/Core/Error.h"
19 #include "lldb/Core/Module.h"
20 #include "lldb/Core/ModuleList.h"
21 #include "lldb/Core/PluginManager.h"
22 #include "lldb/Core/StreamString.h"
23 #include "lldb/Host/FileSpec.h"
24 #include "lldb/Host/Host.h"
25 #include "lldb/Target/Process.h"
26 #include "lldb/Target/Target.h"
27 
28 using namespace lldb;
29 using namespace lldb_private;
30 
31 PlatformRemoteiOS::SDKDirectoryInfo::SDKDirectoryInfo (const lldb_private::FileSpec &sdk_dir) :
32     directory(sdk_dir),
33     build(),
34     version_major(0),
35     version_minor(0),
36     version_update(0),
37     user_cached(false)
38 {
39     const char *dirname_cstr = sdk_dir.GetFilename().GetCString();
40     const char *pos = Args::StringToVersion (dirname_cstr,
41                                              version_major,
42                                              version_minor,
43                                              version_update);
44 
45     if (pos && pos[0] == ' ' && pos[1] == '(')
46     {
47         const char *build_start = pos + 2;
48         const char *end_paren = strchr (build_start, ')');
49         if (end_paren && build_start < end_paren)
50             build.SetCStringWithLength(build_start, end_paren - build_start);
51     }
52 }
53 
54 //------------------------------------------------------------------
55 // Static Variables
56 //------------------------------------------------------------------
57 static uint32_t g_initialize_count = 0;
58 
59 //------------------------------------------------------------------
60 // Static Functions
61 //------------------------------------------------------------------
62 void
63 PlatformRemoteiOS::Initialize ()
64 {
65     if (g_initialize_count++ == 0)
66     {
67         PluginManager::RegisterPlugin (PlatformRemoteiOS::GetShortPluginNameStatic(),
68                                        PlatformRemoteiOS::GetDescriptionStatic(),
69                                        PlatformRemoteiOS::CreateInstance);
70     }
71 }
72 
73 void
74 PlatformRemoteiOS::Terminate ()
75 {
76     if (g_initialize_count > 0)
77     {
78         if (--g_initialize_count == 0)
79         {
80             PluginManager::UnregisterPlugin (PlatformRemoteiOS::CreateInstance);
81         }
82     }
83 }
84 
85 Platform*
86 PlatformRemoteiOS::CreateInstance (bool force, const ArchSpec *arch)
87 {
88     bool create = force;
89     if (create == false && arch && arch->IsValid())
90     {
91         switch (arch->GetMachine())
92         {
93         case llvm::Triple::arm:
94         case llvm::Triple::thumb:
95             {
96                 const llvm::Triple &triple = arch->GetTriple();
97                 const llvm::Triple::OSType os = triple.getOS();
98                 const llvm::Triple::VendorType vendor = triple.getVendor();
99                 if (os == llvm::Triple::Darwin && vendor == llvm::Triple::Apple)
100                     create = true;
101             }
102             break;
103         default:
104             break;
105         }
106     }
107 
108     if (create)
109         return new PlatformRemoteiOS ();
110     return NULL;
111 }
112 
113 
114 const char *
115 PlatformRemoteiOS::GetPluginNameStatic ()
116 {
117     return "PlatformRemoteiOS";
118 }
119 
120 const char *
121 PlatformRemoteiOS::GetShortPluginNameStatic()
122 {
123     return "remote-ios";
124 }
125 
126 const char *
127 PlatformRemoteiOS::GetDescriptionStatic()
128 {
129     return "Remote iOS platform plug-in.";
130 }
131 
132 
133 //------------------------------------------------------------------
134 /// Default Constructor
135 //------------------------------------------------------------------
136 PlatformRemoteiOS::PlatformRemoteiOS () :
137     PlatformDarwin (false),    // This is a remote platform
138     m_sdk_directory_infos(),
139     m_device_support_directory(),
140     m_device_support_directory_for_os_version (),
141     m_build_update(),
142     m_last_module_sdk_idx(UINT32_MAX)
143 {
144 }
145 
146 //------------------------------------------------------------------
147 /// Destructor.
148 ///
149 /// The destructor is virtual since this class is designed to be
150 /// inherited from by the plug-in instance.
151 //------------------------------------------------------------------
152 PlatformRemoteiOS::~PlatformRemoteiOS()
153 {
154 }
155 
156 
157 void
158 PlatformRemoteiOS::GetStatus (Stream &strm)
159 {
160     Platform::GetStatus (strm);
161     const char *sdk_directory = GetDeviceSupportDirectoryForOSVersion();
162     if (sdk_directory)
163         strm.Printf ("  SDK Path: \"%s\"\n", sdk_directory);
164     else
165         strm.PutCString ("  SDK Path: error: unable to locate SDK\n");
166 
167     const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
168     for (uint32_t i=0; i<num_sdk_infos; ++i)
169     {
170         const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
171         strm.Printf (" SDK Roots: [%2u] \"%s/%s\"\n",
172                      i,
173                      sdk_dir_info.directory.GetDirectory().GetCString(),
174                      sdk_dir_info.directory.GetFilename().GetCString());
175     }
176 }
177 
178 
179 Error
180 PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file,
181                                       const ArchSpec &exe_arch,
182                                       lldb::ModuleSP &exe_module_sp,
183                                       const FileSpecList *module_search_paths_ptr)
184 {
185     Error error;
186     // Nothing special to do here, just use the actual file and architecture
187 
188     FileSpec resolved_exe_file (exe_file);
189 
190     // If we have "ls" as the exe_file, resolve the executable loation based on
191     // the current path variables
192     // TODO: resolve bare executables in the Platform SDK
193 //    if (!resolved_exe_file.Exists())
194 //        resolved_exe_file.ResolveExecutableLocation ();
195 
196     // Resolve any executable within a bundle on MacOSX
197     // TODO: verify that this handles shallow bundles, if not then implement one ourselves
198     Host::ResolveExecutableInBundle (resolved_exe_file);
199 
200     if (resolved_exe_file.Exists())
201     {
202         if (exe_arch.IsValid())
203         {
204             ModuleSpec module_spec (resolved_exe_file, exe_arch);
205             error = ModuleList::GetSharedModule (module_spec,
206                                                  exe_module_sp,
207                                                  NULL,
208                                                  NULL,
209                                                  NULL);
210 
211             if (exe_module_sp && exe_module_sp->GetObjectFile())
212                 return error;
213             exe_module_sp.reset();
214         }
215         // No valid architecture was specified or the exact ARM slice wasn't
216         // found so ask the platform for the architectures that we should be
217         // using (in the correct order) and see if we can find a match that way
218         StreamString arch_names;
219         ArchSpec platform_arch;
220         for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
221         {
222             ModuleSpec module_spec (resolved_exe_file, platform_arch);
223             error = ModuleList::GetSharedModule (module_spec,
224                                                  exe_module_sp,
225                                                  NULL,
226                                                  NULL,
227                                                  NULL);
228             // Did we find an executable using one of the
229             if (error.Success())
230             {
231                 if (exe_module_sp && exe_module_sp->GetObjectFile())
232                     break;
233                 else
234                     error.SetErrorToGenericError();
235             }
236 
237             if (idx > 0)
238                 arch_names.PutCString (", ");
239             arch_names.PutCString (platform_arch.GetArchitectureName());
240         }
241 
242         if (error.Fail() || !exe_module_sp)
243         {
244             error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
245                                             exe_file.GetDirectory().AsCString(""),
246                                             exe_file.GetDirectory() ? "/" : "",
247                                             exe_file.GetFilename().AsCString(""),
248                                             GetShortPluginName(),
249                                             arch_names.GetString().c_str());
250         }
251     }
252     else
253     {
254         error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
255                                         exe_file.GetDirectory().AsCString(""),
256                                         exe_file.GetDirectory() ? "/" : "",
257                                         exe_file.GetFilename().AsCString(""));
258     }
259 
260     return error;
261 }
262 
263 FileSpec::EnumerateDirectoryResult
264 PlatformRemoteiOS::GetContainedFilesIntoVectorOfStringsCallback (void *baton,
265                                                                  FileSpec::FileType file_type,
266                                                                  const FileSpec &file_spec)
267 {
268     ((PlatformRemoteiOS::SDKDirectoryInfoCollection *)baton)->push_back(PlatformRemoteiOS::SDKDirectoryInfo(file_spec));
269     return FileSpec::eEnumerateDirectoryResultNext;
270 }
271 
272 bool
273 PlatformRemoteiOS::UpdateSDKDirectoryInfosInNeeded()
274 {
275     if (m_sdk_directory_infos.empty())
276     {
277         const char *device_support_dir = GetDeviceSupportDirectory();
278         if (device_support_dir)
279         {
280             const bool find_directories = true;
281             const bool find_files = false;
282             const bool find_other = false;
283             FileSpec::EnumerateDirectory (m_device_support_directory.c_str(),
284                                           find_directories,
285                                           find_files,
286                                           find_other,
287                                           GetContainedFilesIntoVectorOfStringsCallback,
288                                           &m_sdk_directory_infos);
289 
290             const uint32_t num_installed = m_sdk_directory_infos.size();
291             FileSpec local_sdk_cache("~/Library/Developer/Xcode/iOS DeviceSupport", true);
292             if (local_sdk_cache.Exists())
293             {
294                 char path[PATH_MAX];
295                 if (local_sdk_cache.GetPath(path, sizeof(path)))
296                 {
297                     FileSpec::EnumerateDirectory (path,
298                                                   find_directories,
299                                                   find_files,
300                                                   find_other,
301                                                   GetContainedFilesIntoVectorOfStringsCallback,
302                                                   &m_sdk_directory_infos);
303                     const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
304                     // First try for an exact match of major, minor and update
305                     for (uint32_t i=num_installed; i<num_sdk_infos; ++i)
306                     {
307                         m_sdk_directory_infos[i].user_cached = true;
308                     }
309                 }
310             }
311         }
312     }
313     return !m_sdk_directory_infos.empty();
314 }
315 
316 const PlatformRemoteiOS::SDKDirectoryInfo *
317 PlatformRemoteiOS::GetSDKDirectoryForCurrentOSVersion ()
318 {
319     uint32_t i;
320     if (UpdateSDKDirectoryInfosInNeeded())
321     {
322         const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
323 
324         // Check to see if the user specified a build string. If they did, then
325         // be sure to match it.
326         std::vector<bool> check_sdk_info(num_sdk_infos, true);
327         ConstString build(m_sdk_build);
328         if (build)
329         {
330             for (i=0; i<num_sdk_infos; ++i)
331                 check_sdk_info[i] = m_sdk_directory_infos[i].build == build;
332         }
333 
334         // If we are connected we can find the version of the OS the platform
335         // us running on and select the right SDK
336         uint32_t major, minor, update;
337         if (GetOSVersion(major, minor, update))
338         {
339             if (UpdateSDKDirectoryInfosInNeeded())
340             {
341                 // First try for an exact match of major, minor and update
342                 for (i=0; i<num_sdk_infos; ++i)
343                 {
344                     if (check_sdk_info[i])
345                     {
346                         if (m_sdk_directory_infos[i].version_major == major &&
347                             m_sdk_directory_infos[i].version_minor == minor &&
348                             m_sdk_directory_infos[i].version_update == update)
349                         {
350                             return &m_sdk_directory_infos[i];
351                         }
352                     }
353                 }
354                 // First try for an exact match of major and minor
355                 for (i=0; i<num_sdk_infos; ++i)
356                 {
357                     if (check_sdk_info[i])
358                     {
359                         if (m_sdk_directory_infos[i].version_major == major &&
360                             m_sdk_directory_infos[i].version_minor == minor)
361                         {
362                             return &m_sdk_directory_infos[i];
363                         }
364                     }
365                 }
366                 // Lastly try to match of major version only..
367                 for (i=0; i<num_sdk_infos; ++i)
368                 {
369                     if (check_sdk_info[i])
370                     {
371                         if (m_sdk_directory_infos[i].version_major == major)
372                         {
373                             return &m_sdk_directory_infos[i];
374                         }
375                     }
376                 }
377             }
378         }
379         else if (build)
380         {
381             // No version, just a build number, search for the first one that matches
382             for (i=0; i<num_sdk_infos; ++i)
383                 if (check_sdk_info[i])
384                     return &m_sdk_directory_infos[i];
385         }
386     }
387     return NULL;
388 }
389 
390 const PlatformRemoteiOS::SDKDirectoryInfo *
391 PlatformRemoteiOS::GetSDKDirectoryForLatestOSVersion ()
392 {
393     const PlatformRemoteiOS::SDKDirectoryInfo *result = NULL;
394     if (UpdateSDKDirectoryInfosInNeeded())
395     {
396         const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
397         // First try for an exact match of major, minor and update
398         for (uint32_t i=0; i<num_sdk_infos; ++i)
399         {
400             const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
401             if (sdk_dir_info.version_major != UINT32_MAX)
402             {
403                 if (result == NULL || sdk_dir_info.version_major > result->version_major)
404                 {
405                     result = &sdk_dir_info;
406                 }
407                 else if (sdk_dir_info.version_major == result->version_major)
408                 {
409                     if (sdk_dir_info.version_minor > result->version_minor)
410                     {
411                         result = &sdk_dir_info;
412                     }
413                     else if (sdk_dir_info.version_minor == result->version_minor)
414                     {
415                         if (sdk_dir_info.version_update > result->version_update)
416                         {
417                             result = &sdk_dir_info;
418                         }
419                     }
420                 }
421             }
422         }
423     }
424     return result;
425 }
426 
427 
428 
429 const char *
430 PlatformRemoteiOS::GetDeviceSupportDirectory()
431 {
432     if (m_device_support_directory.empty())
433     {
434         const char *device_support_dir = GetDeveloperDirectory();
435         if (device_support_dir)
436         {
437             m_device_support_directory.assign (device_support_dir);
438             m_device_support_directory.append ("/Platforms/iPhoneOS.platform/DeviceSupport");
439         }
440         else
441         {
442             // Assign a single NULL character so we know we tried to find the device
443             // support directory and we don't keep trying to find it over and over.
444             m_device_support_directory.assign (1, '\0');
445         }
446     }
447     // We should have put a single NULL character into m_device_support_directory
448     // or it should have a valid path if the code gets here
449     assert (m_device_support_directory.empty() == false);
450     if (m_device_support_directory[0])
451         return m_device_support_directory.c_str();
452     return NULL;
453 }
454 
455 
456 const char *
457 PlatformRemoteiOS::GetDeviceSupportDirectoryForOSVersion()
458 {
459     if (m_sdk_sysroot)
460         return m_sdk_sysroot.GetCString();
461 
462     if (m_device_support_directory_for_os_version.empty())
463     {
464         const PlatformRemoteiOS::SDKDirectoryInfo *sdk_dir_info = GetSDKDirectoryForCurrentOSVersion ();
465         if (sdk_dir_info == NULL)
466             sdk_dir_info = GetSDKDirectoryForLatestOSVersion ();
467         if (sdk_dir_info)
468         {
469             char path[PATH_MAX];
470             if (sdk_dir_info->directory.GetPath(path, sizeof(path)))
471             {
472                 m_device_support_directory_for_os_version = path;
473                 return m_device_support_directory_for_os_version.c_str();
474             }
475         }
476         else
477         {
478             // Assign a single NULL character so we know we tried to find the device
479             // support directory and we don't keep trying to find it over and over.
480             m_device_support_directory_for_os_version.assign (1, '\0');
481         }
482     }
483     // We should have put a single NULL character into m_device_support_directory_for_os_version
484     // or it should have a valid path if the code gets here
485     assert (m_device_support_directory_for_os_version.empty() == false);
486     if (m_device_support_directory_for_os_version[0])
487         return m_device_support_directory_for_os_version.c_str();
488     return NULL;
489 }
490 
491 uint32_t
492 PlatformRemoteiOS::FindFileInAllSDKs (const char *platform_file_path,
493                                       FileSpecList &file_list)
494 {
495     if (platform_file_path && platform_file_path[0] && UpdateSDKDirectoryInfosInNeeded())
496     {
497         const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
498         lldb_private::FileSpec local_file;
499         // First try for an exact match of major, minor and update
500         for (uint32_t sdk_idx=0; sdk_idx<num_sdk_infos; ++sdk_idx)
501         {
502             if (GetFileInSDK (platform_file_path,
503                               sdk_idx,
504                               local_file))
505             {
506                 file_list.Append(local_file);
507             }
508         }
509     }
510     return file_list.GetSize();
511 }
512 
513 bool
514 PlatformRemoteiOS::GetFileInSDK (const char *platform_file_path,
515                                  uint32_t sdk_idx,
516                                  lldb_private::FileSpec &local_file)
517 {
518     if (sdk_idx < m_sdk_directory_infos.size())
519     {
520         char sdkroot_path[PATH_MAX];
521         const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[sdk_idx];
522         if (sdk_dir_info.directory.GetPath(sdkroot_path, sizeof(sdkroot_path)))
523         {
524             const bool symbols_dirs_only = true;
525 
526             return GetFileInSDKRoot (platform_file_path,
527                                      sdkroot_path,
528                                      symbols_dirs_only,
529                                      local_file);
530         }
531     }
532     return false;
533 }
534 
535 
536 bool
537 PlatformRemoteiOS::GetFileInSDKRoot (const char *platform_file_path,
538                                      const char *sdkroot_path,
539                                      bool symbols_dirs_only,
540                                      lldb_private::FileSpec &local_file)
541 {
542     if (sdkroot_path && sdkroot_path[0] && platform_file_path && platform_file_path[0])
543     {
544         char resolved_path[PATH_MAX];
545 
546         if (!symbols_dirs_only)
547         {
548             ::snprintf (resolved_path,
549                         sizeof(resolved_path),
550                         "%s/%s",
551                         sdkroot_path,
552                         platform_file_path);
553 
554             local_file.SetFile(resolved_path, true);
555             if (local_file.Exists())
556                 return true;
557         }
558 
559         ::snprintf (resolved_path,
560                     sizeof(resolved_path),
561                     "%s/Symbols.Internal/%s",
562                     sdkroot_path,
563                     platform_file_path);
564 
565         local_file.SetFile(resolved_path, true);
566         if (local_file.Exists())
567             return true;
568         ::snprintf (resolved_path,
569                     sizeof(resolved_path),
570                     "%s/Symbols/%s",
571                     sdkroot_path,
572                     platform_file_path);
573 
574         local_file.SetFile(resolved_path, true);
575         if (local_file.Exists())
576             return true;
577     }
578     return false;
579 }
580 
581 
582 Error
583 PlatformRemoteiOS::GetSymbolFile (const FileSpec &platform_file,
584                                   const UUID *uuid_ptr,
585                                   FileSpec &local_file)
586 {
587     Error error;
588     char platform_file_path[PATH_MAX];
589     if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path)))
590     {
591         char resolved_path[PATH_MAX];
592 
593         const char * os_version_dir = GetDeviceSupportDirectoryForOSVersion();
594         if (os_version_dir)
595         {
596             ::snprintf (resolved_path,
597                         sizeof(resolved_path),
598                         "%s/%s",
599                         os_version_dir,
600                         platform_file_path);
601 
602             local_file.SetFile(resolved_path, true);
603             if (local_file.Exists())
604                 return error;
605 
606             ::snprintf (resolved_path,
607                         sizeof(resolved_path),
608                         "%s/Symbols.Internal/%s",
609                         os_version_dir,
610                         platform_file_path);
611 
612             local_file.SetFile(resolved_path, true);
613             if (local_file.Exists())
614                 return error;
615             ::snprintf (resolved_path,
616                         sizeof(resolved_path),
617                         "%s/Symbols/%s",
618                         os_version_dir,
619                         platform_file_path);
620 
621             local_file.SetFile(resolved_path, true);
622             if (local_file.Exists())
623                 return error;
624 
625         }
626         local_file = platform_file;
627         if (local_file.Exists())
628             return error;
629 
630         error.SetErrorStringWithFormat ("unable to locate a platform file for '%s' in platform '%s'",
631                                         platform_file_path,
632                                         GetPluginName());
633     }
634     else
635     {
636         error.SetErrorString ("invalid platform file argument");
637     }
638     return error;
639 }
640 
641 Error
642 PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec,
643                                     ModuleSP &module_sp,
644                                     const FileSpecList *module_search_paths_ptr,
645                                     ModuleSP *old_module_sp_ptr,
646                                     bool *did_create_ptr)
647 {
648     // For iOS, the SDK files are all cached locally on the host
649     // system. So first we ask for the file in the cached SDK,
650     // then we attempt to get a shared module for the right architecture
651     // with the right UUID.
652     const FileSpec &platform_file = module_spec.GetFileSpec();
653 
654     FileSpec local_file;
655     const UUID *module_uuid_ptr = module_spec.GetUUIDPtr();
656     Error error (GetSymbolFile (platform_file, module_uuid_ptr, local_file));
657     if (error.Success())
658     {
659         error = ResolveExecutable (local_file, module_spec.GetArchitecture(), module_sp, NULL);
660         if (module_sp && ((module_uuid_ptr == NULL) || (module_sp->GetUUID() == *module_uuid_ptr)))
661         {
662             //printf ("found in user specified SDK\n");
663             error.Clear();
664             return error;
665         }
666 
667         char platform_file_path[PATH_MAX];
668         if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path)))
669         {
670             FileSpec local_file;
671             const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
672             // Try the last SDK index if it is set as most files from an SDK
673             // will tend to be valid in that same SDK.
674             if (m_last_module_sdk_idx < num_sdk_infos)
675             {
676                 if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, local_file))
677                 {
678                     //printf ("sdk[%u] last: '%s/%s'\n", m_last_module_sdk_idx, local_file.GetDirectory().GetCString(), local_file.GetFilename().GetCString());
679                     module_sp.reset();
680                     error = ResolveExecutable (local_file,
681                                                module_spec.GetArchitecture(),
682                                                module_sp,
683                                                NULL);
684                     if (module_sp && module_sp->GetUUID() == *module_uuid_ptr)
685                     {
686                         //printf ("sdk[%u] last found\n", m_last_module_sdk_idx);
687                         error.Clear();
688                         return error;
689                     }
690                 }
691             }
692 
693             // First try for an exact match of major, minor and update
694             for (uint32_t sdk_idx=0; sdk_idx<num_sdk_infos; ++sdk_idx)
695             {
696                 if (m_last_module_sdk_idx == sdk_idx)
697                 {
698                     // Skip the last module SDK index if we already searched
699                     // it above
700                     continue;
701                 }
702                 if (GetFileInSDK (platform_file_path, sdk_idx, local_file))
703                 {
704                     //printf ("sdk[%u]: '%s/%s'\n", sdk_idx, local_file.GetDirectory().GetCString(), local_file.GetFilename().GetCString());
705 
706                     error = ResolveExecutable (local_file,
707                                                module_spec.GetArchitecture(),
708                                                module_sp,
709                                                NULL);
710                     if (module_sp && module_sp->GetUUID() == *module_uuid_ptr)
711                     {
712                         // Remember the index of the last SDK that we found a file
713                         // in in case the wrong SDK was selected.
714                         m_last_module_sdk_idx = sdk_idx;
715                         //printf ("sdk[%u]: found (setting last to %u)\n", sdk_idx, m_last_module_sdk_idx);
716                         error.Clear();
717                         return error;
718                     }
719                 }
720             }
721         }
722         // Not the module we are looking for... Nothing to see here...
723         module_sp.reset();
724     }
725 
726     const bool always_create = false;
727     error = ModuleList::GetSharedModule (module_spec,
728                                          module_sp,
729                                          module_search_paths_ptr,
730                                          old_module_sp_ptr,
731                                          did_create_ptr,
732                                          always_create);
733 
734     if (module_sp)
735         module_sp->SetPlatformFileSpec(platform_file);
736 
737     return error;
738 }
739 
740 
741 uint32_t
742 PlatformRemoteiOS::FindProcesses (const ProcessInstanceInfoMatch &match_info,
743                                   ProcessInstanceInfoList &process_infos)
744 {
745     // TODO: if connected, send a packet to get the remote process infos by name
746     process_infos.Clear();
747     return 0;
748 }
749 
750 bool
751 PlatformRemoteiOS::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
752 {
753     // TODO: if connected, send a packet to get the remote process info
754     process_info.Clear();
755     return false;
756 }
757 
758 bool
759 PlatformRemoteiOS::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
760 {
761     return ARMGetSupportedArchitectureAtIndex (idx, arch);
762 }
763