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

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 18 17:28:26 PDT 2024


Author: Adrian Prantl
Date: 2024-09-18T17:28:10-07:00
New Revision: 6dcde731eb13aeaa8296504ad8178d62c8ecd3eb

URL: https://github.com/llvm/llvm-project/commit/6dcde731eb13aeaa8296504ad8178d62c8ecd3eb
DIFF: https://github.com/llvm/llvm-project/commit/6dcde731eb13aeaa8296504ad8178d62c8ecd3eb.diff

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

This reverts commit a7c174502aef45b2d33291129cce10c085fef944.

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index d4aa90b2c7731a..9b72cb00352821 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -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

diff  --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp
index ba9ca6ea73e3be..69ca1720c04fc9 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationServerTest.cpp
@@ -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(


        


More information about the lldb-commits mailing list