Skip to content

Commit 902e167

Browse files
adrian-prantltmsri
authored andcommitted
Revert "[lldb] Only send "posix" error codes through the gdb-remote protocol"
This reverts commit a7c1745.
1 parent d3d9ecc commit 902e167

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,13 @@ GDBRemoteCommunicationServer::SendErrorResponse(uint8_t err) {
103103

104104
GDBRemoteCommunication::PacketResult
105105
GDBRemoteCommunicationServer::SendErrorResponse(const Status &error) {
106-
uint8_t code = error.GetType() == eErrorTypePOSIX ? error.GetError() : 0xff;
107106
if (m_send_error_strings) {
108107
lldb_private::StreamString packet;
109-
packet.Printf("E%2.2x;", code);
108+
packet.Printf("E%2.2x;", static_cast<uint8_t>(error.GetError()));
110109
packet.PutStringAsRawHex8(error.AsCString());
111110
return SendPacketNoLock(packet.GetString());
112-
}
113-
return SendErrorResponse(code);
111+
} else
112+
return SendErrorResponse(error.GetError());
114113
}
115114

116115
GDBRemoteCommunication::PacketResult

lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h"
1313
#include "lldb/Utility/Connection.h"
1414
#include "lldb/Utility/UnimplementedError.h"
15-
#include "lldb/lldb-enumerations.h"
1615

1716
namespace lldb_private {
1817
namespace process_gdb_remote {
@@ -26,7 +25,7 @@ TEST(GDBRemoteCommunicationServerTest, SendErrorResponse_ErrorNumber) {
2625

2726
TEST(GDBRemoteCommunicationServerTest, SendErrorResponse_Status) {
2827
MockServerWithMockConnection server;
29-
Status status(0x42, lldb::eErrorTypePOSIX, "Test error message");
28+
Status status(0x42, lldb::eErrorTypeGeneric, "Test error message");
3029
server.SendErrorResponse(status);
3130

3231
EXPECT_THAT(

0 commit comments

Comments
 (0)