1 //===-- PlatformRemoteAppleWatch.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_PlatformRemoteAppleWatch_h_ 11 #define liblldb_PlatformRemoteAppleWatch_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <string> 16 #include <vector> 17 18 // Other libraries and framework includes 19 // Project includes 20 #include "lldb/Host/FileSpec.h" 21 22 #include "PlatformDarwin.h" 23 24 class PlatformRemoteAppleWatch : public PlatformDarwin 25 { 26 public: 27 PlatformRemoteAppleWatch(); 28 29 ~PlatformRemoteAppleWatch() override = default; 30 31 //------------------------------------------------------------ 32 // Class Functions 33 //------------------------------------------------------------ 34 static lldb::PlatformSP 35 CreateInstance (bool force, const lldb_private::ArchSpec *arch); 36 37 static void 38 Initialize (); 39 40 static void 41 Terminate (); 42 43 static lldb_private::ConstString 44 GetPluginNameStatic (); 45 46 static const char * 47 GetDescriptionStatic(); 48 49 //------------------------------------------------------------ 50 // Class Methods 51 //------------------------------------------------------------ 52 53 //------------------------------------------------------------ 54 // lldb_private::PluginInterface functions 55 //------------------------------------------------------------ 56 lldb_private::ConstString 57 GetPluginName() override 58 { 59 return GetPluginNameStatic(); 60 } 61 62 uint32_t 63 GetPluginVersion() override 64 { 65 return 1; 66 } 67 68 //------------------------------------------------------------ 69 // lldb_private::Platform functions 70 //------------------------------------------------------------ 71 lldb_private::Error 72 ResolveExecutable (const lldb_private::ModuleSpec &module_spec, 73 lldb::ModuleSP &module_sp, 74 const lldb_private::FileSpecList *module_search_paths_ptr) override; 75 76 const char * 77 GetDescription () override 78 { 79 return GetDescriptionStatic(); 80 } 81 82 void 83 GetStatus (lldb_private::Stream &strm) override; 84 85 virtual lldb_private::Error 86 GetSymbolFile (const lldb_private::FileSpec &platform_file, 87 const lldb_private::UUID *uuid_ptr, 88 lldb_private::FileSpec &local_file); 89 90 lldb_private::Error 91 GetSharedModule (const lldb_private::ModuleSpec &module_spec, 92 lldb_private::Process* process, 93 lldb::ModuleSP &module_sp, 94 const lldb_private::FileSpecList *module_search_paths_ptr, 95 lldb::ModuleSP *old_module_sp_ptr, 96 bool *did_create_ptr) override; 97 98 bool 99 GetSupportedArchitectureAtIndex (uint32_t idx, 100 lldb_private::ArchSpec &arch) override; 101 102 void 103 AddClangModuleCompilationOptions (lldb_private::Target *target, std::vector<std::string> &options) override 104 { 105 return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(target, options, PlatformDarwin::SDKType::iPhoneOS); 106 } 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 uint32_t m_connected_module_sdk_idx; 126 127 bool 128 UpdateSDKDirectoryInfosIfNeeded(); 129 130 const char * 131 GetDeviceSupportDirectory(); 132 133 const char * 134 GetDeviceSupportDirectoryForOSVersion(); 135 136 const SDKDirectoryInfo * 137 GetSDKDirectoryForLatestOSVersion (); 138 139 const SDKDirectoryInfo * 140 GetSDKDirectoryForCurrentOSVersion (); 141 142 static lldb_private::FileSpec::EnumerateDirectoryResult 143 GetContainedFilesIntoVectorOfStringsCallback (void *baton, 144 lldb_private::FileSpec::FileType file_type, 145 const lldb_private::FileSpec &file_spec); 146 147 uint32_t 148 FindFileInAllSDKs (const char *platform_file_path, 149 lldb_private::FileSpecList &file_list); 150 151 bool 152 GetFileInSDK (const char *platform_file_path, 153 uint32_t sdk_idx, 154 lldb_private::FileSpec &local_file); 155 156 bool 157 GetFileInSDKRoot (const char *platform_file_path, 158 const char *sdkroot_path, 159 bool symbols_dirs_only, 160 lldb_private::FileSpec &local_file); 161 162 uint32_t 163 FindFileInAllSDKs (const lldb_private::FileSpec &platform_file, 164 lldb_private::FileSpecList &file_list); 165 166 uint32_t 167 GetConnectedSDKIndex (); 168 169 private: 170 DISALLOW_COPY_AND_ASSIGN (PlatformRemoteAppleWatch); 171 }; 172 173 #endif // liblldb_PlatformRemoteAppleWatch_h_ 174