summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Interpreter/OptionGroupArchitecture.h5
-rw-r--r--lldb/include/lldb/Target/TargetList.h16
-rw-r--r--lldb/source/API/SBDebugger.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp2
-rw-r--r--lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp6
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp4
-rw-r--r--lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp6
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp2
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp4
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp8
-rw-r--r--lldb/source/Target/Platform.cpp4
-rw-r--r--lldb/source/Target/TargetList.cpp40
13 files changed, 51 insertions, 51 deletions
diff --git a/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h b/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
index 13543245761..742cd6d1321 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
@@ -33,7 +33,6 @@ public:
Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
- Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
@@ -41,9 +40,7 @@ public:
bool ArchitectureWasSpecified() const { return !m_arch_str.empty(); }
- const char *GetArchitectureName() {
- return (m_arch_str.empty() ? nullptr : m_arch_str.c_str());
- }
+ llvm::StringRef GetArchitectureName() const { return m_arch_str; }
protected:
std::string m_arch_str; // Save the arch triple in case a platform is
diff --git a/lldb/include/lldb/Target/TargetList.h b/lldb/include/lldb/Target/TargetList.h
index d231d0c467c..81b81dba775 100644
--- a/lldb/include/lldb/Target/TargetList.h
+++ b/lldb/include/lldb/Target/TargetList.h
@@ -91,8 +91,8 @@ public:
/// @return
/// An error object that indicates success or failure
//------------------------------------------------------------------
- Error CreateTarget(Debugger &debugger, const char *user_exe_path,
- const char *triple_cstr, bool get_dependent_modules,
+ Error CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str, bool get_dependent_modules,
const OptionGroupPlatform *platform_options,
lldb::TargetSP &target_sp);
@@ -102,7 +102,7 @@ public:
/// Same as the function above, but used when you already know the
/// platform you will be using
//------------------------------------------------------------------
- Error CreateTarget(Debugger &debugger, const char *user_exe_path,
+ Error CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path,
const ArchSpec &arch, bool get_dependent_modules,
lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp);
@@ -211,15 +211,17 @@ protected:
private:
lldb::TargetSP GetDummyTarget(lldb_private::Debugger &debugger);
- Error CreateDummyTarget(Debugger &debugger, const char *specified_arch_name,
+ Error CreateDummyTarget(Debugger &debugger,
+ llvm::StringRef specified_arch_name,
lldb::TargetSP &target_sp);
- Error CreateTargetInternal(Debugger &debugger, const char *user_exe_path,
- const char *triple_cstr, bool get_dependent_files,
+ Error CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str,
+ bool get_dependent_files,
const OptionGroupPlatform *platform_options,
lldb::TargetSP &target_sp, bool is_dummy_target);
- Error CreateTargetInternal(Debugger &debugger, const char *user_exe_path,
+ Error CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
const ArchSpec &arch, bool get_dependent_modules,
lldb::PlatformSP &platform_sp,
lldb::TargetSP &target_sp, bool is_dummy_target);
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index e8f55424ae7..c74bc759602 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -603,8 +603,7 @@ SBTarget SBDebugger::CreateTarget(const char *filename) {
Error error;
const bool add_dependent_modules = true;
error = m_opaque_sp->GetTargetList().CreateTarget(
- *m_opaque_sp, filename, nullptr, add_dependent_modules, nullptr,
- target_sp);
+ *m_opaque_sp, filename, "", add_dependent_modules, nullptr, target_sp);
if (error.Success()) {
m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp.get());
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 144ba3f1c48..fd3795e0859 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -472,7 +472,7 @@ protected:
Error error;
error = m_interpreter.GetDebugger().GetTargetList().CreateTarget(
- m_interpreter.GetDebugger(), nullptr, nullptr, false,
+ m_interpreter.GetDebugger(), "", "", false,
nullptr, // No platform options
new_target_sp);
target = new_target_sp.get();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index d36adb46abf..d2e53aa4a14 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -278,7 +278,7 @@ protected:
Debugger &debugger = m_interpreter.GetDebugger();
TargetSP target_sp;
- const char *arch_cstr = m_arch_option.GetArchitectureName();
+ llvm::StringRef arch_cstr = m_arch_option.GetArchitectureName();
const bool get_dependent_files =
m_add_dependents.GetOptionValue().GetCurrentValue();
Error error(debugger.GetTargetList().CreateTarget(
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index 9a6a375d23c..9ea97a5f70b 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -582,9 +582,9 @@ lldb::ProcessSP PlatformFreeBSD::Attach(ProcessAttachInfo &attach_info,
TargetSP new_target_sp;
ArchSpec emptyArchSpec;
- error = debugger.GetTargetList().CreateTarget(
- debugger, NULL, emptyArchSpec, false, m_remote_platform_sp,
- new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", emptyArchSpec,
+ false, m_remote_platform_sp,
+ new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 8c2b370c17b..270fe53ca9f 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -565,8 +565,8 @@ PlatformLinux::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
log->Printf("PlatformLinux::%s creating new target", __FUNCTION__);
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(
- debugger, nullptr, nullptr, false, nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
+ nullptr, new_target_sp);
if (error.Fail()) {
if (log)
log->Printf("PlatformLinux::%s failed to create new target: %s",
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
index 6ae6252ac25..bc4bfd32aad 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -520,9 +520,9 @@ lldb::ProcessSP PlatformNetBSD::Attach(ProcessAttachInfo &attach_info,
TargetSP new_target_sp;
ArchSpec emptyArchSpec;
- error = debugger.GetTargetList().CreateTarget(
- debugger, NULL, emptyArchSpec, false, m_remote_platform_sp,
- new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", emptyArchSpec,
+ false, m_remote_platform_sp,
+ new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 569a862d3ea..676e330c625 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -629,7 +629,7 @@ lldb::ProcessSP PlatformPOSIX::Attach(ProcessAttachInfo &attach_info,
if (target == NULL) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, NULL, NULL, false,
+ error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
NULL, new_target_sp);
target = new_target_sp.get();
if (log)
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index f16ebc463e1..290d8eab792 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -474,8 +474,8 @@ lldb::ProcessSP PlatformWindows::Attach(ProcessAttachInfo &attach_info,
FileSpec emptyFileSpec;
ArchSpec emptyArchSpec;
- error = debugger.GetTargetList().CreateTarget(
- debugger, nullptr, nullptr, false, nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
+ nullptr, new_target_sp);
target = new_target_sp.get();
}
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 7962ca82c84..43f7a53d0f7 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -505,8 +505,8 @@ lldb::ProcessSP PlatformRemoteGDBServer::DebugProcess(
if (target == NULL) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(
- debugger, NULL, NULL, false, NULL, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
+ NULL, new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
@@ -592,8 +592,8 @@ lldb::ProcessSP PlatformRemoteGDBServer::Attach(
if (target == NULL) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(
- debugger, NULL, NULL, false, NULL, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
+ NULL, new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index d25c3b25adf..43371ec2361 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1767,8 +1767,8 @@ lldb::ProcessSP Platform::ConnectProcess(llvm::StringRef connect_url,
if (!target) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(
- debugger, nullptr, nullptr, false, nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
+ nullptr, new_target_sp);
target = new_target_sp.get();
}
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 97910cebb20..8d4d238df4e 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -55,17 +55,19 @@ TargetList::~TargetList() {
m_target_list.clear();
}
-Error TargetList::CreateTarget(Debugger &debugger, const char *user_exe_path,
- const char *triple_cstr,
+Error TargetList::CreateTarget(Debugger &debugger,
+ llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str,
bool get_dependent_files,
const OptionGroupPlatform *platform_options,
TargetSP &target_sp) {
- return CreateTargetInternal(debugger, user_exe_path, triple_cstr,
+ return CreateTargetInternal(debugger, user_exe_path, triple_str,
get_dependent_files, platform_options, target_sp,
false);
}
-Error TargetList::CreateTarget(Debugger &debugger, const char *user_exe_path,
+Error TargetList::CreateTarget(Debugger &debugger,
+ llvm::StringRef user_exe_path,
const ArchSpec &specified_arch,
bool get_dependent_files,
PlatformSP &platform_sp, TargetSP &target_sp) {
@@ -75,19 +77,21 @@ Error TargetList::CreateTarget(Debugger &debugger, const char *user_exe_path,
}
Error TargetList::CreateTargetInternal(
- Debugger &debugger, const char *user_exe_path, const char *triple_cstr,
- bool get_dependent_files, const OptionGroupPlatform *platform_options,
- TargetSP &target_sp, bool is_dummy_target) {
+ Debugger &debugger, llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str, bool get_dependent_files,
+ const OptionGroupPlatform *platform_options, TargetSP &target_sp,
+ bool is_dummy_target) {
Error error;
PlatformSP platform_sp;
// This is purposely left empty unless it is specified by triple_cstr.
// If not initialized via triple_cstr, then the currently selected platform
// will set the architecture correctly.
- const ArchSpec arch(triple_cstr);
- if (triple_cstr && triple_cstr[0]) {
+ const ArchSpec arch(triple_str);
+ if (!triple_str.empty()) {
if (!arch.IsValid()) {
- error.SetErrorStringWithFormat("invalid triple '%s'", triple_cstr);
+ error.SetErrorStringWithFormat("invalid triple '%s'",
+ triple_str.str().c_str());
return error;
}
}
@@ -113,7 +117,7 @@ Error TargetList::CreateTargetInternal(
}
}
- if (user_exe_path && user_exe_path[0]) {
+ if (!user_exe_path.empty()) {
ModuleSpecList module_specs;
ModuleSpec module_spec;
module_spec.GetFileSpec().SetFile(user_exe_path, true);
@@ -306,7 +310,7 @@ lldb::TargetSP TargetList::GetDummyTarget(lldb_private::Debugger &debugger) {
}
Error TargetList::CreateDummyTarget(Debugger &debugger,
- const char *specified_arch_name,
+ llvm::StringRef specified_arch_name,
lldb::TargetSP &target_sp) {
PlatformSP host_platform_sp(Platform::GetHostPlatform());
return CreateTargetInternal(
@@ -315,7 +319,7 @@ Error TargetList::CreateDummyTarget(Debugger &debugger,
}
Error TargetList::CreateTargetInternal(Debugger &debugger,
- const char *user_exe_path,
+ llvm::StringRef user_exe_path,
const ArchSpec &specified_arch,
bool get_dependent_files,
lldb::PlatformSP &platform_sp,
@@ -341,7 +345,7 @@ Error TargetList::CreateTargetInternal(Debugger &debugger,
arch = specified_arch;
FileSpec file(user_exe_path, false);
- if (!file.Exists() && user_exe_path && user_exe_path[0] == '~') {
+ if (!file.Exists() && 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
@@ -361,11 +365,9 @@ Error TargetList::CreateTargetInternal(Debugger &debugger,
if (file.GetFileType() == FileSpec::eFileTypeDirectory)
user_exe_path_is_bundle = true;
- if (file.IsRelative() && user_exe_path) {
+ if (file.IsRelative() && !user_exe_path.empty()) {
// Ignore paths that start with "./" and "../"
- if (!((user_exe_path[0] == '.' && user_exe_path[1] == '/') ||
- (user_exe_path[0] == '.' && user_exe_path[1] == '.' &&
- user_exe_path[2] == '/'))) {
+ if (!user_exe_path.startswith("./") && !user_exe_path.startswith("../")) {
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd))) {
std::string cwd_user_exe_path(cwd);
@@ -417,7 +419,7 @@ Error TargetList::CreateTargetInternal(Debugger &debugger,
// Set argv0 with what the user typed, unless the user specified a
// directory. If the user specified a directory, then it is probably a
// bundle that was resolved and we need to use the resolved bundle path
- if (user_exe_path) {
+ if (!user_exe_path.empty()) {
// Use exactly what the user typed as the first argument when we exec or
// posix_spawn
if (user_exe_path_is_bundle && resolved_bundle_exe_path[0]) {
OpenPOWER on IntegriCloud