summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-08-27 15:52:29 +0000
committerZachary Turner <zturner@google.com>2016-08-27 15:52:29 +0000
commit26709df81deda2ef4ea143ba51caf9c3bb9b9398 (patch)
tree8bb811ce94d4a3fbf48204cf95496cc8dc530cdf /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
parent56658af2cb2329f5691b4e837b6c06aa3833f81e (diff)
downloadbcm5719-llvm-26709df81deda2ef4ea143ba51caf9c3bb9b9398.tar.gz
bcm5719-llvm-26709df81deda2ef4ea143ba51caf9c3bb9b9398.zip
Convert some functions to use StringRef instead of c_str, len
This started as an effort to change StringExtractor to store a StringRef internally instead of a std::string. I got that working locally with just 1 test failure which I was unable to figure out the cause of. But it was also a massive changelist due to a trickle down effect of changes. So I'm starting over, using what I learned from the first time to tackle smaller, more isolated changes hopefully leading up to a full conversion by the end. At first the changes (such as in this CL) will seem mostly a matter of preference and pointless otherwise. However, there are some places in my larger CL where using StringRef turned 20+ lines of code into 2, drastically simplifying logic. Hopefully once these go in they will illustrate some of the benefits of thinking in terms of StringRef. llvm-svn: 279917
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 3135bd8d4eb..4f632c96417 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -347,7 +347,7 @@ GDBRemoteCommunicationServerLLGS::SendWResponse (NativeProcessProtocol *process)
StreamGDBRemote response;
response.PutChar ('E');
response.PutHex8 (GDBRemoteServerError::eErrorExitStatus);
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
else
{
@@ -377,7 +377,7 @@ GDBRemoteCommunicationServerLLGS::SendWResponse (NativeProcessProtocol *process)
// POSIX exit status limited to unsigned 8 bits.
response.PutHex8 (return_code);
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
}
@@ -792,7 +792,7 @@ GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread (lldb::tid_t tid)
}
}
- return SendPacketNoLock (response.GetData(), response.GetSize());
+ return SendPacketNoLock (response.GetString());
}
void
@@ -969,7 +969,7 @@ GDBRemoteCommunicationServerLLGS::SendONotification (const char *buffer, uint32_
response.PutChar ('O');
response.PutBytesAsRawHex8 (buffer, len);
- return SendPacketNoLock (response.GetData (), response.GetSize ());
+ return SendPacketNoLock (response.GetString());
}
Error
@@ -1072,7 +1072,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qProcessInfo (StringExtractorGDBRemote
StreamString response;
CreateProcessInfoResponse_DebugServerStyle(proc_info, response);
- return SendPacketNoLock (response.GetData (), response.GetSize ());
+ return SendPacketNoLock (response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -1094,7 +1094,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qC (StringExtractorGDBRemote &packet)
StreamString response;
response.Printf ("QC%" PRIx64, thread_sp->GetID ());
- return SendPacketNoLock (response.GetData(), response.GetSize());
+ return SendPacketNoLock (response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -1150,7 +1150,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qGetWorkingDir (StringExtractorGDBRemot
{
StreamString response;
response.PutCStringAsRawHex8(working_dir.GetCString());
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
return SendErrorResponse(14);
@@ -1298,7 +1298,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vCont_actions (StringExtractorGDBRemote
StreamString response;
response.Printf("vCont;c;C;s;S");
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -1635,7 +1635,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo (StringExtractorGDBRemote
response.PutHex8 (reg_info->dynamic_size_dwarf_expr_bytes[i]);
response.PutChar(';');
}
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -1673,14 +1673,14 @@ GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo (StringExtractorGDBRemote
if (log)
log->Printf ("GDBRemoteCommunicationServerLLGS::%s() finished thread iteration", __FUNCTION__);
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qsThreadInfo (StringExtractorGDBRemote &packet)
{
// FIXME for now we return the full thread list in the initial packet and always do nothing here.
- return SendPacketNoLock ("l", 1);
+ return SendPacketNoLock ("l");
}
GDBRemoteCommunication::PacketResult
@@ -1757,7 +1757,7 @@ GDBRemoteCommunicationServerLLGS::Handle_p (StringExtractorGDBRemote &packet)
for (uint32_t i = 0; i < reg_value.GetByteSize (); ++i)
response.PutHex8 (data[i]);
- return SendPacketNoLock (response.GetData (), response.GetSize ());
+ return SendPacketNoLock (response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -2067,7 +2067,7 @@ GDBRemoteCommunicationServerLLGS::Handle_memory_read(StringExtractorGDBRemote &p
response.PutHex8(buf[i]);
}
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -2243,7 +2243,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo (StringExtractorGDBRe
}
}
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -2556,7 +2556,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qXfer_auxv_read (StringExtractorGDBRemo
if (done_with_buffer)
m_active_auxv_buffer_sp.reset ();
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
#else
return SendUnimplementedResponse ("not implemented on this platform");
#endif
@@ -2612,7 +2612,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState (StringExtractorGDBR
// Write the response.
StreamGDBRemote response;
response.Printf ("%" PRIu32, save_id);
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -2807,7 +2807,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jThreadsInfo (StringExtractorGDBRemote
threads_array_sp->Write(response);
StreamGDBRemote escaped_response;
escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
- return SendPacketNoLock (escaped_response.GetData(), escaped_response.GetSize());
+ return SendPacketNoLock (escaped_response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -2827,7 +2827,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qWatchpointSupportInfo (StringExtractor
uint32_t num = m_debugged_process_sp->GetMaxWatchpoints();
StreamGDBRemote response;
response.Printf ("num:%d;", num);
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
GDBRemoteCommunication::PacketResult
@@ -2855,7 +2855,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qFileLoadAddress (StringExtractorGDBRem
StreamGDBRemote response;
response.PutHex64(file_load_address);
- return SendPacketNoLock(response.GetData(), response.GetSize());
+ return SendPacketNoLock(response.GetString());
}
void
OpenPOWER on IntegriCloud