return m_supports_x;
}
-GDBRemoteCommunicationClient::PacketResult
-GDBRemoteCommunicationClient::SendPacketsAndConcatenateResponses(
- const char *payload_prefix, std::string &response_string) {
- Lock lock(*this);
- if (!lock) {
- Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
- GDBR_LOG_PACKETS));
- LLDB_LOGF(log,
- "error: failed to get packet sequence mutex, not sending "
- "packets with prefix '%s'",
- payload_prefix);
- return PacketResult::ErrorNoSequenceLock;
- }
-
- response_string = "";
- std::string payload_prefix_str(payload_prefix);
- unsigned int response_size = 0x1000;
- if (response_size > GetRemoteMaxPacketSize()) { // May send qSupported packet
- response_size = GetRemoteMaxPacketSize();
- }
-
- for (unsigned int offset = 0; true; offset += response_size) {
- StringExtractorGDBRemote this_response;
- // Construct payload
- char sizeDescriptor[128];
- snprintf(sizeDescriptor, sizeof(sizeDescriptor), "%x,%x", offset,
- response_size);
- PacketResult result = SendPacketAndWaitForResponseNoLock(
- payload_prefix_str + sizeDescriptor, this_response);
- if (result != PacketResult::Success)
- return result;
-
- const std::string &this_string = std::string(this_response.GetStringRef());
-
- // Check for m or l as first character; l seems to mean this is the last
- // chunk
- char first_char = *this_string.c_str();
- if (first_char != 'm' && first_char != 'l') {
- return PacketResult::ErrorReplyInvalid;
- }
- // Concatenate the result so far (skipping 'm' or 'l')
- response_string.append(this_string, 1, std::string::npos);
- if (first_char == 'l')
- // We're done
- return PacketResult::Success;
- }
-}
-
lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) {
if (allow_lazy && m_curr_pid_is_valid == eLazyBoolYes)
return m_curr_pid;
// more chunks
case ('m'):
- if (str.length() > 1)
- output << &str[1];
+ output << str.substr(1);
offset += str.length() - 1;
break;
// we are communicating with it.
bool HandshakeWithServer(Status *error_ptr);
- // For packets which specify a range of output to be returned,
- // return all of the output via a series of request packets of the form
- // <prefix>0,<size>
- // <prefix><size>,<size>
- // <prefix><size>*2,<size>
- // <prefix><size>*3,<size>
- // ...
- // until a "$l..." packet is received, indicating the end.
- // (size is in hex; this format is used by a standard gdbserver to
- // return the given portion of the output specified by <prefix>;
- // for example, "qXfer:libraries-svr4:read::fff,1000" means
- // "return a chunk of the xml description file for shared
- // library load addresses, where the chunk starts at offset 0xfff
- // and continues for 0x1000 bytes").
- // Concatenate the resulting server response packets together and
- // return in response_string. If any packet fails, the return value
- // indicates that failure and the returned string value is undefined.
- PacketResult
- SendPacketsAndConcatenateResponses(const char *send_payload_prefix,
- std::string &response_string);
-
bool GetThreadSuffixSupported();
// This packet is usually sent first and the boolean return value
DataBufferSP buf;
if (m_gdb_comm.GetQXferAuxvReadSupported()) {
std::string response_string;
- if (m_gdb_comm.SendPacketsAndConcatenateResponses("qXfer:auxv:read::",
- response_string) ==
- GDBRemoteCommunication::PacketResult::Success)
+ Status ST;
+ if (m_gdb_comm.ReadExtFeature(ConstString("auxv"), ConstString(""),
+ response_string, ST))
buf = std::make_shared<DataBufferHeap>(response_string.c_str(),
response_string.length());
}