1 //===-- PlatformRemoteDarwinDevice.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_PlatformRemoteDarwinDevice_h_ 11 #define liblldb_PlatformRemoteDarwinDevice_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <string> 16 17 // Other libraries and framework includes 18 // Project includes 19 #include "PlatformDarwin.h" 20 #include "lldb/Utility/FileSpec.h" 21 22 #include "llvm/Support/FileSystem.h" 23 24 class PlatformRemoteDarwinDevice : public PlatformDarwin { 25 public: 26 PlatformRemoteDarwinDevice(); 27 28 ~PlatformRemoteDarwinDevice() override; 29 30 //------------------------------------------------------------ 31 // lldb_private::Platform functions 32 //------------------------------------------------------------ 33 lldb_private::Status ResolveExecutable( 34 const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, 35 const lldb_private::FileSpecList *module_search_paths_ptr) override; 36 37 void GetStatus(lldb_private::Stream &strm) override; 38 39 virtual lldb_private::Status 40 GetSymbolFile(const lldb_private::FileSpec &platform_file, 41 const lldb_private::UUID *uuid_ptr, 42 lldb_private::FileSpec &local_file); 43 44 lldb_private::Status 45 GetSharedModule(const lldb_private::ModuleSpec &module_spec, 46 lldb_private::Process *process, lldb::ModuleSP &module_sp, 47 const lldb_private::FileSpecList *module_search_paths_ptr, 48 lldb::ModuleSP *old_module_sp_ptr, 49 bool *did_create_ptr) override; 50 51 void 52 AddClangModuleCompilationOptions(lldb_private::Target *target, 53 std::vector<std::string> &options) override { 54 return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType( 55 target, options, PlatformDarwin::SDKType::iPhoneOS); 56 } 57 58 protected: 59 struct SDKDirectoryInfo { 60 SDKDirectoryInfo(const lldb_private::FileSpec &sdk_dir_spec); 61 lldb_private::FileSpec directory; 62 lldb_private::ConstString build; 63 uint32_t version_major; 64 uint32_t version_minor; 65 uint32_t version_update; 66 bool user_cached; 67 }; 68 69 typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection; 70 71 std::mutex m_sdk_dir_mutex; 72 SDKDirectoryInfoCollection m_sdk_directory_infos; 73 std::string m_device_support_directory; 74 std::string m_device_support_directory_for_os_version; 75 std::string m_build_update; 76 uint32_t m_last_module_sdk_idx; 77 uint32_t m_connected_module_sdk_idx; 78 79 bool UpdateSDKDirectoryInfosIfNeeded(); 80 81 const char *GetDeviceSupportDirectory(); 82 83 const char *GetDeviceSupportDirectoryForOSVersion(); 84 85 const SDKDirectoryInfo *GetSDKDirectoryForLatestOSVersion(); 86 87 const SDKDirectoryInfo *GetSDKDirectoryForCurrentOSVersion(); 88 89 static lldb_private::FileSpec::EnumerateDirectoryResult 90 GetContainedFilesIntoVectorOfStringsCallback( 91 void *baton, llvm::sys::fs::file_type ft, 92 const lldb_private::FileSpec &file_spec); 93 94 uint32_t FindFileInAllSDKs(const char *platform_file_path, 95 lldb_private::FileSpecList &file_list); 96 97 bool GetFileInSDK(const char *platform_file_path, uint32_t sdk_idx, 98 lldb_private::FileSpec &local_file); 99 100 uint32_t FindFileInAllSDKs(const lldb_private::FileSpec &platform_file, 101 lldb_private::FileSpecList &file_list); 102 103 uint32_t GetConnectedSDKIndex(); 104 105 // Get index of SDK in SDKDirectoryInfoCollection by its pointer and return 106 // UINT32_MAX if that SDK not found. 107 uint32_t GetSDKIndexBySDKDirectoryInfo(const SDKDirectoryInfo *sdk_info); 108 109 110 virtual void GetDeviceSupportDirectoryNames (std::vector<std::string> &dirnames) = 0; 111 112 virtual std::string GetPlatformName () = 0; 113 114 private: 115 DISALLOW_COPY_AND_ASSIGN(PlatformRemoteDarwinDevice); 116 }; 117 118 #endif // liblldb_PlatformRemoteDarwinDevice_h_ 119