aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2024-09-11 10:35:37 +0200
committerAdrian Prantl <aprantl@apple.com>2024-09-19 10:07:13 -0700
commit1f8a3286e065b8cb82628db0d335b3e82b9373fd (patch)
treec1b77aa50c09fbb2ab7dbaca4d962a0f98fd2c0a /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
parentbeb2ae734830107d28543d172ab43ecc63bb59df (diff)
downloadllvm-1f8a3286e065b8cb82628db0d335b3e82b9373fd.zip
llvm-1f8a3286e065b8cb82628db0d335b3e82b9373fd.tar.gz
llvm-1f8a3286e065b8cb82628db0d335b3e82b9373fd.tar.bz2
[lldb] Only send "posix" error codes through the gdb-remote protocol
The other side has no way of telling which namespace do these codes belong to, so mashing them all together is not very helpful. I'm mainly doing this to simplify some code in a pending patch <https://github.com/llvm/llvm-project/pull/106774/files#r1752628604>, and I've picked the posix error category semi-randomly. If we wanted to be serious about assigning meaning to these error codes, we should create a special error category for "gdb errors".
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index 9b72cb0..d4aa90b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -103,13 +103,14 @@ 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;", static_cast<uint8_t>(error.GetError()));
+ packet.Printf("E%2.2x;", code);
packet.PutStringAsRawHex8(error.AsCString());
return SendPacketNoLock(packet.GetString());
- } else
- return SendErrorResponse(error.GetError());
+ }
+ return SendErrorResponse(code);
}
GDBRemoteCommunication::PacketResult