aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-08-21 04:55:56 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-08-21 04:55:56 +0000
commitd35b42f20a48d6fd9c1f8fce095c37794d49806c (patch)
tree393063216884d10d5efef46472ada966725a2e85 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parent7483005c59828482aa28e09c7a132628b4054e29 (diff)
downloadllvm-d35b42f20a48d6fd9c1f8fce095c37794d49806c.zip
llvm-d35b42f20a48d6fd9c1f8fce095c37794d49806c.tar.gz
llvm-d35b42f20a48d6fd9c1f8fce095c37794d49806c.tar.bz2
[NFC] Return llvm::StringRef from StringExtractor::GetStringRef.
This patch removes the two variant of StringExtractor::GetStringRef that return (non-)const references to std::string. The non-const one was being abused to reinitialize the StringExtractor and its uses are replaced by calls to the copy asignment operator. The const variant was refactored to return an actual llvm::StringRef. llvm-svn: 369493
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index f5ce137..b00ecd7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -351,7 +351,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
if (SendPacketAndWaitForResponse(packet.GetString(), response,
/*send_async=*/false) ==
PacketResult::Success) {
- const char *response_cstr = response.GetStringRef().c_str();
+ const char *response_cstr = response.GetStringRef().data();
// Hang on to the qSupported packet, so that platforms can do custom
// configuration of the transport before attaching/launching the process.
@@ -465,7 +465,7 @@ bool GDBRemoteCommunicationClient::GetVContSupported(char flavor) {
m_supports_vCont_S = eLazyBoolNo;
if (SendPacketAndWaitForResponse("vCont?", response, false) ==
PacketResult::Success) {
- const char *response_cstr = response.GetStringRef().c_str();
+ const char *response_cstr = response.GetStringRef().data();
if (::strstr(response_cstr, ";c"))
m_supports_vCont_c = eLazyBoolYes;
@@ -2174,8 +2174,7 @@ uint32_t GDBRemoteCommunicationClient::FindProcesses(
if (!DecodeProcessInfoResponse(response, process_info))
break;
process_infos.Append(process_info);
- response.GetStringRef().clear();
- response.SetFilePos(0);
+ response = StringExtractorGDBRemote();
} while (SendPacketAndWaitForResponse("qsProcessInfo", response, false) ==
PacketResult::Success);
} else {
@@ -3897,7 +3896,7 @@ GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins() {
"GDBRemoteCommunicationClient::%s(): "
"QSupportedAsyncJSONPackets returned invalid "
"result: %s",
- __FUNCTION__, response.GetStringRef().c_str());
+ __FUNCTION__, response.GetStringRef().data());
m_supported_async_json_packets_sp.reset();
}
} else {
@@ -3975,14 +3974,14 @@ Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
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) {
+ if (strcmp(response.GetStringRef().data(), "OK") == 0) {
// Okay!
error.Clear();
} else {
error.SetErrorStringWithFormat("configuring StructuredData feature "
"%s failed with error %s",
type_name.AsCString(),
- response.GetStringRef().c_str());
+ response.GetStringRef().data());
}
} else {
// Can we get more data here on the failure?