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