summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorMalcolm Parsons <malcolm.parsons@gmail.com>2016-11-02 20:34:10 +0000
committerMalcolm Parsons <malcolm.parsons@gmail.com>2016-11-02 20:34:10 +0000
commit771ef6d4f15452d76387cd66552a38122be60925 (patch)
tree78449c43ffd29ef2bd0801c9f8bf80fced0ef3e4 /lldb/source/Plugins/Process/gdb-remote
parent7463adadbf0ab2742b122a3d4adc8e2041c3ac01 (diff)
downloadbcm5719-llvm-771ef6d4f15452d76387cd66552a38122be60925.tar.gz
bcm5719-llvm-771ef6d4f15452d76387cd66552a38122be60925.zip
Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: zturner, labath Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: https://reviews.llvm.org/D26233 llvm-svn: 285855
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp16
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp17
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp4
6 files changed, 21 insertions, 24 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 06b1b36cd59..601942808c5 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -880,8 +880,8 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len,
}
}
- m_history.AddPacket(m_bytes.c_str(), total_length,
- History::ePacketTypeRecv, total_length);
+ m_history.AddPacket(m_bytes, total_length, History::ePacketTypeRecv,
+ total_length);
// Clear packet_str in case there is some existing data in it.
packet_str.clear();
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 600bd9ca939..da629089a6c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -345,7 +345,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
packet.PutCString("qSupported");
for (uint32_t i = 0; i < features.size(); ++i) {
packet.PutCString(i == 0 ? ":" : ";");
- packet.PutCString(features[i].c_str());
+ packet.PutCString(features[i]);
}
StringExtractorGDBRemote response;
@@ -1070,7 +1070,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
if (avail_type != CompressionType::None) {
StringExtractorGDBRemote response;
std::string packet = "QEnableCompression:type:" + avail_name + ";";
- if (SendPacketAndWaitForResponse(packet.c_str(), response, false) !=
+ if (SendPacketAndWaitForResponse(packet, response, false) !=
PacketResult::Success)
return;
@@ -1772,7 +1772,7 @@ bool GDBRemoteCommunicationClient::DecodeProcessInfoResponse(
// control the characters in a process name
std::string name;
extractor.GetHexByteString(name);
- process_info.GetExecutableFile().SetFile(name.c_str(), false);
+ process_info.GetExecutableFile().SetFile(name, false);
} else if (name.equals("cputype")) {
value.getAsInteger(0, cpu);
} else if (name.equals("cpusubtype")) {
@@ -2015,7 +2015,7 @@ uint32_t GDBRemoteCommunicationClient::FindProcesses(
match_info.GetProcessInfo().GetArchitecture();
const llvm::Triple &triple = match_arch.GetTriple();
packet.PutCString("triple:");
- packet.PutCString(triple.getTriple().c_str());
+ packet.PutCString(triple.getTriple());
packet.PutChar(';');
}
}
@@ -3201,7 +3201,7 @@ bool GDBRemoteCommunicationClient::GetModuleInfo(
StringExtractor extractor(value);
std::string path;
extractor.GetHexByteString(path);
- module_spec.GetFileSpec() = FileSpec(path.c_str(), false, arch_spec);
+ module_spec.GetFileSpec() = FileSpec(path, false, arch_spec);
}
}
@@ -3322,7 +3322,7 @@ bool GDBRemoteCommunicationClient::ReadExtFeature(
<< "," << std::hex << size;
GDBRemoteCommunication::PacketResult res =
- SendPacketAndWaitForResponse(packet.str().c_str(), chunk, false);
+ SendPacketAndWaitForResponse(packet.str(), chunk, false);
if (res != GDBRemoteCommunication::PacketResult::Success) {
err.SetErrorString("Error sending $qXfer packet");
@@ -3609,8 +3609,8 @@ Error GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
// Send the packet.
const bool send_async = false;
StringExtractorGDBRemote response;
- auto result = SendPacketAndWaitForResponse(stream.GetString().c_str(),
- response, send_async);
+ auto result =
+ SendPacketAndWaitForResponse(stream.GetString(), response, send_async);
if (result == PacketResult::Success) {
// We failed if the config result comes back other than OK.
if (strcmp(response.GetStringRef().c_str(), "OK") == 0) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index 7c46c21261d..28d94f8949a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -358,8 +358,7 @@ GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo(
StringExtractor extractor(value);
std::string file;
extractor.GetHexByteString(file);
- match_info.GetProcessInfo().GetExecutableFile().SetFile(file.c_str(),
- false);
+ match_info.GetProcessInfo().GetExecutableFile().SetFile(file, false);
} else if (key.equals("name_match")) {
NameMatchType name_match =
llvm::StringSwitch<NameMatchType>(value)
@@ -644,8 +643,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Size(
std::string path;
packet.GetHexByteString(path);
if (!path.empty()) {
- lldb::user_id_t retcode =
- FileSystem::GetFileSize(FileSpec(path.c_str(), false));
+ lldb::user_id_t retcode = FileSystem::GetFileSize(FileSpec(path, false));
StreamString response;
response.PutChar('F');
response.PutHex64(retcode);
@@ -684,7 +682,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Exists(
std::string path;
packet.GetHexByteString(path);
if (!path.empty()) {
- bool retcode = FileSystem::GetFileExists(FileSpec(path.c_str(), false));
+ bool retcode = FileSystem::GetFileExists(FileSpec(path, false));
StreamString response;
response.PutChar('F');
response.PutChar(',');
@@ -776,7 +774,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_MD5(
if (!path.empty()) {
uint64_t a, b;
StreamGDBRemote response;
- if (!FileSystem::CalculateMD5(FileSpec(path.c_str(), false), a, b)) {
+ if (!FileSystem::CalculateMD5(FileSpec(path, false), a, b)) {
response.PutCString("F,");
response.PutCString("x");
} else {
@@ -1031,8 +1029,7 @@ GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) {
if (success) {
if (arg_idx == 0)
- m_process_launch_info.GetExecutableFile().SetFile(arg.c_str(),
- false);
+ m_process_launch_info.GetExecutableFile().SetFile(arg, false);
m_process_launch_info.GetArguments().AppendArgument(arg);
if (log)
log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"",
@@ -1276,7 +1273,7 @@ FileSpec GDBRemoteCommunicationServerCommon::FindModuleFile(
#ifdef __ANDROID__
return HostInfoAndroid::ResolveLibraryPath(module_path, arch);
#else
- return FileSpec(module_path.c_str(), true);
+ return FileSpec(module_path, true);
#endif
}
@@ -1284,7 +1281,7 @@ ModuleSpec GDBRemoteCommunicationServerCommon::GetModuleInfo(
const std::string &module_path, const std::string &triple) {
ArchSpec arch(triple.c_str());
- const FileSpec req_module_path_spec(module_path.c_str(), true);
+ const FileSpec req_module_path_spec(module_path, true);
const FileSpec module_path_spec =
FindModuleFile(req_module_path_spec.GetPath(), arch);
const ModuleSpec module_spec(module_path_spec, arch);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 754cdb03de5..0897611e6d6 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -667,7 +667,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(
if (::strcspn(thread_name.c_str(), "$#+-;:") == thread_name_len) {
response.PutCString("name:");
- response.PutCString(thread_name.c_str());
+ response.PutCString(thread_name);
} else {
// The thread name contains special chars, send as hex bytes.
response.PutCString("hexname:");
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 80d6b8a756d..33b60b5711d 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -128,7 +128,7 @@ Error GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
std::string platform_ip;
int platform_port;
std::string platform_path;
- bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme,
+ bool ok = UriParser::Parse(GetConnection()->GetURI(), platform_scheme,
platform_ip, platform_port, platform_path);
UNUSED_IF_ASSERT_DISABLED(ok);
assert(ok);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index f96bfe7baeb..4a3cc7f7a34 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2321,7 +2321,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
reason = "watchpoint";
StreamString ostr;
ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
- description = ostr.GetString().c_str();
+ description = ostr.GetString();
} else if (key.compare("library") == 0) {
LoadModules();
} else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
@@ -4579,7 +4579,7 @@ size_t ProcessGDBRemote::LoadModules(LoadedModuleInfoList &module_list) {
if (!modInfo.get_link_map(link_map))
link_map = LLDB_INVALID_ADDRESS;
- FileSpec file(mod_name.c_str(), true);
+ FileSpec file(mod_name, true);
lldb::ModuleSP module_sp =
LoadModuleAtAddress(file, link_map, mod_base, mod_base_is_offset);
OpenPOWER on IntegriCloud