31PlatformRemoteDarwinDevice::SDKDirectoryInfo::SDKDirectoryInfo(
33 : directory(sdk_dir), build(), user_cached(false) {
35 llvm::StringRef build_str;
36 std::tie(version, build_str) = ParseVersionBuildDir(dirname_str);
37 build.SetString(build_str);
54 strm.
Printf(
" SDK Path: \"%s\"\n", sdk_directory);
56 strm.
PutCString(
" SDK Path: error: unable to locate SDK\n");
59 for (uint32_t i = 0; i < num_sdk_infos; ++i) {
61 strm.
Printf(
" SDK Roots: [%2u] \"%s\"\n", i,
83 nullptr,
nullptr,
nullptr);
85 if (exe_module_sp && exe_module_sp->GetObjectFile())
87 exe_module_sp.reset();
93 llvm::ListSeparator LS;
98 nullptr,
nullptr,
nullptr);
100 if (
error.Success()) {
101 if (exe_module_sp && exe_module_sp->GetObjectFile())
104 error.SetErrorToGenericError();
107 arch_names << LS << arch.GetArchitectureName();
110 if (
error.Fail() || !exe_module_sp) {
112 error.SetErrorStringWithFormatv(
113 "'{0}' doesn't contain any '{1}' platform architectures: {2}",
117 error.SetErrorStringWithFormat(
118 "'%s' is not readable",
123 error.SetErrorStringWithFormat(
124 "'%s' does not exist",
136 std::string sdkroot_path =
140 if (!sdkroot_path.empty() && platform_file_path && platform_file_path[0]) {
145 const char *paths_to_try[] = {
"Symbols",
"",
"Symbols.Internal",
nullptr};
146 for (
size_t i = 0; paths_to_try[i] !=
nullptr; i++) {
147 local_file.
SetFile(sdkroot_path, FileSpec::Style::native);
148 if (paths_to_try[i][0] !=
'\0')
153 LLDB_LOGF(log,
"Found a copy of %s in the SDK dir %s/%s",
154 platform_file_path, sdkroot_path.c_str(), paths_to_try[i]);
165 const UUID *uuid_ptr,
170 if (platform_file.
GetPath(platform_file_path,
sizeof(platform_file_path))) {
172 if (os_version_dir) {
173 std::string resolved_path =
174 (llvm::Twine(os_version_dir) +
"/" + platform_file_path).str();
176 local_file.
SetFile(resolved_path, FileSpec::Style::native);
180 LLDB_LOGF(log,
"Found a copy of %s in the DeviceSupport dir %s",
181 platform_file_path, os_version_dir);
186 resolved_path = (llvm::Twine(os_version_dir) +
"/Symbols.Internal/" +
190 local_file.
SetFile(resolved_path, FileSpec::Style::native);
195 "Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal",
196 platform_file_path, os_version_dir);
200 (llvm::Twine(os_version_dir) +
"/Symbols/" + platform_file_path)
203 local_file.
SetFile(resolved_path, FileSpec::Style::native);
206 LLDB_LOGF(log,
"Found a copy of %s in the DeviceSupport dir %s/Symbols",
207 platform_file_path, os_version_dir);
211 local_file = platform_file;
215 error.SetErrorStringWithFormatv(
216 "unable to locate a platform file for '{0}' in platform '{1}'",
219 error.SetErrorString(
"invalid platform file argument");
237 if (platform_file.
GetPath(platform_file_path,
sizeof(platform_file_path))) {
247 if (connected_sdk_idx < num_sdk_infos) {
248 LLDB_LOGV(log,
"Searching for {0} in sdk path {1}", platform_file,
265 LLDB_LOGV(log,
"Searching for {0} in sdk path {1}", platform_file,
283 const uint32_t current_sdk_idx =
285 if (current_sdk_idx < num_sdk_infos &&
287 LLDB_LOGV(log,
"Searching for {0} in sdk path {1}", platform_file,
302 for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
307 LLDB_LOGV(log,
"Searching for {0} in sdk path {1}", platform_file,
330 module_search_paths_ptr, old_modules,
339 module_spec, process, module_sp, module_search_paths_ptr, old_modules,
345 const bool always_create =
false;
347 module_search_paths_ptr, old_modules,
348 did_create_ptr, always_create);
351 module_sp->SetPlatformFileSpec(platform_file);
361 for (uint32_t i = 0; i < num_sdk_infos; ++i) {
378 if (sdk_info ==
nullptr) {
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
#define LLDB_LOGV(log,...)
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
void AppendPathComponent(llvm::StringRef component)
const ConstString & GetFilename() const
Filename string const get accessor.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void Clear()
Clears the object state.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
static FileSystem & Instance()
static bool ResolveExecutableInBundle(FileSpec &file)
When executable files may live within a directory, where the directory represents an executable bundl...
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool always_create=false)
ArchSpec & GetArchitecture()
virtual llvm::StringRef GetPluginName()=0
A plug-in interface definition class for debugging a process.
const char * GetData() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::Module > ModuleSP