Revert "[lldb] Only send "posix" error codes through the gdb-remote protocol"

This reverts commit a7c174502aef45b2d33291129cce10c085fef944.
This commit is contained in:
Adrian Prantl 2024-09-18 17:27:46 -07:00
parent cb6d53198e
commit 6dcde731eb
2 changed files with 4 additions and 6 deletions

View File

@ -103,14 +103,13 @@ GDBRemoteCommunicationServer::SendErrorResponse(uint8_t err) {
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServer::SendErrorResponse(const Status &error) {
uint8_t code = error.GetType() == eErrorTypePOSIX ? error.GetError() : 0xff;
if (m_send_error_strings) {
lldb_private::StreamString packet;
packet.Printf("E%2.2x;", code);
packet.Printf("E%2.2x;", static_cast<uint8_t>(error.GetError()));
packet.PutStringAsRawHex8(error.AsCString());
return SendPacketNoLock(packet.GetString());
}
return SendErrorResponse(code);
} else
return SendErrorResponse(error.GetError());
}
GDBRemoteCommunication::PacketResult

View File

@ -12,7 +12,6 @@
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h"
#include "lldb/Utility/Connection.h"
#include "lldb/Utility/UnimplementedError.h"
#include "lldb/lldb-enumerations.h"
namespace lldb_private {
namespace process_gdb_remote {
@ -26,7 +25,7 @@ TEST(GDBRemoteCommunicationServerTest, SendErrorResponse_ErrorNumber) {
TEST(GDBRemoteCommunicationServerTest, SendErrorResponse_Status) {
MockServerWithMockConnection server;
Status status(0x42, lldb::eErrorTypePOSIX, "Test error message");
Status status(0x42, lldb::eErrorTypeGeneric, "Test error message");
server.SendErrorResponse(status);
EXPECT_THAT(