Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h
Line
Count
Source (jump to first uncovered line)
1
//===-- PlatformRemoteDarwinDevice.h -------------------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMREMOTEDARWINDEVICE_H
10
#define LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMREMOTEDARWINDEVICE_H
11
12
#include <string>
13
14
#include "PlatformDarwin.h"
15
#include "lldb/Utility/FileSpec.h"
16
17
#include "llvm/Support/FileSystem.h"
18
19
class PlatformRemoteDarwinDevice : public PlatformDarwin {
20
public:
21
  PlatformRemoteDarwinDevice();
22
23
  ~PlatformRemoteDarwinDevice() override;
24
25
  // lldb_private::Platform functions
26
  lldb_private::Status ResolveExecutable(
27
      const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
28
      const lldb_private::FileSpecList *module_search_paths_ptr) override;
29
30
  void GetStatus(lldb_private::Stream &strm) override;
31
32
  virtual lldb_private::Status
33
  GetSymbolFile(const lldb_private::FileSpec &platform_file,
34
                const lldb_private::UUID *uuid_ptr,
35
                lldb_private::FileSpec &local_file);
36
37
  lldb_private::Status
38
  GetSharedModule(const lldb_private::ModuleSpec &module_spec,
39
                  lldb_private::Process *process, lldb::ModuleSP &module_sp,
40
                  const lldb_private::FileSpecList *module_search_paths_ptr,
41
                  llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
42
                  bool *did_create_ptr) override;
43
44
  void
45
  AddClangModuleCompilationOptions(lldb_private::Target *target,
46
0
                                   std::vector<std::string> &options) override {
47
0
    return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
48
0
        target, options, lldb_private::XcodeSDK::Type::iPhoneOS);
49
0
  }
50
51
protected:
52
  struct SDKDirectoryInfo {
53
    SDKDirectoryInfo(const lldb_private::FileSpec &sdk_dir_spec);
54
    lldb_private::FileSpec directory;
55
    lldb_private::ConstString build;
56
    llvm::VersionTuple version;
57
    bool user_cached;
58
  };
59
60
  typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
61
62
  std::mutex m_sdk_dir_mutex;
63
  SDKDirectoryInfoCollection m_sdk_directory_infos;
64
  std::string m_device_support_directory;
65
  std::string m_device_support_directory_for_os_version;
66
  std::string m_build_update;
67
  uint32_t m_last_module_sdk_idx = UINT32_MAX;
68
  uint32_t m_connected_module_sdk_idx = UINT32_MAX;
69
70
  bool UpdateSDKDirectoryInfosIfNeeded();
71
72
  const char *GetDeviceSupportDirectory();
73
74
  const char *GetDeviceSupportDirectoryForOSVersion();
75
76
  const SDKDirectoryInfo *GetSDKDirectoryForLatestOSVersion();
77
78
  const SDKDirectoryInfo *GetSDKDirectoryForCurrentOSVersion();
79
80
  static lldb_private::FileSystem::EnumerateDirectoryResult
81
  GetContainedFilesIntoVectorOfStringsCallback(void *baton,
82
                                               llvm::sys::fs::file_type ft,
83
                                               llvm::StringRef path);
84
85
  uint32_t FindFileInAllSDKs(const char *platform_file_path,
86
                             lldb_private::FileSpecList &file_list);
87
88
  bool GetFileInSDK(const char *platform_file_path, uint32_t sdk_idx,
89
                    lldb_private::FileSpec &local_file);
90
91
  uint32_t FindFileInAllSDKs(const lldb_private::FileSpec &platform_file,
92
                             lldb_private::FileSpecList &file_list);
93
94
  uint32_t GetConnectedSDKIndex();
95
96
  // Get index of SDK in SDKDirectoryInfoCollection by its pointer and return
97
  // UINT32_MAX if that SDK not found.
98
  uint32_t GetSDKIndexBySDKDirectoryInfo(const SDKDirectoryInfo *sdk_info);
99
100
  virtual llvm::StringRef GetDeviceSupportDirectoryName() = 0;
101
  virtual llvm::StringRef GetPlatformName() = 0;
102
103
private:
104
  PlatformRemoteDarwinDevice(const PlatformRemoteDarwinDevice &) = delete;
105
  const PlatformRemoteDarwinDevice &
106
  operator=(const PlatformRemoteDarwinDevice &) = delete;
107
};
108
109
#endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMREMOTEDARWINDEVICE_H