================
@@ -3064,22 +3064,41 @@ static int gdb_errno_to_system(int err) {
 
 static uint64_t ParseHostIOPacketResponse(StringExtractorGDBRemote &response,
                                           uint64_t fail_result, Status &error) 
{
+  // The packet is expected to have the following format:
+  // 'F<retcode>,<errno>'
+
   response.SetFilePos(0);
   if (response.GetChar() != 'F')
     return fail_result;
+
   int32_t result = response.GetS32(-2, 16);
   if (result == -2)
     return fail_result;
-  if (response.GetChar() == ',') {
-    int result_errno = gdb_errno_to_system(response.GetS32(-1, 16));
-    if (result_errno != -1)
-      error = Status(result_errno, eErrorTypePOSIX);
-    else
-      error = Status(-1, eErrorTypeGeneric);
-  } else
+
+  if (response.GetChar() != ',') {
     error.Clear();
+    return result;
+  }
+
+  // Response packet should contain a error code at the end. This code
+  // corresponds either to the gdb IOFile error code, or to the posix errno.
----------------
dlav-sc wrote:

I've taken one more look at the documentation, and there are two options that 
seem likely now:

1. According to the gdb rsp, error values can only be from the gdb internal 
list 
(https://sourceware.org/gdb/current/onlinedocs/gdb.html/Errno-Values.html#Errno-Values).
 So, in the case of ETXTBSY, the response packet value cannot contain 26 as the 
error code, and it must be 9999 instead, which corresponds to the unknown 
error. In this case, the error is most likely on the lldb server side.

2. Lldb documentation (see lldb/docs/lldb-platform-packets.txt) states that 
vFile:open, vFile:close, vFile:symlink, vFile:unlink, vFile:mode, and 
vFile:size reply packets contain errno. I think there was an attempt to extend 
gdb rsp so that a respond packet could contain any posix error, instead of the 
limited set suggested by the rsp. I think this can be possible, because as far 
as I know, the lldb server does not currently run on systems that are not 
compatible with posix.

Please let me know what you think of this matter.

https://github.com/llvm/llvm-project/pull/106950
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to