diff options
author | Pavel Labath <pavel@labath.sk> | 2019-02-12 14:28:55 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-02-12 14:28:55 +0000 |
commit | 7f815a9a427d149604ec7cfececee132c21b7505 (patch) | |
tree | 3eff5617f5748f455e23f3a9ba81ce0f86694402 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | |
parent | 6597fdd508f248f8bbb70b6fbf34b940677f2767 (diff) | |
download | bcm5719-llvm-7f815a9a427d149604ec7cfececee132c21b7505.tar.gz bcm5719-llvm-7f815a9a427d149604ec7cfececee132c21b7505.zip |
Have Stream::PutCStringAsRawHex8 take llvm::StringRef
This enables the function to be called with a StringRef without jumping
through any hoops. I rename the function to "PutStringAsRawHex8" to
honor the extended interface. I also remove ".c_str()" from any calls to
this function I could find.
llvm-svn: 353841
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 8a5bbc33b0c..afa8e9c37ad 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1746,7 +1746,7 @@ int GDBRemoteCommunicationClient::SetSTDIN(const FileSpec &file_spec) { std::string path{file_spec.GetPath(false)}; StreamString packet; packet.PutCString("QSetSTDIN:"); - packet.PutCStringAsRawHex8(path.c_str()); + packet.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet.GetString(), response, false) == @@ -1766,7 +1766,7 @@ int GDBRemoteCommunicationClient::SetSTDOUT(const FileSpec &file_spec) { std::string path{file_spec.GetPath(false)}; StreamString packet; packet.PutCString("QSetSTDOUT:"); - packet.PutCStringAsRawHex8(path.c_str()); + packet.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet.GetString(), response, false) == @@ -1786,7 +1786,7 @@ int GDBRemoteCommunicationClient::SetSTDERR(const FileSpec &file_spec) { std::string path{file_spec.GetPath(false)}; StreamString packet; packet.PutCString("QSetSTDERR:"); - packet.PutCStringAsRawHex8(path.c_str()); + packet.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet.GetString(), response, false) == @@ -1822,7 +1822,7 @@ int GDBRemoteCommunicationClient::SetWorkingDir(const FileSpec &working_dir) { std::string path{working_dir.GetPath(false)}; StreamString packet; packet.PutCString("QSetWorkingDir:"); - packet.PutCStringAsRawHex8(path.c_str()); + packet.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet.GetString(), response, false) == @@ -2792,7 +2792,7 @@ lldb_private::Status GDBRemoteCommunicationClient::RunShellCommand( if (working_dir) { std::string path{working_dir.GetPath(false)}; stream.PutChar(','); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); } StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == @@ -2829,7 +2829,7 @@ Status GDBRemoteCommunicationClient::MakeDirectory(const FileSpec &file_spec, stream.PutCString("qPlatform_mkdir:"); stream.PutHex32(file_permissions); stream.PutChar(','); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); llvm::StringRef packet = stream.GetString(); StringExtractorGDBRemote response; @@ -2851,7 +2851,7 @@ GDBRemoteCommunicationClient::SetFilePermissions(const FileSpec &file_spec, stream.PutCString("qPlatform_chmod:"); stream.PutHex32(file_permissions); stream.PutChar(','); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); llvm::StringRef packet = stream.GetString(); StringExtractorGDBRemote response; @@ -2892,7 +2892,7 @@ GDBRemoteCommunicationClient::OpenFile(const lldb_private::FileSpec &file_spec, stream.PutCString("vFile:open:"); if (path.empty()) return UINT64_MAX; - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); stream.PutChar(','); stream.PutHex32(flags); stream.PutChar(','); @@ -2923,7 +2923,7 @@ lldb::user_id_t GDBRemoteCommunicationClient::GetFileSize( std::string path(file_spec.GetPath(false)); lldb_private::StreamString stream; stream.PutCString("vFile:size:"); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { @@ -2942,7 +2942,7 @@ GDBRemoteCommunicationClient::GetFilePermissions(const FileSpec &file_spec, Status error; lldb_private::StreamString stream; stream.PutCString("vFile:mode:"); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { @@ -3044,9 +3044,9 @@ Status GDBRemoteCommunicationClient::CreateSymlink(const FileSpec &src, stream.PutCString("vFile:symlink:"); // the unix symlink() command reverses its parameters where the dst if first, // so we follow suit here - stream.PutCStringAsRawHex8(dst_path.c_str()); + stream.PutStringAsRawHex8(dst_path); stream.PutChar(','); - stream.PutCStringAsRawHex8(src_path.c_str()); + stream.PutStringAsRawHex8(src_path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { @@ -3077,7 +3077,7 @@ Status GDBRemoteCommunicationClient::Unlink(const FileSpec &file_spec) { stream.PutCString("vFile:unlink:"); // the unix symlink() command reverses its parameters where the dst if first, // so we follow suit here - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { @@ -3107,7 +3107,7 @@ bool GDBRemoteCommunicationClient::GetFileExists( std::string path(file_spec.GetPath(false)); lldb_private::StreamString stream; stream.PutCString("vFile:exists:"); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { @@ -3126,7 +3126,7 @@ bool GDBRemoteCommunicationClient::CalculateMD5( std::string path(file_spec.GetPath(false)); lldb_private::StreamString stream; stream.PutCString("vFile:MD5:"); - stream.PutCStringAsRawHex8(path.c_str()); + stream.PutStringAsRawHex8(path); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response, false) == PacketResult::Success) { @@ -3507,10 +3507,10 @@ bool GDBRemoteCommunicationClient::GetModuleInfo( StreamString packet; packet.PutCString("qModuleInfo:"); - packet.PutCStringAsRawHex8(module_path.c_str()); + packet.PutStringAsRawHex8(module_path); packet.PutCString(";"); const auto &triple = arch_spec.GetTriple().getTriple(); - packet.PutCStringAsRawHex8(triple.c_str()); + packet.PutStringAsRawHex8(triple); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet.GetString(), response, false) != |