diff options
Diffstat (limited to 'source/Target/TargetList.cpp')
| -rw-r--r-- | source/Target/TargetList.cpp | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/source/Target/TargetList.cpp b/source/Target/TargetList.cpp index b9c852b414e2..5b262509cae7 100644 --- a/source/Target/TargetList.cpp +++ b/source/Target/TargetList.cpp @@ -7,14 +7,10 @@ // //===----------------------------------------------------------------------===// -// Project includes #include "lldb/Target/TargetList.h" -#include "lldb/Core/Broadcaster.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/Event.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" -#include "lldb/Core/State.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -22,10 +18,12 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" +#include "lldb/Utility/Broadcaster.h" +#include "lldb/Utility/Event.h" +#include "lldb/Utility/State.h" #include "lldb/Utility/TildeExpressionResolver.h" #include "lldb/Utility/Timer.h" -// Other libraries and framework includes #include "llvm/ADT/SmallString.h" #include "llvm/Support/FileSystem.h" @@ -58,27 +56,27 @@ TargetList::~TargetList() { Status TargetList::CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, - bool get_dependent_files, + LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp) { return CreateTargetInternal(debugger, user_exe_path, triple_str, - get_dependent_files, platform_options, target_sp, + load_dependent_files, platform_options, target_sp, false); } Status TargetList::CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, const ArchSpec &specified_arch, - bool get_dependent_files, + LoadDependentFiles load_dependent_files, PlatformSP &platform_sp, TargetSP &target_sp) { return CreateTargetInternal(debugger, user_exe_path, specified_arch, - get_dependent_files, platform_sp, target_sp, + load_dependent_files, platform_sp, target_sp, false); } Status TargetList::CreateTargetInternal( Debugger &debugger, llvm::StringRef user_exe_path, - llvm::StringRef triple_str, bool get_dependent_files, + llvm::StringRef triple_str, LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp, bool is_dummy_target) { Status error; @@ -120,8 +118,8 @@ Status TargetList::CreateTargetInternal( if (!user_exe_path.empty()) { ModuleSpecList module_specs; ModuleSpec module_spec; - module_spec.GetFileSpec().SetFile(user_exe_path, true, - FileSpec::Style::native); + module_spec.GetFileSpec().SetFile(user_exe_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(module_spec.GetFileSpec()); // Resolve the executable in case we are given a path to a application // bundle like a .app bundle on MacOSX @@ -236,7 +234,7 @@ Status TargetList::CreateTargetInternal( // All platforms for all modules in the executable match, so we can // select this platform platform_sp = platforms.front(); - } else if (more_than_one_platforms == false) { + } else if (!more_than_one_platforms) { // No platforms claim to support this file error.SetErrorString("No matching platforms found for this file, " "specify one with the --platform option"); @@ -292,7 +290,7 @@ Status TargetList::CreateTargetInternal( platform_arch = arch; error = TargetList::CreateTargetInternal( - debugger, user_exe_path, platform_arch, get_dependent_files, platform_sp, + debugger, user_exe_path, platform_arch, load_dependent_files, platform_sp, target_sp, is_dummy_target); return error; } @@ -315,14 +313,14 @@ Status TargetList::CreateDummyTarget(Debugger &debugger, lldb::TargetSP &target_sp) { PlatformSP host_platform_sp(Platform::GetHostPlatform()); return CreateTargetInternal( - debugger, (const char *)nullptr, specified_arch_name, false, + debugger, (const char *)nullptr, specified_arch_name, eLoadDependentsNo, (const OptionGroupPlatform *)nullptr, target_sp, true); } Status TargetList::CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, const ArchSpec &specified_arch, - bool get_dependent_files, + LoadDependentFiles load_dependent_files, lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp, bool is_dummy_target) { @@ -346,8 +344,8 @@ Status TargetList::CreateTargetInternal(Debugger &debugger, if (!arch.IsValid()) arch = specified_arch; - FileSpec file(user_exe_path, false); - if (!file.Exists() && user_exe_path.startswith("~")) { + FileSpec file(user_exe_path); + if (!FileSystem::Instance().Exists(file) && user_exe_path.startswith("~")) { // we want to expand the tilde but we don't want to resolve any symbolic // links so we can't use the FileSpec constructor's resolve flag llvm::SmallString<64> unglobbed_path; @@ -355,24 +353,24 @@ Status TargetList::CreateTargetInternal(Debugger &debugger, Resolver.ResolveFullPath(user_exe_path, unglobbed_path); if (unglobbed_path.empty()) - file = FileSpec(user_exe_path, false); + file = FileSpec(user_exe_path); else - file = FileSpec(unglobbed_path.c_str(), false); + file = FileSpec(unglobbed_path.c_str()); } bool user_exe_path_is_bundle = false; char resolved_bundle_exe_path[PATH_MAX]; resolved_bundle_exe_path[0] = '\0'; if (file) { - if (llvm::sys::fs::is_directory(file.GetPath())) + if (FileSystem::Instance().IsDirectory(file)) user_exe_path_is_bundle = true; if (file.IsRelative() && !user_exe_path.empty()) { llvm::SmallString<64> cwd; if (! llvm::sys::fs::current_path(cwd)) { - FileSpec cwd_file(cwd.c_str(), false); + FileSpec cwd_file(cwd.c_str()); cwd_file.AppendPathComponent(file); - if (cwd_file.Exists()) + if (FileSystem::Instance().Exists(cwd_file)) file = cwd_file; } } @@ -401,7 +399,7 @@ Status TargetList::CreateTargetInternal(Debugger &debugger, return error; } target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target)); - target_sp->SetExecutableModule(exe_module_sp, get_dependent_files); + target_sp->SetExecutableModule(exe_module_sp, load_dependent_files); if (user_exe_path_is_bundle) exe_module_sp->GetFileSpec().GetPath(resolved_bundle_exe_path, sizeof(resolved_bundle_exe_path)); |
