PlatformRemoteiOS.h revision 0f485ead5447872a2a9f35c5670fc67cc58e1549
1//===-- PlatformRemoteiOS.h ----------------------------------------*- 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#ifndef liblldb_PlatformRemoteiOS_h_
11#define liblldb_PlatformRemoteiOS_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16#include "lldb/Host/FileSpec.h"
17
18// Project includes
19#include "PlatformDarwin.h"
20
21class PlatformRemoteiOS : public PlatformDarwin
22{
23public:
24
25    //------------------------------------------------------------
26    // Class Functions
27    //------------------------------------------------------------
28    static lldb_private::Platform*
29    CreateInstance (bool force, const lldb_private::ArchSpec *arch);
30
31    static void
32    Initialize ();
33
34    static void
35    Terminate ();
36
37    static const char *
38    GetPluginNameStatic ();
39
40    static const char *
41    GetShortPluginNameStatic();
42
43    static const char *
44    GetDescriptionStatic();
45
46    //------------------------------------------------------------
47    // Class Methods
48    //------------------------------------------------------------
49    PlatformRemoteiOS ();
50
51    virtual
52    ~PlatformRemoteiOS();
53
54    //------------------------------------------------------------
55    // lldb_private::PluginInterface functions
56    //------------------------------------------------------------
57    virtual const char *
58    GetPluginName()
59    {
60        return GetPluginNameStatic();
61    }
62
63    virtual const char *
64    GetShortPluginName()
65    {
66        return GetShortPluginNameStatic();
67    }
68
69    virtual uint32_t
70    GetPluginVersion()
71    {
72        return 1;
73    }
74
75    //------------------------------------------------------------
76    // lldb_private::Platform functions
77    //------------------------------------------------------------
78    virtual lldb_private::Error
79    ResolveExecutable (const lldb_private::FileSpec &exe_file,
80                       const lldb_private::ArchSpec &arch,
81                       lldb::ModuleSP &module_sp,
82                       const lldb_private::FileSpecList *module_search_paths_ptr);
83
84    virtual const char *
85    GetDescription ()
86    {
87        return GetDescriptionStatic();
88    }
89
90    virtual void
91    GetStatus (lldb_private::Stream &strm);
92
93    virtual lldb_private::Error
94    GetSymbolFile (const lldb_private::FileSpec &platform_file,
95                   const lldb_private::UUID *uuid_ptr,
96                   lldb_private::FileSpec &local_file);
97
98    virtual lldb_private::Error
99    GetSharedModule (const lldb_private::ModuleSpec &module_spec,
100                     lldb::ModuleSP &module_sp,
101                     const lldb_private::FileSpecList *module_search_paths_ptr,
102                     lldb::ModuleSP *old_module_sp_ptr,
103                     bool *did_create_ptr);
104
105    virtual uint32_t
106    FindProcesses (const lldb_private::ProcessInstanceInfoMatch &match_info,
107                   lldb_private::ProcessInstanceInfoList &process_infos);
108
109    virtual bool
110    GetProcessInfo (lldb::pid_t pid,
111                    lldb_private::ProcessInstanceInfo &proc_info);
112
113    virtual bool
114    GetSupportedArchitectureAtIndex (uint32_t idx,
115                                     lldb_private::ArchSpec &arch);
116
117protected:
118    struct SDKDirectoryInfo
119    {
120        SDKDirectoryInfo (const lldb_private::FileSpec &sdk_dir_spec);
121        lldb_private::FileSpec directory;
122        lldb_private::ConstString build;
123        uint32_t version_major;
124        uint32_t version_minor;
125        uint32_t version_update;
126        bool user_cached;
127    };
128    typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
129    SDKDirectoryInfoCollection m_sdk_directory_infos;
130    std::string m_device_support_directory;
131    std::string m_device_support_directory_for_os_version;
132    std::string m_build_update;
133    uint32_t m_last_module_sdk_idx;
134
135    bool
136    UpdateSDKDirectoryInfosInNeeded();
137
138    const char *
139    GetDeviceSupportDirectory();
140
141    const char *
142    GetDeviceSupportDirectoryForOSVersion();
143
144    const SDKDirectoryInfo *
145    GetSDKDirectoryForLatestOSVersion ();
146
147    const SDKDirectoryInfo *
148    GetSDKDirectoryForCurrentOSVersion ();
149
150    static lldb_private::FileSpec::EnumerateDirectoryResult
151    GetContainedFilesIntoVectorOfStringsCallback (void *baton,
152                                                  lldb_private::FileSpec::FileType file_type,
153                                                  const lldb_private::FileSpec &file_spec);
154
155    uint32_t
156    FindFileInAllSDKs (const char *platform_file_path,
157                       lldb_private::FileSpecList &file_list);
158
159    bool
160    GetFileInSDK (const char *platform_file_path,
161                  uint32_t sdk_idx,
162                  lldb_private::FileSpec &local_file);
163
164    bool
165    GetFileInSDKRoot (const char *platform_file_path,
166                      const char *sdkroot_path,
167                      bool symbols_dirs_only,
168                      lldb_private::FileSpec &local_file);
169
170    uint32_t
171    FindFileInAllSDKs (const lldb_private::FileSpec &platform_file,
172                       lldb_private::FileSpecList &file_list);
173
174private:
175    DISALLOW_COPY_AND_ASSIGN (PlatformRemoteiOS);
176
177};
178
179#endif  // liblldb_PlatformRemoteiOS_h_
180