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