[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 11/17] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak
From: |
Alex Bennée |
Subject: |
[PATCH v2 11/17] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb |
Date: |
Tue, 14 Apr 2020 21:06:25 +0100 |
From: Peter Xu <address@hidden>
We should only pass in gdb_get_reg16() with the GByteArray* object
itself, no need to shift. Without this patch, gdb remote attach will
crash QEMU:
(gdb) target remote :1234
Remote debugging using :1234
Remote communication error. Target disconnected.: Connection reset by peer.
$ qemu-system-x86_64 -m 1G -smp 4 ... -s
ERROR:qemu/gdbstub.c:1843:handle_read_all_regs: assertion failed: (len ==
gdbserver_state.mem_buf->len)
Bail out! ERROR:qemu/gdbstub.c:1843:handle_read_all_regs: assertion failed:
(len == gdbserver_state.mem_buf->len)
Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
Tested-by: Stefano Garzarella <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
---
v2
- tags and expand comment
---
target/i386/gdbstub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index f3d23b614ee..b98a99500ae 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -106,7 +106,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray
*mem_buf, int n)
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
floatx80 *fp = (floatx80 *) &env->fpregs[n - IDX_FP_REGS];
int len = gdb_get_reg64(mem_buf, cpu_to_le64(fp->low));
- len += gdb_get_reg16(mem_buf + len, cpu_to_le16(fp->high));
+ len += gdb_get_reg16(mem_buf, cpu_to_le16(fp->high));
return len;
} else if (n >= IDX_XMM_REGS && n < IDX_XMM_REGS + CPU_NB_REGS) {
n -= IDX_XMM_REGS;
--
2.20.1
- [PATCH v2 for 5.0-rc3 00/17] more randome fixes (user, pie, docker and gdbstub), Alex Bennée, 2020/04/14
- [PATCH v2 02/17] exec/cpu-all: Use bool for have_guest_base, Alex Bennée, 2020/04/14
- [PATCH v2 03/17] accel/tcg: Relax va restrictions on 64-bit guests, Alex Bennée, 2020/04/14
- [PATCH v2 04/17] .gitignore: include common build sub-directories, Alex Bennée, 2020/04/14
- [PATCH v2 01/17] linux-user: completely re-write init_guest_space, Alex Bennée, 2020/04/14
- [PATCH v2 06/17] tests/docker: add docs FEATURE flag and use for test-misc, Alex Bennée, 2020/04/14
- [PATCH v2 07/17] configure: redirect sphinx-build check to config.log, Alex Bennée, 2020/04/14
- [PATCH v2 05/17] linux-user/ppc: Fix padding in mcontext_t for ppc64, Alex Bennée, 2020/04/14
- [PATCH v2 08/17] configure: disable PIE for Windows builds, Alex Bennée, 2020/04/14
- [PATCH v2 12/17] gdbstub: Do not use memset() on GByteArray, Alex Bennée, 2020/04/14
- [PATCH v2 11/17] gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb,
Alex Bennée <=
- [PATCH v2 13/17] gdbstub: Introduce gdb_get_float32() to get 32-bit float registers, Alex Bennée, 2020/04/14
- [PATCH v2 09/17] linux-user: fix /proc/self/stat handling, Alex Bennée, 2020/04/14
- [PATCH v2 10/17] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray, Alex Bennée, 2020/04/14
- [PATCH v2 16/17] tests/tcg: drop inferior.was_attached() test, Alex Bennée, 2020/04/14
- [PATCH v2 17/17] tests/tcg: add a multiarch linux-user gdb test, Alex Bennée, 2020/04/14
- [PATCH v2 15/17] target/m68k: hack around the FPU register support (HACK!), Alex Bennée, 2020/04/14
- [PATCH v2 14/17] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers, Alex Bennée, 2020/04/14
- Re: [PATCH v2 for 5.0-rc3 00/17] more randome fixes (user, pie, docker and gdbstub), no-reply, 2020/04/14