Skip to content

Commit bbc40fe

Browse files
xzpeterstsquad
authored andcommitted
gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb
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: a010bdb ("extend GByteArray to read register helpers") Signed-off-by: Peter Xu <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Tested-by: Stefano Garzarella <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]>
1 parent 4b27f9b commit bbc40fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

target/i386/gdbstub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
106106
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
107107
floatx80 *fp = (floatx80 *) &env->fpregs[n - IDX_FP_REGS];
108108
int len = gdb_get_reg64(mem_buf, cpu_to_le64(fp->low));
109-
len += gdb_get_reg16(mem_buf + len, cpu_to_le16(fp->high));
109+
len += gdb_get_reg16(mem_buf, cpu_to_le16(fp->high));
110110
return len;
111111
} else if (n >= IDX_XMM_REGS && n < IDX_XMM_REGS + CPU_NB_REGS) {
112112
n -= IDX_XMM_REGS;

0 commit comments

Comments
 (0)