From 2c8a1eb5c644ed29289601c4c9a121e0486d47fb Mon Sep 17 00:00:00 2001 From: TuxSH Date: Sat, 4 May 2019 17:08:32 +0200 Subject: [PATCH] gdb hio: lseek returns 64-bit --- sysmodules/rosalina/include/gdb.h | 2 +- sysmodules/rosalina/source/gdb/hio.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sysmodules/rosalina/include/gdb.h b/sysmodules/rosalina/include/gdb.h index 52e4ff2..aa1499f 100644 --- a/sysmodules/rosalina/include/gdb.h +++ b/sysmodules/rosalina/include/gdb.h @@ -56,7 +56,7 @@ typedef struct PackedGdbHioRequest size_t stringLengths[8]; // Return - int retval; + s64 retval; int gdbErrno; bool ctrlC; } PackedGdbHioRequest; diff --git a/sysmodules/rosalina/source/gdb/hio.c b/sysmodules/rosalina/source/gdb/hio.c index 49b002f..e8d33a4 100644 --- a/sysmodules/rosalina/source/gdb/hio.c +++ b/sysmodules/rosalina/source/gdb/hio.c @@ -77,14 +77,14 @@ GDB_DECLARE_HANDLER(HioReply) // "Call specific attachement" is always empty, though. const char *pos = ctx->commandData; - u32 retval; + u64 retval; if (*pos == 0 || *pos == ',') return GDB_ReplyErrno(ctx, EILSEQ); else if (*pos == '-') { pos++; - ctx->currentHioRequest.retval = -1; + ctx->currentHioRequest.retval = -1ll; } else if (*pos == '+') { @@ -94,7 +94,7 @@ GDB_DECLARE_HANDLER(HioReply) else ctx->currentHioRequest.retval = 1; - pos = GDB_ParseHexIntegerList(&retval, pos, 1, ','); + pos = GDB_ParseHexIntegerList64(&retval, pos, 1, ','); if (pos == NULL) return GDB_ReplyErrno(ctx, EILSEQ); @@ -106,6 +106,7 @@ GDB_DECLARE_HANDLER(HioReply) if (*pos != 0) { u32 errno_; + // GDB protocol technically allows errno to have a +/- prefix but this will never happen. pos = GDB_ParseHexIntegerList(&errno_, ++pos, 1, ','); ctx->currentHioRequest.gdbErrno = (int)errno_; if (pos == NULL)