diff options
author | dlav-sc <daniil.avdeev@syntacore.com> | 2024-09-25 12:13:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 10:13:40 +0100 |
commit | c93e29439b1ab8ef6873c385f152a06e3395cb59 (patch) | |
tree | a54b94239a5b7454532fbe20c3f999976c881572 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | |
parent | 706821ba8ff9db829252581dd12d8c5ee2e7b3f0 (diff) | |
download | llvm-c93e29439b1ab8ef6873c385f152a06e3395cb59.zip llvm-c93e29439b1ab8ef6873c385f152a06e3395cb59.tar.gz llvm-c93e29439b1ab8ef6873c385f152a06e3395cb59.tar.bz2 |
[lldb] fix vFile:open, vFile:unlink error codes (#106950)
This patch makes gdb-server sends only GDB RSP supported error codes
during vFile:open and vFile:unlink handling.
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index f9d3749..324db3d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -496,6 +496,17 @@ GDBRemoteCommunicationServerCommon::Handle_qSpeedTest( return SendErrorResponse(7); } +static GDBErrno system_errno_to_gdb(int err) { + switch (err) { +#define HANDLE_ERRNO(name, value) \ + case name: \ + return GDB_##name; +#include "Plugins/Process/gdb-remote/GDBRemoteErrno.def" + default: + return GDB_EUNKNOWN; + } +} + GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerCommon::Handle_vFile_Open( StringExtractorGDBRemote &packet) { @@ -522,9 +533,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open( } else { response.PutCString("-1"); std::error_code code = errorToErrorCode(file.takeError()); - if (code.category() == std::system_category()) { - response.Printf(",%x", code.value()); - } + response.Printf(",%x", system_errno_to_gdb(code.value())); } return SendPacketNoLock(response.GetString()); @@ -534,17 +543,6 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open( return SendErrorResponse(18); } -static GDBErrno system_errno_to_gdb(int err) { - switch (err) { -#define HANDLE_ERRNO(name, value) \ - case name: \ - return GDB_##name; -#include "Plugins/Process/gdb-remote/GDBRemoteErrno.def" - default: - return GDB_EUNKNOWN; - } -} - GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerCommon::Handle_vFile_Close( StringExtractorGDBRemote &packet) { @@ -727,7 +725,8 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_unlink( packet.GetHexByteString(path); Status error(llvm::sys::fs::remove(path)); StreamString response; - response.Printf("F%x,%x", error.GetError(), error.GetError()); + response.Printf("F%x,%x", error.GetError(), + system_errno_to_gdb(error.GetError())); return SendPacketNoLock(response.GetString()); } |