gdbstub/user-target: fix gdbserver int format (%d -> %x)
This commit fixes an incorrect format string for formatting integers
provided to GDB when debugging a target run in QEMU user mode.
The correct format is hexadecimal for both success and errno values,
some of which can be seen here [0].
[0] e65a355022/gdbserver/hostio.cc (L196-L213)
Signed-off-by: Dominik 'Disconnect3d' Czarnota <dominik.b.czarnota@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Fixes: e282010b2e1e ("gdbstub: Add support for info proc mappings")
Cc: qemu-stable@nongnu.org
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
6003402aa9
commit
8b647bd352
@ -317,9 +317,9 @@ void gdb_handle_v_file_open(GArray *params, void *user_ctx)
|
|||||||
int fd = open(filename, flags, mode);
|
int fd = open(filename, flags, mode);
|
||||||
#endif
|
#endif
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
g_string_printf(gdbserver_state.str_buf, "F-1,%d", errno);
|
g_string_printf(gdbserver_state.str_buf, "F-1,%x", errno);
|
||||||
} else {
|
} else {
|
||||||
g_string_printf(gdbserver_state.str_buf, "F%d", fd);
|
g_string_printf(gdbserver_state.str_buf, "F%x", fd);
|
||||||
}
|
}
|
||||||
gdb_put_strbuf();
|
gdb_put_strbuf();
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ void gdb_handle_v_file_close(GArray *params, void *user_ctx)
|
|||||||
int fd = gdb_get_cmd_param(params, 0)->val_ul;
|
int fd = gdb_get_cmd_param(params, 0)->val_ul;
|
||||||
|
|
||||||
if (close(fd) == -1) {
|
if (close(fd) == -1) {
|
||||||
g_string_printf(gdbserver_state.str_buf, "F-1,%d", errno);
|
g_string_printf(gdbserver_state.str_buf, "F-1,%x", errno);
|
||||||
gdb_put_strbuf();
|
gdb_put_strbuf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ void gdb_handle_v_file_pread(GArray *params, void *user_ctx)
|
|||||||
|
|
||||||
ssize_t n = pread(fd, buf, bufsiz, offset);
|
ssize_t n = pread(fd, buf, bufsiz, offset);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
g_string_printf(gdbserver_state.str_buf, "F-1,%d", errno);
|
g_string_printf(gdbserver_state.str_buf, "F-1,%x", errno);
|
||||||
gdb_put_strbuf();
|
gdb_put_strbuf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ void gdb_handle_v_file_readlink(GArray *params, void *user_ctx)
|
|||||||
ssize_t n = readlink(filename, buf, BUFSIZ);
|
ssize_t n = readlink(filename, buf, BUFSIZ);
|
||||||
#endif
|
#endif
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
g_string_printf(gdbserver_state.str_buf, "F-1,%d", errno);
|
g_string_printf(gdbserver_state.str_buf, "F-1,%x", errno);
|
||||||
gdb_put_strbuf();
|
gdb_put_strbuf();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user