gdbstub: Fix %s formatting

The format string for %s has two format characters. This causes it to
emit strings like "466f5bd8/6x" instead of "466f5bd8/6". GDB detects
this and returns EIO, causing all open File I/O calls to fail.

Fixes: 0820a075af ("gdbstub: Adjust gdb_do_syscall to only use uint32_t and uint64_t")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251027110344.2289945-35-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
(cherry picked from commit 524fc77d23)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Sean Anderson
2025-10-27 11:03:41 +00:00
committed by Michael Tokarev
parent 389a2a60b7
commit e0b76691b7

View File

@@ -127,7 +127,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
case 's':
i64 = va_arg(va, uint64_t);
i32 = va_arg(va, uint32_t);
p += snprintf(p, p_end - p, "%" PRIx64 "/%x" PRIx32, i64, i32);
p += snprintf(p, p_end - p, "%" PRIx64 "/%" PRIx32, i64, i32);
break;
default:
bad_format: