LLDB  mainline
PlatformRemoteDarwinDevice.cpp
Go to the documentation of this file.
1 //===-- PlatformRemoteDarwinDevice.cpp ------------------------------------===//
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 
10 
12 #include "lldb/Core/Module.h"
13 #include "lldb/Core/ModuleList.h"
14 #include "lldb/Core/ModuleSpec.h"
16 #include "lldb/Host/FileSystem.h"
17 #include "lldb/Host/Host.h"
18 #include "lldb/Host/HostInfo.h"
19 #include "lldb/Target/Process.h"
20 #include "lldb/Target/Target.h"
21 #include "lldb/Utility/FileSpec.h"
22 #include "lldb/Utility/Log.h"
23 #include "lldb/Utility/Status.h"
25 
26 using namespace lldb;
27 using namespace lldb_private;
28 
30  const lldb_private::FileSpec &sdk_dir)
31  : directory(sdk_dir), build(), user_cached(false) {
32  llvm::StringRef dirname_str = sdk_dir.GetFilename().GetStringRef();
33  llvm::StringRef build_str;
34  std::tie(version, build_str) = ParseVersionBuildDir(dirname_str);
35  build.SetString(build_str);
36 }
37 
38 /// Default Constructor
40  : PlatformDarwin(false), // This is a remote platform
45 
46 /// Destructor.
47 ///
48 /// The destructor is virtual since this class is designed to be
49 /// inherited from by the plug-in instance.
51 
53  Platform::GetStatus(strm);
54  const char *sdk_directory = GetDeviceSupportDirectoryForOSVersion();
55  if (sdk_directory)
56  strm.Printf(" SDK Path: \"%s\"\n", sdk_directory);
57  else
58  strm.PutCString(" SDK Path: error: unable to locate SDK\n");
59 
60  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
61  for (uint32_t i = 0; i < num_sdk_infos; ++i) {
62  const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
63  strm.Printf(" SDK Roots: [%2u] \"%s\"\n", i,
64  sdk_dir_info.directory.GetPath().c_str());
65  }
66 }
67 
69  const ModuleSpec &ms, lldb::ModuleSP &exe_module_sp,
70  const FileSpecList *module_search_paths_ptr) {
71  Status error;
72  // Nothing special to do here, just use the actual file and architecture
73 
74  ModuleSpec resolved_module_spec(ms);
75 
76  // Resolve any executable within a bundle on MacOSX
77  // TODO: verify that this handles shallow bundles, if not then implement one
78  // ourselves
79  Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec());
80 
81  if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) {
82  if (resolved_module_spec.GetArchitecture().IsValid() ||
83  resolved_module_spec.GetUUID().IsValid()) {
84  error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
85  nullptr, nullptr, nullptr);
86 
87  if (exe_module_sp && exe_module_sp->GetObjectFile())
88  return error;
89  exe_module_sp.reset();
90  }
91  // No valid architecture was specified or the exact ARM slice wasn't found
92  // so ask the platform for the architectures that we should be using (in
93  // the correct order) and see if we can find a match that way
94  StreamString arch_names;
96  idx, resolved_module_spec.GetArchitecture());
97  ++idx) {
98  error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
99  nullptr, nullptr, nullptr);
100  // Did we find an executable using one of the
101  if (error.Success()) {
102  if (exe_module_sp && exe_module_sp->GetObjectFile())
103  break;
104  else
105  error.SetErrorToGenericError();
106  }
107 
108  if (idx > 0)
109  arch_names.PutCString(", ");
110  arch_names.PutCString(
111  resolved_module_spec.GetArchitecture().GetArchitectureName());
112  }
113 
114  if (error.Fail() || !exe_module_sp) {
115  if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) {
116  error.SetErrorStringWithFormat(
117  "'%s' doesn't contain any '%s' platform architectures: %s",
118  resolved_module_spec.GetFileSpec().GetPath().c_str(),
119  GetPluginName().GetCString(), arch_names.GetData());
120  } else {
121  error.SetErrorStringWithFormat(
122  "'%s' is not readable",
123  resolved_module_spec.GetFileSpec().GetPath().c_str());
124  }
125  }
126  } else {
127  error.SetErrorStringWithFormat(
128  "'%s' does not exist",
129  resolved_module_spec.GetFileSpec().GetPath().c_str());
130  }
131 
132  return error;
133 }
134 
137  void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) {
140  return FileSystem::eEnumerateDirectoryResultNext;
141 }
142 
145  std::lock_guard<std::mutex> guard(m_sdk_dir_mutex);
146  if (m_sdk_directory_infos.empty()) {
147  // A --sysroot option was supplied - add it to our list of SDKs to check
148  if (m_sdk_sysroot) {
149  FileSpec sdk_sysroot_fspec(m_sdk_sysroot.GetCString());
150  FileSystem::Instance().Resolve(sdk_sysroot_fspec);
151  const SDKDirectoryInfo sdk_sysroot_directory_info(sdk_sysroot_fspec);
152  m_sdk_directory_infos.push_back(sdk_sysroot_directory_info);
153  if (log) {
154  LLDB_LOGF(
155  log,
156  "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
157  "--sysroot SDK directory %s",
159  }
160  return true;
161  }
162  const char *device_support_dir = GetDeviceSupportDirectory();
163  if (log) {
164  LLDB_LOGF(
165  log,
166  "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
167  "DeviceSupport directory %s",
168  device_support_dir);
169  }
170  if (device_support_dir) {
171  const bool find_directories = true;
172  const bool find_files = false;
173  const bool find_other = false;
174 
175  SDKDirectoryInfoCollection builtin_sdk_directory_infos;
176  FileSystem::Instance().EnumerateDirectory(
177  m_device_support_directory, find_directories, find_files, find_other,
179  &builtin_sdk_directory_infos);
180 
181  // Only add SDK directories that have symbols in them, some SDKs only
182  // contain developer disk images and no symbols, so they aren't useful to
183  // us.
184  FileSpec sdk_symbols_symlink_fspec;
185  for (const auto &sdk_directory_info : builtin_sdk_directory_infos) {
186  sdk_symbols_symlink_fspec = sdk_directory_info.directory;
187  sdk_symbols_symlink_fspec.AppendPathComponent("Symbols");
188  if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
189  m_sdk_directory_infos.push_back(sdk_directory_info);
190  if (log) {
191  LLDB_LOGF(
192  log,
193  "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
194  "added builtin SDK directory %s",
195  sdk_symbols_symlink_fspec.GetPath().c_str());
196  }
197  }
198  }
199 
200  const uint32_t num_installed = m_sdk_directory_infos.size();
201  llvm::StringRef dirname = GetDeviceSupportDirectoryName();
202  std::string local_sdk_cache_str = "~/Library/Developer/Xcode/";
203  local_sdk_cache_str += std::string(dirname);
204  FileSpec local_sdk_cache(local_sdk_cache_str.c_str());
205  FileSystem::Instance().Resolve(local_sdk_cache);
206  if (FileSystem::Instance().Exists(local_sdk_cache)) {
207  if (log) {
208  LLDB_LOGF(
209  log,
210  "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
211  "searching %s for additional SDKs",
212  local_sdk_cache.GetPath().c_str());
213  }
214  char path[PATH_MAX];
215  if (local_sdk_cache.GetPath(path, sizeof(path))) {
216  FileSystem::Instance().EnumerateDirectory(
217  path, find_directories, find_files, find_other,
220  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
221  // First try for an exact match of major, minor and update
222  for (uint32_t i = num_installed; i < num_sdk_infos; ++i) {
223  m_sdk_directory_infos[i].user_cached = true;
224  if (log) {
225  LLDB_LOGF(log,
226  "PlatformRemoteDarwinDevice::"
227  "UpdateSDKDirectoryInfosIfNeeded "
228  "user SDK directory %s",
229  m_sdk_directory_infos[i].directory.GetPath().c_str());
230  }
231  }
232  }
233  }
234 
235  const char *addtional_platform_dirs = getenv("PLATFORM_SDK_DIRECTORY");
236  if (addtional_platform_dirs) {
237  SDKDirectoryInfoCollection env_var_sdk_directory_infos;
238  FileSystem::Instance().EnumerateDirectory(
239  addtional_platform_dirs, find_directories, find_files, find_other,
241  &env_var_sdk_directory_infos);
242  FileSpec sdk_symbols_symlink_fspec;
243  for (const auto &sdk_directory_info : env_var_sdk_directory_infos) {
244  sdk_symbols_symlink_fspec = sdk_directory_info.directory;
245  sdk_symbols_symlink_fspec.AppendPathComponent("Symbols");
246  if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
247  m_sdk_directory_infos.push_back(sdk_directory_info);
248  if (log) {
249  LLDB_LOGF(
250  log,
251  "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
252  "added env var SDK directory %s",
253  sdk_symbols_symlink_fspec.GetPath().c_str());
254  }
255  }
256  }
257  }
258 
259  }
260  }
261  return !m_sdk_directory_infos.empty();
262 }
263 
266  uint32_t i;
268  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
269 
270  // Check to see if the user specified a build string. If they did, then be
271  // sure to match it.
272  std::vector<bool> check_sdk_info(num_sdk_infos, true);
273  ConstString build(m_sdk_build);
274  if (build) {
275  for (i = 0; i < num_sdk_infos; ++i)
276  check_sdk_info[i] = m_sdk_directory_infos[i].build == build;
277  }
278 
279  // If we are connected we can find the version of the OS the platform us
280  // running on and select the right SDK
281  llvm::VersionTuple version = GetOSVersion();
282  if (!version.empty()) {
284  // First try for an exact match of major, minor and update
285  for (i = 0; i < num_sdk_infos; ++i) {
286  if (check_sdk_info[i]) {
287  if (m_sdk_directory_infos[i].version == version)
288  return &m_sdk_directory_infos[i];
289  }
290  }
291  // First try for an exact match of major and minor
292  for (i = 0; i < num_sdk_infos; ++i) {
293  if (check_sdk_info[i]) {
294  if (m_sdk_directory_infos[i].version.getMajor() ==
295  version.getMajor() &&
296  m_sdk_directory_infos[i].version.getMinor() ==
297  version.getMinor()) {
298  return &m_sdk_directory_infos[i];
299  }
300  }
301  }
302  // Lastly try to match of major version only..
303  for (i = 0; i < num_sdk_infos; ++i) {
304  if (check_sdk_info[i]) {
305  if (m_sdk_directory_infos[i].version.getMajor() ==
306  version.getMajor()) {
307  return &m_sdk_directory_infos[i];
308  }
309  }
310  }
311  }
312  } else if (build) {
313  // No version, just a build number, search for the first one that matches
314  for (i = 0; i < num_sdk_infos; ++i)
315  if (check_sdk_info[i])
316  return &m_sdk_directory_infos[i];
317  }
318  }
319  return nullptr;
320 }
321 
324  const PlatformRemoteDarwinDevice::SDKDirectoryInfo *result = nullptr;
326  auto max = std::max_element(
328  [](const SDKDirectoryInfo &a, const SDKDirectoryInfo &b) {
329  return a.version < b.version;
330  });
331  if (max != m_sdk_directory_infos.end())
332  result = &*max;
333  }
334  return result;
335 }
336 
338  std::string platform_dir =
339  ("/Platforms/" + GetPlatformName() + "/DeviceSupport").str();
340  if (m_device_support_directory.empty()) {
341  if (FileSpec fspec = HostInfo::GetXcodeDeveloperDirectory()) {
342  m_device_support_directory = fspec.GetPath();
343  m_device_support_directory.append(platform_dir.c_str());
344  } else {
345  // Assign a single NULL character so we know we tried to find the device
346  // support directory and we don't keep trying to find it over and over.
347  m_device_support_directory.assign(1, '\0');
348  }
349  }
350  // We should have put a single NULL character into m_device_support_directory
351  // or it should have a valid path if the code gets here
352  assert(m_device_support_directory.empty() == false);
354  return m_device_support_directory.c_str();
355  return nullptr;
356 }
357 
359  if (m_sdk_sysroot)
360  return m_sdk_sysroot.GetCString();
361 
365  if (sdk_dir_info == nullptr)
366  sdk_dir_info = GetSDKDirectoryForLatestOSVersion();
367  if (sdk_dir_info) {
368  char path[PATH_MAX];
369  if (sdk_dir_info->directory.GetPath(path, sizeof(path))) {
372  }
373  } else {
374  // Assign a single NULL character so we know we tried to find the device
375  // support directory and we don't keep trying to find it over and over.
377  }
378  }
379  // We should have put a single NULL character into
380  // m_device_support_directory_for_os_version or it should have a valid path
381  // if the code gets here
382  assert(m_device_support_directory_for_os_version.empty() == false);
385  return nullptr;
386 }
387 
388 uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file_path,
389  FileSpecList &file_list) {
391  if (platform_file_path && platform_file_path[0] &&
393  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
394  lldb_private::FileSpec local_file;
395  // First try for an exact match of major, minor and update
396  for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
397  LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file_path,
398  m_sdk_directory_infos[sdk_idx].directory);
399  if (GetFileInSDK(platform_file_path, sdk_idx, local_file)) {
400  file_list.Append(local_file);
401  }
402  }
403  }
404  return file_list.GetSize();
405 }
406 
407 bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path,
408  uint32_t sdk_idx,
409  lldb_private::FileSpec &local_file) {
411  if (sdk_idx < m_sdk_directory_infos.size()) {
412  std::string sdkroot_path =
413  m_sdk_directory_infos[sdk_idx].directory.GetPath();
414  local_file.Clear();
415 
416  if (!sdkroot_path.empty() && platform_file_path && platform_file_path[0]) {
417  // We may need to interpose "/Symbols/" or "/Symbols.Internal/" between
418  // the
419  // SDK root directory and the file path.
420 
421  const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr};
422  for (size_t i = 0; paths_to_try[i] != nullptr; i++) {
423  local_file.SetFile(sdkroot_path, FileSpec::Style::native);
424  if (paths_to_try[i][0] != '\0')
425  local_file.AppendPathComponent(paths_to_try[i]);
426  local_file.AppendPathComponent(platform_file_path);
427  FileSystem::Instance().Resolve(local_file);
428  if (FileSystem::Instance().Exists(local_file)) {
429  LLDB_LOGF(log, "Found a copy of %s in the SDK dir %s/%s",
430  platform_file_path, sdkroot_path.c_str(), paths_to_try[i]);
431  return true;
432  }
433  local_file.Clear();
434  }
435  }
436  }
437  return false;
438 }
439 
441  const UUID *uuid_ptr,
442  FileSpec &local_file) {
444  Status error;
445  char platform_file_path[PATH_MAX];
446  if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) {
447  const char *os_version_dir = GetDeviceSupportDirectoryForOSVersion();
448  if (os_version_dir) {
449  std::string resolved_path =
450  (llvm::Twine(os_version_dir) + "/" + platform_file_path).str();
451 
452  local_file.SetFile(resolved_path, FileSpec::Style::native);
453  FileSystem::Instance().Resolve(local_file);
454  if (FileSystem::Instance().Exists(local_file)) {
455  if (log) {
456  LLDB_LOGF(log, "Found a copy of %s in the DeviceSupport dir %s",
457  platform_file_path, os_version_dir);
458  }
459  return error;
460  }
461 
462  resolved_path = (llvm::Twine(os_version_dir) + "/Symbols.Internal/" +
463  platform_file_path)
464  .str();
465 
466  local_file.SetFile(resolved_path, FileSpec::Style::native);
467  FileSystem::Instance().Resolve(local_file);
468  if (FileSystem::Instance().Exists(local_file)) {
469  LLDB_LOGF(
470  log,
471  "Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal",
472  platform_file_path, os_version_dir);
473  return error;
474  }
475  resolved_path =
476  (llvm::Twine(os_version_dir) + "/Symbols/" + platform_file_path)
477  .str();
478 
479  local_file.SetFile(resolved_path, FileSpec::Style::native);
480  FileSystem::Instance().Resolve(local_file);
481  if (FileSystem::Instance().Exists(local_file)) {
482  LLDB_LOGF(log, "Found a copy of %s in the DeviceSupport dir %s/Symbols",
483  platform_file_path, os_version_dir);
484  return error;
485  }
486  }
487  local_file = platform_file;
488  if (FileSystem::Instance().Exists(local_file))
489  return error;
490 
491  error.SetErrorStringWithFormat(
492  "unable to locate a platform file for '%s' in platform '%s'",
493  platform_file_path, GetPluginName().GetCString());
494  } else {
495  error.SetErrorString("invalid platform file argument");
496  }
497  return error;
498 }
499 
501  const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
502  const FileSpecList *module_search_paths_ptr,
503  llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
504  // For iOS, the SDK files are all cached locally on the host system. So first
505  // we ask for the file in the cached SDK, then we attempt to get a shared
506  // module for the right architecture with the right UUID.
507  const FileSpec &platform_file = module_spec.GetFileSpec();
509 
510  Status error;
511  char platform_file_path[PATH_MAX];
512 
513  if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) {
514  ModuleSpec platform_module_spec(module_spec);
515 
517 
518  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
519 
520  // If we are connected we migth be able to correctly deduce the SDK
521  // directory using the OS build.
522  const uint32_t connected_sdk_idx = GetConnectedSDKIndex();
523  if (connected_sdk_idx < num_sdk_infos) {
524  LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
525  m_sdk_directory_infos[connected_sdk_idx].directory);
526  if (GetFileInSDK(platform_file_path, connected_sdk_idx,
527  platform_module_spec.GetFileSpec())) {
528  module_sp.reset();
529  error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
530  if (module_sp) {
531  m_last_module_sdk_idx = connected_sdk_idx;
532  error.Clear();
533  return error;
534  }
535  }
536  }
537 
538  // Try the last SDK index if it is set as most files from an SDK will tend
539  // to be valid in that same SDK.
540  if (m_last_module_sdk_idx < num_sdk_infos) {
541  LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
543  if (GetFileInSDK(platform_file_path, m_last_module_sdk_idx,
544  platform_module_spec.GetFileSpec())) {
545  module_sp.reset();
546  error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
547  if (module_sp) {
548  error.Clear();
549  return error;
550  }
551  }
552  }
553 
554  // First try for an exact match of major, minor and update: If a particalar
555  // SDK version was specified via --version or --build, look for a match on
556  // disk.
557  const SDKDirectoryInfo *current_sdk_info =
559  const uint32_t current_sdk_idx =
560  GetSDKIndexBySDKDirectoryInfo(current_sdk_info);
561  if (current_sdk_idx < num_sdk_infos &&
562  current_sdk_idx != m_last_module_sdk_idx) {
563  LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
564  m_sdk_directory_infos[current_sdk_idx].directory);
565  if (GetFileInSDK(platform_file_path, current_sdk_idx,
566  platform_module_spec.GetFileSpec())) {
567  module_sp.reset();
568  error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
569  if (module_sp) {
570  m_last_module_sdk_idx = current_sdk_idx;
571  error.Clear();
572  return error;
573  }
574  }
575  }
576 
577  // Second try all SDKs that were found.
578  for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
579  if (m_last_module_sdk_idx == sdk_idx) {
580  // Skip the last module SDK index if we already searched it above
581  continue;
582  }
583  LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
584  m_sdk_directory_infos[sdk_idx].directory);
585  if (GetFileInSDK(platform_file_path, sdk_idx,
586  platform_module_spec.GetFileSpec())) {
587  // printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
588 
589  error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
590  if (module_sp) {
591  // Remember the index of the last SDK that we found a file in in case
592  // the wrong SDK was selected.
593  m_last_module_sdk_idx = sdk_idx;
594  error.Clear();
595  return error;
596  }
597  }
598  }
599  }
600  // Not the module we are looking for... Nothing to see here...
601  module_sp.reset();
602 
603  // This may not be an SDK-related module. Try whether we can bring in the
604  // thing to our local cache.
605  error = GetSharedModuleWithLocalCache(module_spec, module_sp,
606  module_search_paths_ptr, old_modules,
607  did_create_ptr);
608  if (error.Success())
609  return error;
610 
611  // See if the file is present in any of the module_search_paths_ptr
612  // directories.
613  if (!module_sp)
615  module_spec, process, module_sp, module_search_paths_ptr, old_modules,
616  did_create_ptr);
617 
618  if (error.Success())
619  return error;
620 
621  const bool always_create = false;
622  error = ModuleList::GetSharedModule(module_spec, module_sp,
623  module_search_paths_ptr, old_modules,
624  did_create_ptr, always_create);
625 
626  if (module_sp)
627  module_sp->SetPlatformFileSpec(platform_file);
628 
629  return error;
630 }
631 
633  if (IsConnected()) {
635  std::string build;
636  if (GetRemoteOSBuildString(build)) {
637  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
638  for (uint32_t i = 0; i < num_sdk_infos; ++i) {
639  const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
640  if (strstr(sdk_dir_info.directory.GetFilename().AsCString(""),
641  build.c_str())) {
643  }
644  }
645  }
646  }
647  } else {
649  }
651 }
652 
654  const SDKDirectoryInfo *sdk_info) {
655  if (sdk_info == nullptr) {
656  return UINT32_MAX;
657  }
658 
659  return sdk_info - &m_sdk_directory_infos[0];
660 }
PlatformRemoteDarwinDevice::m_device_support_directory_for_os_version
std::string m_device_support_directory_for_os_version
Definition: PlatformRemoteDarwinDevice.h:65
lldb_private::RemoteAwarePlatform::IsConnected
bool IsConnected() const override
Definition: RemoteAwarePlatform.cpp:380
lldb_private::UUID
Definition: UUID.h:23
PlatformRemoteDarwinDevice::SDKDirectoryInfo
Definition: PlatformRemoteDarwinDevice.h:52
FileSystem.h
lldb_private::RemoteAwarePlatform::GetRemoteOSBuildString
bool GetRemoteOSBuildString(std::string &s) override
Definition: RemoteAwarePlatform.cpp:335
PlatformRemoteDarwinDevice::SDKDirectoryInfoCollection
std::vector< SDKDirectoryInfo > SDKDirectoryInfoCollection
Definition: PlatformRemoteDarwinDevice.h:60
PlatformRemoteDarwinDevice::PlatformRemoteDarwinDevice
PlatformRemoteDarwinDevice()
Default Constructor.
Definition: PlatformRemoteDarwinDevice.cpp:39
PlatformRemoteDarwinDevice::m_build_update
std::string m_build_update
Definition: PlatformRemoteDarwinDevice.h:66
ModuleSpec.h
PlatformRemoteDarwinDevice::GetSDKIndexBySDKDirectoryInfo
uint32_t GetSDKIndexBySDKDirectoryInfo(const SDKDirectoryInfo *sdk_info)
Definition: PlatformRemoteDarwinDevice.cpp:653
Host.h
lldb_private::Platform::m_sdk_build
ConstString m_sdk_build
Definition: Platform.h:884
lldb_private::UUID::IsValid
bool IsValid() const
Definition: UUID.h:79
PlatformRemoteDarwinDevice::GetSDKDirectoryForLatestOSVersion
const SDKDirectoryInfo * GetSDKDirectoryForLatestOSVersion()
Definition: PlatformRemoteDarwinDevice.cpp:323
PlatformRemoteDarwinDevice::m_last_module_sdk_idx
uint32_t m_last_module_sdk_idx
Definition: PlatformRemoteDarwinDevice.h:67
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
lldb_private::Process
Definition: Process.h:343
Module.h
BreakpointLocation.h
PlatformRemoteDarwinDevice.h
PlatformRemoteDarwinDevice::GetSDKDirectoryForCurrentOSVersion
const SDKDirectoryInfo * GetSDKDirectoryForCurrentOSVersion()
Definition: PlatformRemoteDarwinDevice.cpp:265
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:193
PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded
bool UpdateSDKDirectoryInfosIfNeeded()
Definition: PlatformRemoteDarwinDevice.cpp:143
lldb_private::Platform::m_sdk_sysroot
ConstString m_sdk_sysroot
Definition: Platform.h:883
lldb_private::Stream
Definition: Stream.h:28
LLDB_LOGV
#define LLDB_LOGV(log,...)
Definition: Log.h:256
PlatformDarwin
Definition: PlatformDarwin.h:25
Process.h
PlatformRemoteDarwinDevice::GetDeviceSupportDirectory
const char * GetDeviceSupportDirectory()
Definition: PlatformRemoteDarwinDevice.cpp:337
PlatformRemoteDarwinDevice::GetSymbolFile
virtual lldb_private::Status GetSymbolFile(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file)
Definition: PlatformRemoteDarwinDevice.cpp:440
Target.h
lldb_private::ModuleSpec::GetUUID
UUID & GetUUID()
Definition: ModuleSpec.h:105
PlatformRemoteDarwinDevice::SDKDirectoryInfo::version
llvm::VersionTuple version
Definition: PlatformRemoteDarwinDevice.h:56
LIBLLDB_LOG_HOST
#define LIBLLDB_LOG_HOST
Definition: Logging.h:28
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
PlatformRemoteDarwinDevice::GetFileInSDK
bool GetFileInSDK(const char *platform_file_path, uint32_t sdk_idx, lldb_private::FileSpec &local_file)
Definition: PlatformRemoteDarwinDevice.cpp:407
PlatformRemoteDarwinDevice::m_sdk_dir_mutex
std::mutex m_sdk_dir_mutex
Definition: PlatformRemoteDarwinDevice.h:62
ModuleList.h
lldb_private::ConstString::SetString
void SetString(const llvm::StringRef &s)
Definition: ConstString.cpp:306
lldb_private::ConstString::GetStringRef
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:202
Log.h
PlatformRemoteDarwinDevice::GetSharedModule
lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr) override
Definition: PlatformRemoteDarwinDevice.cpp:500
PlatformRemoteDarwinDevice::SDKDirectoryInfo::directory
lldb_private::FileSpec directory
Definition: PlatformRemoteDarwinDevice.h:54
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
StreamString.h
lldb_private::FileSystem::EnumerateDirectoryResult
EnumerateDirectoryResult
Definition: FileSystem.h:162
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
PlatformRemoteDarwinDevice::GetContainedFilesIntoVectorOfStringsCallback
static lldb_private::FileSystem::EnumerateDirectoryResult GetContainedFilesIntoVectorOfStringsCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
Definition: PlatformRemoteDarwinDevice.cpp:136
HostInfo.h
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:38
PlatformRemoteDarwinDevice::m_device_support_directory
std::string m_device_support_directory
Definition: PlatformRemoteDarwinDevice.h:64
lldb_private::ArchSpec::IsValid
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:342
PlatformDarwin::FindBundleBinaryInExecSearchPaths
lldb_private::Status FindBundleBinaryInExecSearchPaths(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
Definition: PlatformDarwin.cpp:1728
PlatformRemoteDarwinDevice::~PlatformRemoteDarwinDevice
~PlatformRemoteDarwinDevice() override
Destructor.
Definition: PlatformRemoteDarwinDevice.cpp:50
PlatformRemoteDarwinDevice::GetDeviceSupportDirectoryName
virtual llvm::StringRef GetDeviceSupportDirectoryName()=0
lldb_private::FileSpec::Clear
void Clear()
Clears the object state.
Definition: FileSpec.cpp:261
PlatformRemoteDarwinDevice::GetStatus
void GetStatus(lldb_private::Stream &strm) override
Report the current status for this platform.
Definition: PlatformRemoteDarwinDevice.cpp:52
PlatformRemoteDarwinDevice::GetPlatformName
virtual llvm::StringRef GetPlatformName()=0
lldb_private::ModuleSpec::GetFileSpec
FileSpec & GetFileSpec()
Definition: ModuleSpec.h:59
lldb_private::ModuleSpec
Definition: ModuleSpec.h:26
lldb_private::Status
Definition: Status.h:44
lldb_private::ArchSpec::GetArchitectureName
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition: ArchSpec.cpp:538
uint32_t
PlatformDarwin::GetSharedModuleWithLocalCache
virtual lldb_private::Status GetSharedModuleWithLocalCache(const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
Definition: PlatformDarwin.cpp:221
PlatformRemoteDarwinDevice::m_connected_module_sdk_idx
uint32_t m_connected_module_sdk_idx
Definition: PlatformRemoteDarwinDevice.h:68
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
PlatformRemoteDarwinDevice::m_sdk_directory_infos
SDKDirectoryInfoCollection m_sdk_directory_infos
Definition: PlatformRemoteDarwinDevice.h:63
PluginManager.h
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
lldb_private::ModuleSpec::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:95
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
Status.h
PlatformRemoteDarwinDevice::FindFileInAllSDKs
uint32_t FindFileInAllSDKs(const char *platform_file_path, lldb_private::FileSpecList &file_list)
lldb_private::FileSpec::AppendPathComponent
void AppendPathComponent(llvm::StringRef component)
Definition: FileSpec.cpp:435
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
FileSpec.h
PlatformRemoteDarwinDevice::SDKDirectoryInfo::SDKDirectoryInfo
SDKDirectoryInfo(const lldb_private::FileSpec &sdk_dir_spec)
Definition: PlatformRemoteDarwinDevice.cpp:29
lldb_private::Log
Definition: Log.h:49
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
PlatformDarwin::ParseVersionBuildDir
static std::tuple< llvm::VersionTuple, llvm::StringRef > ParseVersionBuildDir(llvm::StringRef str)
Definition: PlatformDarwin.cpp:1373
lldb_private::FileSpec::SetFile
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
Definition: FileSpec.cpp:174
lldb_private::PluginInterface::GetPluginName
virtual ConstString GetPluginName()=0
llvm::SmallVectorImpl
Definition: Disassembler.h:42
PlatformDarwin::GetOSVersion
llvm::VersionTuple GetOSVersion(lldb_private::Process *process=nullptr) override
Get the OS version from a connected platform.
Definition: PlatformDarwin.cpp:1624
PATH_MAX
#define PATH_MAX
Definition: windows/PosixApi.h:25
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:348
lldb
Definition: SBAddress.h:15
PlatformRemoteDarwinDevice::ResolveExecutable
lldb_private::Status ResolveExecutable(const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override
Definition: PlatformRemoteDarwinDevice.cpp:68
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:341
PlatformRemoteDarwinDevice::GetDeviceSupportDirectoryForOSVersion
const char * GetDeviceSupportDirectoryForOSVersion()
Definition: PlatformRemoteDarwinDevice.cpp:358
PlatformRemoteDarwinDevice::SDKDirectoryInfo::build
lldb_private::ConstString build
Definition: PlatformRemoteDarwinDevice.h:55
PlatformRemoteDarwinDevice::GetConnectedSDKIndex
uint32_t GetConnectedSDKIndex()
Definition: PlatformRemoteDarwinDevice.cpp:632
lldb_private::Platform::GetSupportedArchitectureAtIndex
virtual bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch)=0
Get the platform's supported architectures in the order in which they should be searched.