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