aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp29
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());
}