diff options
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
| -rw-r--r-- | contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 218 |
1 files changed, 120 insertions, 98 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 74e392249a94..7d2bd452acca 100644 --- a/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -38,9 +38,10 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB #include "llvm/Support/JSON.h" -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION #include <compression.h> #endif @@ -104,11 +105,12 @@ bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) { .count(); if (error_ptr) { if (!IsConnected()) - error_ptr->SetErrorString("Connection shut down by remote side " - "while waiting for reply to initial " - "handshake packet"); + *error_ptr = + Status::FromErrorString("Connection shut down by remote side " + "while waiting for reply to initial " + "handshake packet"); else - error_ptr->SetErrorStringWithFormat( + *error_ptr = Status::FromErrorStringWithFormat( "failed to get reply to handshake packet within timeout of " "%.1f seconds", handshake_timeout); @@ -116,7 +118,7 @@ bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) { } } else { if (error_ptr) - error_ptr->SetErrorString("failed to send the handshake ack"); + *error_ptr = Status::FromErrorString("failed to send the handshake ack"); } return false; } @@ -197,6 +199,18 @@ uint64_t GDBRemoteCommunicationClient::GetRemoteMaxPacketSize() { return m_max_packet_size; } +bool GDBRemoteCommunicationClient::GetReverseContinueSupported() { + if (m_supports_reverse_continue == eLazyBoolCalculate) + GetRemoteQSupported(); + return m_supports_reverse_continue == eLazyBoolYes; +} + +bool GDBRemoteCommunicationClient::GetReverseStepSupported() { + if (m_supports_reverse_step == eLazyBoolCalculate) + GetRemoteQSupported(); + return m_supports_reverse_step == eLazyBoolYes; +} + bool GDBRemoteCommunicationClient::QueryNoAckModeSupported() { if (m_supports_not_sending_acks == eLazyBoolCalculate) { m_send_acks = true; @@ -273,7 +287,6 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { m_supports_vCont_s = eLazyBoolCalculate; m_supports_vCont_S = eLazyBoolCalculate; m_supports_p = eLazyBoolCalculate; - m_supports_x = eLazyBoolCalculate; m_supports_QSaveRegisterState = eLazyBoolCalculate; m_qHostInfo_is_valid = eLazyBoolCalculate; m_curr_pid_is_valid = eLazyBoolCalculate; @@ -293,6 +306,9 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { m_supports_qXfer_siginfo_read = eLazyBoolCalculate; m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate; m_uses_native_signals = eLazyBoolCalculate; + m_x_packet_state.reset(); + m_supports_reverse_continue = eLazyBoolCalculate; + m_supports_reverse_step = eLazyBoolCalculate; m_supports_qProcessInfoPID = true; m_supports_qfProcessInfo = true; m_supports_qUserName = true; @@ -346,14 +362,20 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_memory_tagging = eLazyBoolNo; m_supports_qSaveCore = eLazyBoolNo; m_uses_native_signals = eLazyBoolNo; + m_x_packet_state.reset(); + m_supports_reverse_continue = eLazyBoolNo; + m_supports_reverse_step = eLazyBoolNo; m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if // not, we assume no limit // build the qSupported packet std::vector<std::string> features = {"xmlRegisters=i386,arm,mips,arc", - "multiprocess+", "fork-events+", - "vfork-events+"}; + "multiprocess+", + "fork-events+", + "vfork-events+", + "swbreak+", + "hwbreak+"}; StreamString packet; packet.PutCString("qSupported"); for (uint32_t i = 0; i < features.size(); ++i) { @@ -384,7 +406,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_qXfer_memory_map_read = eLazyBoolYes; else if (x == "qXfer:siginfo:read+") m_supports_qXfer_siginfo_read = eLazyBoolYes; - else if (x == "qEcho") + else if (x == "qEcho+") m_supports_qEcho = eLazyBoolYes; else if (x == "QPassSignals+") m_supports_QPassSignals = eLazyBoolYes; @@ -396,6 +418,12 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() { m_supports_qSaveCore = eLazyBoolYes; else if (x == "native-signals+") m_uses_native_signals = eLazyBoolYes; + else if (x == "binary-upload+") + m_x_packet_state = xPacketState::Prefixed; + else if (x == "ReverseContinue+") + m_supports_reverse_continue = eLazyBoolYes; + else if (x == "ReverseStep+") + m_supports_reverse_step = eLazyBoolYes; // Look for a list of compressions in the features list e.g. // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib- // deflate,lzma @@ -705,24 +733,25 @@ Status GDBRemoteCommunicationClient::WriteMemoryTags( if (SendPacketAndWaitForResponse(packet.GetString(), response) != PacketResult::Success || !response.IsOKResponse()) { - status.SetErrorString("QMemTags packet failed"); + status = Status::FromErrorString("QMemTags packet failed"); } return status; } -bool GDBRemoteCommunicationClient::GetxPacketSupported() { - if (m_supports_x == eLazyBoolCalculate) { +GDBRemoteCommunicationClient::xPacketState +GDBRemoteCommunicationClient::GetxPacketState() { + if (!m_x_packet_state) + GetRemoteQSupported(); + if (!m_x_packet_state) { StringExtractorGDBRemote response; - m_supports_x = eLazyBoolNo; - char packet[256]; - snprintf(packet, sizeof(packet), "x0,0"); - if (SendPacketAndWaitForResponse(packet, response) == + m_x_packet_state = xPacketState::Unimplemented; + if (SendPacketAndWaitForResponse("x0,0", response) == PacketResult::Success) { if (response.IsOKResponse()) - m_supports_x = eLazyBoolYes; + m_x_packet_state = xPacketState::Bare; } } - return m_supports_x; + return *m_x_packet_state; } lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) { @@ -1075,7 +1104,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( CompressionType avail_type = CompressionType::None; llvm::StringRef avail_name; -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "lzfse") { @@ -1085,9 +1114,6 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( } } } -#endif - -#if defined(HAVE_LIBCOMPRESSION) if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "zlib-deflate") { @@ -1111,7 +1137,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( } #endif -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "lz4") { @@ -1121,9 +1147,6 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( } } } -#endif - -#if defined(HAVE_LIBCOMPRESSION) if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "lzma") { @@ -1519,7 +1542,8 @@ Status GDBRemoteCommunicationClient::Detach(bool keep_stopped, } if (m_supports_detach_stay_stopped == eLazyBoolNo) { - error.SetErrorString("Stays stopped not supported by this target."); + error = Status::FromErrorString( + "Stays stopped not supported by this target."); return error; } else { packet.PutChar('1'); @@ -1534,7 +1558,8 @@ Status GDBRemoteCommunicationClient::Detach(bool keep_stopped, packet.PutChar(';'); packet.PutHex64(pid); } else if (pid != LLDB_INVALID_PROCESS_ID) { - error.SetErrorString("Multiprocess extension not supported by the server."); + error = Status::FromErrorString( + "Multiprocess extension not supported by the server."); return error; } @@ -1542,7 +1567,7 @@ Status GDBRemoteCommunicationClient::Detach(bool keep_stopped, PacketResult packet_result = SendPacketAndWaitForResponse(packet.GetString(), response); if (packet_result != PacketResult::Success) - error.SetErrorString("Sending isconnect packet failed."); + error = Status::FromErrorString("Sending disconnect packet failed."); return error; } @@ -1614,6 +1639,7 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( region_info.SetName(name.c_str()); } else if (name == "flags") { region_info.SetMemoryTagged(MemoryRegionInfo::eNo); + region_info.SetIsShadowStack(MemoryRegionInfo::eNo); llvm::StringRef flags = value; llvm::StringRef flag; @@ -1622,31 +1648,25 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( std::tie(flag, flags) = flags.split(' '); // To account for trailing whitespace if (flag.size()) { - if (flag == "mt") { + if (flag == "mt") region_info.SetMemoryTagged(MemoryRegionInfo::eYes); - break; - } + else if (flag == "ss") + region_info.SetIsShadowStack(MemoryRegionInfo::eYes); } } } else if (name == "type") { - std::string comma_sep_str = value.str(); - size_t comma_pos; - while ((comma_pos = comma_sep_str.find(',')) != std::string::npos) { - comma_sep_str[comma_pos] = '\0'; - if (comma_sep_str == "stack") { + for (llvm::StringRef entry : llvm::split(value, ',')) { + if (entry == "stack") region_info.SetIsStackMemory(MemoryRegionInfo::eYes); - } - } - // handle final (or only) type of "stack" - if (comma_sep_str == "stack") { - region_info.SetIsStackMemory(MemoryRegionInfo::eYes); + else if (entry == "heap") + region_info.SetIsStackMemory(MemoryRegionInfo::eNo); } } else if (name == "error") { StringExtractorGDBRemote error_extractor(value); std::string error_string; // Now convert the HEX bytes into a string value error_extractor.GetHexByteString(error_string); - error.SetErrorString(error_string.c_str()); + error = Status::FromErrorString(error_string.c_str()); } else if (name == "dirty-pages") { std::vector<addr_t> dirty_page_list; for (llvm::StringRef x : llvm::split(value, ',')) { @@ -1673,7 +1693,7 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( } } else { // We got an invalid address range back - error.SetErrorString("Server returned invalid range"); + error = Status::FromErrorString("Server returned invalid range"); } } else { m_supports_memory_region_info = eLazyBoolNo; @@ -1681,7 +1701,7 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo( } if (m_supports_memory_region_info == eLazyBoolNo) { - error.SetErrorString("qMemoryRegionInfo is not supported"); + error = Status::FromErrorString("qMemoryRegionInfo is not supported"); } // Try qXfer:memory-map:read to get region information not included in @@ -1721,7 +1741,7 @@ Status GDBRemoteCommunicationClient::GetQXferMemoryMapRegionInfo( return error; } } - error.SetErrorString("Region not found"); + error = Status::FromErrorString("Region not found"); return error; } @@ -1734,29 +1754,29 @@ Status GDBRemoteCommunicationClient::LoadQXferMemoryMap() { return error; if (!XMLDocument::XMLEnabled()) { - error.SetErrorString("XML is not supported"); + error = Status::FromErrorString("XML is not supported"); return error; } if (!GetQXferMemoryMapReadSupported()) { - error.SetErrorString("Memory map is not supported"); + error = Status::FromErrorString("Memory map is not supported"); return error; } llvm::Expected<std::string> xml = ReadExtFeature("memory-map", ""); if (!xml) - return Status(xml.takeError()); + return Status::FromError(xml.takeError()); XMLDocument xml_document; if (!xml_document.ParseMemory(xml->c_str(), xml->size())) { - error.SetErrorString("Failed to parse memory map xml"); + error = Status::FromErrorString("Failed to parse memory map xml"); return error; } XMLNode map_node = xml_document.GetRootElement("memory-map"); if (!map_node) { - error.SetErrorString("Invalid root node in memory map xml"); + error = Status::FromErrorString("Invalid root node in memory map xml"); return error; } @@ -2131,7 +2151,6 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) { llvm::StringRef value; uint32_t cpu = LLDB_INVALID_CPUTYPE; uint32_t sub = 0; - std::string arch_name; std::string os_name; std::string environment; std::string vendor_name; @@ -2984,28 +3003,28 @@ lldb_private::Status GDBRemoteCommunicationClient::RunShellCommand( if (SendPacketAndWaitForResponse(stream.GetString(), response) == PacketResult::Success) { if (response.GetChar() != 'F') - return Status("malformed reply"); + return Status::FromErrorString("malformed reply"); if (response.GetChar() != ',') - return Status("malformed reply"); + return Status::FromErrorString("malformed reply"); uint32_t exitcode = response.GetHexMaxU32(false, UINT32_MAX); if (exitcode == UINT32_MAX) - return Status("unable to run remote process"); + return Status::FromErrorString("unable to run remote process"); else if (status_ptr) *status_ptr = exitcode; if (response.GetChar() != ',') - return Status("malformed reply"); + return Status::FromErrorString("malformed reply"); uint32_t signo = response.GetHexMaxU32(false, UINT32_MAX); if (signo_ptr) *signo_ptr = signo; if (response.GetChar() != ',') - return Status("malformed reply"); + return Status::FromErrorString("malformed reply"); std::string output; response.GetEscapedBinaryData(output); if (command_output) command_output->assign(output); return Status(); } - return Status("unable to send packet"); + return Status::FromErrorString("unable to send packet"); } Status GDBRemoteCommunicationClient::MakeDirectory(const FileSpec &file_spec, @@ -3020,10 +3039,12 @@ Status GDBRemoteCommunicationClient::MakeDirectory(const FileSpec &file_spec, StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) != PacketResult::Success) - return Status("failed to send '%s' packet", packet.str().c_str()); + return Status::FromErrorStringWithFormat("failed to send '%s' packet", + packet.str().c_str()); if (response.GetChar() != 'F') - return Status("invalid response to '%s' packet", packet.str().c_str()); + return Status::FromErrorStringWithFormat("invalid response to '%s' packet", + packet.str().c_str()); return Status(response.GetHexMaxU32(false, UINT32_MAX), eErrorTypePOSIX); } @@ -3041,10 +3062,12 @@ GDBRemoteCommunicationClient::SetFilePermissions(const FileSpec &file_spec, StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) != PacketResult::Success) - return Status("failed to send '%s' packet", stream.GetData()); + return Status::FromErrorStringWithFormat("failed to send '%s' packet", + stream.GetData()); if (response.GetChar() != 'F') - return Status("invalid response to '%s' packet", stream.GetData()); + return Status::FromErrorStringWithFormat("invalid response to '%s' packet", + stream.GetData()); return Status(response.GetHexMaxU32(false, UINT32_MAX), eErrorTypePOSIX); } @@ -3071,9 +3094,9 @@ static uint64_t ParseHostIOPacketResponse(StringExtractorGDBRemote &response, if (response.GetChar() == ',') { int result_errno = gdb_errno_to_system(response.GetS32(-1, 16)); if (result_errno != -1) - error.SetError(result_errno, eErrorTypePOSIX); + error = Status(result_errno, eErrorTypePOSIX); else - error.SetError(-1, eErrorTypeGeneric); + error = Status(-1, eErrorTypeGeneric); } else error.Clear(); return result; @@ -3211,25 +3234,25 @@ GDBRemoteCommunicationClient::GetFilePermissions(const FileSpec &file_spec, StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(stream.GetString(), response) != PacketResult::Success) { - error.SetErrorStringWithFormat("failed to send '%s' packet", - stream.GetData()); + error = Status::FromErrorStringWithFormat("failed to send '%s' packet", + stream.GetData()); return error; } if (!response.IsUnsupportedResponse()) { if (response.GetChar() != 'F') { - error.SetErrorStringWithFormat("invalid response to '%s' packet", - stream.GetData()); + error = Status::FromErrorStringWithFormat( + "invalid response to '%s' packet", stream.GetData()); } else { const uint32_t mode = response.GetS32(-1, 16); if (static_cast<int32_t>(mode) == -1) { if (response.GetChar() == ',') { int response_errno = gdb_errno_to_system(response.GetS32(-1, 16)); if (response_errno > 0) - error.SetError(response_errno, lldb::eErrorTypePOSIX); + error = Status(response_errno, lldb::eErrorTypePOSIX); else - error.SetErrorToGenericError(); + error = Status::FromErrorString("unknown error"); } else - error.SetErrorToGenericError(); + error = Status::FromErrorString("unknown error"); } else { file_permissions = mode & (S_IRWXU | S_IRWXG | S_IRWXO); } @@ -3245,7 +3268,7 @@ GDBRemoteCommunicationClient::GetFilePermissions(const FileSpec &file_spec, file_permissions = st->gdb_st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); return Status(); } - return Status("fstat failed"); + return Status::FromErrorString("fstat failed"); } uint64_t GDBRemoteCommunicationClient::ReadFile(lldb::user_id_t fd, @@ -3262,11 +3285,11 @@ uint64_t GDBRemoteCommunicationClient::ReadFile(lldb::user_id_t fd, return 0; int64_t retcode = response.GetS64(-1, 16); if (retcode == -1) { - error.SetErrorToGenericError(); + error = Status::FromErrorString("unknown error"); if (response.GetChar() == ',') { int response_errno = gdb_errno_to_system(response.GetS32(-1, 16)); if (response_errno > 0) - error.SetError(response_errno, lldb::eErrorTypePOSIX); + error = Status(response_errno, lldb::eErrorTypePOSIX); } return -1; } @@ -3300,22 +3323,22 @@ uint64_t GDBRemoteCommunicationClient::WriteFile(lldb::user_id_t fd, if (SendPacketAndWaitForResponse(stream.GetString(), response) == PacketResult::Success) { if (response.GetChar() != 'F') { - error.SetErrorStringWithFormat("write file failed"); + error = Status::FromErrorStringWithFormat("write file failed"); return 0; } int64_t bytes_written = response.GetS64(-1, 16); if (bytes_written == -1) { - error.SetErrorToGenericError(); + error = Status::FromErrorString("unknown error"); if (response.GetChar() == ',') { int response_errno = gdb_errno_to_system(response.GetS32(-1, 16)); if (response_errno > 0) - error.SetError(response_errno, lldb::eErrorTypePOSIX); + error = Status(response_errno, lldb::eErrorTypePOSIX); } return -1; } return bytes_written; } else { - error.SetErrorString("failed to send vFile:pwrite packet"); + error = Status::FromErrorString("failed to send vFile:pwrite packet"); } return 0; } @@ -3337,19 +3360,19 @@ Status GDBRemoteCommunicationClient::CreateSymlink(const FileSpec &src, if (response.GetChar() == 'F') { uint32_t result = response.GetHexMaxU32(false, UINT32_MAX); if (result != 0) { - error.SetErrorToGenericError(); + error = Status::FromErrorString("unknown error"); if (response.GetChar() == ',') { int response_errno = gdb_errno_to_system(response.GetS32(-1, 16)); if (response_errno > 0) - error.SetError(response_errno, lldb::eErrorTypePOSIX); + error = Status(response_errno, lldb::eErrorTypePOSIX); } } } else { // Should have returned with 'F<result>[,<errno>]' - error.SetErrorStringWithFormat("symlink failed"); + error = Status::FromErrorStringWithFormat("symlink failed"); } } else { - error.SetErrorString("failed to send vFile:symlink packet"); + error = Status::FromErrorString("failed to send vFile:symlink packet"); } return error; } @@ -3368,19 +3391,19 @@ Status GDBRemoteCommunicationClient::Unlink(const FileSpec &file_spec) { if (response.GetChar() == 'F') { uint32_t result = response.GetHexMaxU32(false, UINT32_MAX); if (result != 0) { - error.SetErrorToGenericError(); + error = Status::FromErrorString("unknown error"); if (response.GetChar() == ',') { int response_errno = gdb_errno_to_system(response.GetS32(-1, 16)); if (response_errno > 0) - error.SetError(response_errno, lldb::eErrorTypePOSIX); + error = Status(response_errno, lldb::eErrorTypePOSIX); } } } else { // Should have returned with 'F<result>[,<errno>]' - error.SetErrorStringWithFormat("unlink failed"); + error = Status::FromErrorStringWithFormat("unlink failed"); } } else { - error.SetErrorString("failed to send vFile:unlink packet"); + error = Status::FromErrorString("failed to send vFile:unlink packet"); } return error; } @@ -3663,7 +3686,6 @@ GDBRemoteCommunicationClient::SendTraceStop(const TraceStopRequest &request, std::string json_string; llvm::raw_string_ostream os(json_string); os << toJSON(request); - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -3698,7 +3720,6 @@ GDBRemoteCommunicationClient::SendTraceStart(const llvm::json::Value ¶ms, std::string json_string; llvm::raw_string_ostream os(json_string); os << params; - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -3733,7 +3754,6 @@ GDBRemoteCommunicationClient::SendTraceGetState(llvm::StringRef type, std::string json_string; llvm::raw_string_ostream os(json_string); os << toJSON(TraceGetStateRequest{type.str()}); - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -3767,7 +3787,6 @@ GDBRemoteCommunicationClient::SendTraceGetBinaryData( std::string json_string; llvm::raw_string_ostream os(json_string); os << toJSON(request); - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -4040,7 +4059,7 @@ GDBRemoteCommunicationClient::ReadExtFeature(llvm::StringRef object, } } - return output_stream.str(); + return output; } // Notify the target that gdb is prepared to serve symbol lookup requests. @@ -4260,12 +4279,13 @@ Status GDBRemoteCommunicationClient::SendSignalsToIgnore( auto send_status = SendPacketAndWaitForResponse(packet, response); if (send_status != GDBRemoteCommunication::PacketResult::Success) - return Status("Sending QPassSignals packet failed"); + return Status::FromErrorString("Sending QPassSignals packet failed"); if (response.IsOKResponse()) { return Status(); } else { - return Status("Unknown error happened during sending QPassSignals packet."); + return Status::FromErrorString( + "Unknown error happened during sending QPassSignals packet."); } } @@ -4274,7 +4294,7 @@ Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData( Status error; if (type_name.empty()) { - error.SetErrorString("invalid type_name argument"); + error = Status::FromErrorString("invalid type_name argument"); return error; } @@ -4304,13 +4324,13 @@ Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData( // Okay! error.Clear(); } else { - error.SetErrorStringWithFormatv( + error = Status::FromErrorStringWithFormatv( "configuring StructuredData feature {0} failed with error {1}", type_name, response.GetStringRef()); } } else { // Can we get more data here on the failure? - error.SetErrorStringWithFormatv( + error = Status::FromErrorStringWithFormatv( "configuring StructuredData feature {0} failed when sending packet: " "PacketResult={1}", type_name, (int)result); @@ -4338,7 +4358,9 @@ llvm::Expected<int> GDBRemoteCommunicationClient::KillProcess(lldb::pid_t pid) { StringExtractorGDBRemote response; GDBRemoteCommunication::ScopedTimeout(*this, seconds(3)); - if (SendPacketAndWaitForResponse("k", response, GetPacketTimeout()) != + // LLDB server typically sends no response for "k", so we shouldn't try + // to sync on timeout. + if (SendPacketAndWaitForResponse("k", response, GetPacketTimeout(), false) != PacketResult::Success) return llvm::createStringError(llvm::inconvertibleErrorCode(), "failed to send k packet"); |
