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
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 3135bd8..4f632c9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -347,7 +347,7 @@
         StreamGDBRemote response;
         response.PutChar ('E');
         response.PutHex8 (GDBRemoteServerError::eErrorExitStatus);
-        return SendPacketNoLock(response.GetData(), response.GetSize());
+        return SendPacketNoLock(response.GetString());
     }
     else
     {
@@ -377,7 +377,7 @@
         // 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 @@
         }
     }
 
-    return SendPacketNoLock (response.GetData(), response.GetSize());
+    return SendPacketNoLock (response.GetString());
 }
 
 void
@@ -969,7 +969,7 @@
     response.PutChar ('O');
     response.PutBytesAsRawHex8 (buffer, len);
 
-    return SendPacketNoLock (response.GetData (), response.GetSize ());
+    return SendPacketNoLock (response.GetString());
 }
 
 Error
@@ -1072,7 +1072,7 @@
 
     StreamString response;
     CreateProcessInfoResponse_DebugServerStyle(proc_info, response);
-    return SendPacketNoLock (response.GetData (), response.GetSize ());
+    return SendPacketNoLock (response.GetString());
 }
 
 GDBRemoteCommunication::PacketResult
@@ -1094,7 +1094,7 @@
     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 @@
     {
         StreamString response;
         response.PutCStringAsRawHex8(working_dir.GetCString());
-        return SendPacketNoLock(response.GetData(), response.GetSize());
+        return SendPacketNoLock(response.GetString());
     }
 
     return SendErrorResponse(14);
@@ -1298,7 +1298,7 @@
     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 @@
            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 @@
     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 @@
     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 @@
             response.PutHex8(buf[i]);
     }
 
-    return SendPacketNoLock(response.GetData(), response.GetSize());
+    return SendPacketNoLock(response.GetString());
 }
 
 GDBRemoteCommunication::PacketResult
@@ -2243,7 +2243,7 @@
         }
     }
 
-    return SendPacketNoLock(response.GetData(), response.GetSize());
+    return SendPacketNoLock(response.GetString());
 }
 
 GDBRemoteCommunication::PacketResult
@@ -2556,7 +2556,7 @@
     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 @@
     // 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 @@
     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 @@
     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 @@
 
     StreamGDBRemote response;
     response.PutHex64(file_load_address);
-    return SendPacketNoLock(response.GetData(), response.GetSize());
+    return SendPacketNoLock(response.GetString());
 }
 
 void