[Lldb-commits] [lldb] c93e294 - [lldb] fix vFile:open, vFile:unlink error codes (#106950)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 25 02:13:44 PDT 2024
Author: dlav-sc
Date: 2024-09-25T10:13:40+01:00
New Revision: c93e29439b1ab8ef6873c385f152a06e3395cb59
URL: https://github.com/llvm/llvm-project/commit/c93e29439b1ab8ef6873c385f152a06e3395cb59
DIFF: https://github.com/llvm/llvm-project/commit/c93e29439b1ab8ef6873c385f152a06e3395cb59.diff
LOG: [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.
Added:
Modified:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index f9d37490e16aec..324db3db7eb4c7 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());
}
More information about the lldb-commits
mailing list