[Lldb-commits] [lldb] [lldb] gdb rsp file error pass fix (PR #106950)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 17 14:37:46 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.
----------------
jasonmolenda wrote:
Sorry for the delay in replying. I didn't realize that gdb has implemented this differently than lldb did - I thought https://reviews.llvm.org/D34945 was pulling over a gdb-originated feature. It looks like gdb needs to send `error-message` in the qSupported list at the start of the debug session to get those error strings (v. https://sourceware.org/gdb/current/onlinedocs/gdb.html/General-Query-Packets.html#error_002dmessage ) although looking a little more closely, I think this feature was only added to the gdb remote serial protocol in May of this year? lldb's QEnableErrorStrings was added in 2017. v. https://sourceware.org/pipermail/gdb-patches/2024-May/209040.html
https://github.com/llvm/llvm-project/pull/106950
More information about the lldb-commits
mailing list