[Lldb-commits] [lldb] [lldb] gdb rsp file error pass fix (PR #106950)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 6 01:04:38 PDT 2024
================
@@ -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.
----------------
DavidSpickett wrote:
True, this would be a divergence.
I think hiding the original number is pretty annoying though, and my understanding is that's the motivation here. Even if you have access to the remote side, getting logging out of lldb-server is a pain.
We added something for adding string errors to certain packets a while ago, I think launch uses it. If I can find that, perhaps we can use it to append the original error number instead.
https://github.com/llvm/llvm-project/pull/106950
More information about the lldb-commits
mailing list