[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/28] gdbstub: Fix single-step issue by confirming 'vContSupporte
From: |
Alex Bennée |
Subject: |
[PULL 28/28] gdbstub: Fix single-step issue by confirming 'vContSupported+' feature to gdb |
Date: |
Tue, 17 Mar 2020 17:50:53 +0000 |
From: Changbin Du <address@hidden>
Recently when debugging an arm32 system on qemu, I found sometimes the
single-step command (stepi) is not working. This can be reproduced by
below steps:
1) start qemu-system-arm -s -S .. and wait for gdb connection.
2) start gdb and connect to qemu. In my case, gdb gets a wrong value
(0x60) for PC, which is an another bug.
3) After connected, type 'stepi' and expect it will stop at next ins.
But, it has never stopped. This because:
1) We doesn't report ‘vContSupported’ feature to gdb explicitly and gdb
think we do not support it. In this case, gdb use a software breakpoint
to emulate single-step.
2) Since gdb gets a wrong initial value of PC, then gdb inserts a
breakpoint to wrong place (PC+4).
Not only for the arm target, Philippe has also encountered this on MIPS.
Probably gdb has different assumption for different architectures.
Since we do support ‘vContSupported’ query command, so let's tell gdb that
we support it.
Before this change, gdb send below 'Z0' packet to implement single-step:
gdb_handle_packet: Z0,4,4
After this change, gdb send "vCont;s.." which is expected:
gdb_handle_packet: vCont?
put_packet: vCont;c;C;s;S
gdb_handle_packet: vCont;s:p1.1;c:p1.-1
Signed-off-by: Changbin Du <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
[AJB: fix for static gdbstub]
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Luc Michel <address@hidden>
Message-Id: <address@hidden>
diff --git a/gdbstub.c b/gdbstub.c
index 9ae148cd1ff..013fb1ac0f1 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2130,7 +2130,7 @@ static void handle_query_supported(GdbCmdContext
*gdb_ctx, void *user_ctx)
gdbserver_state.multiprocess = true;
}
- g_string_append(gdbserver_state.str_buf, ";multiprocess+");
+ g_string_append(gdbserver_state.str_buf, ";vContSupported+;multiprocess+");
put_strbuf();
}
--
2.20.1
- [PULL 23/28] tests/tcg/aarch64: add a gdbstub testcase for SVE registers, (continued)
- [PULL 23/28] tests/tcg/aarch64: add a gdbstub testcase for SVE registers, Alex Bennée, 2020/03/17
- [PULL 19/28] target/arm: don't bother with id_aa64pfr0_read for USER_ONLY, Alex Bennée, 2020/03/17
- [PULL 27/28] gdbstub: do not split gdb_monitor_write payload, Alex Bennée, 2020/03/17
- [PULL 20/28] tests/tcg/aarch64: userspace system register test, Alex Bennée, 2020/03/17
- [PULL 26/28] gdbstub: change GDBState.last_packet to GByteArray, Alex Bennée, 2020/03/17
- [PULL 18/28] target/arm: generate xml description of our SVE registers, Alex Bennée, 2020/03/17
- [PULL 24/28] tests/tcg/aarch64: add SVE iotcl test, Alex Bennée, 2020/03/17
- [PULL 22/28] tests/guest-debug: add a simple test runner, Alex Bennée, 2020/03/17
- [PULL 21/28] configure: allow user to specify what gdb to use, Alex Bennée, 2020/03/17
- [PULL 17/28] target/arm: default SVE length to 64 bytes for linux-user, Alex Bennée, 2020/03/17
- [PULL 28/28] gdbstub: Fix single-step issue by confirming 'vContSupported+' feature to gdb,
Alex Bennée <=
- Re: [PULL 00/28 for 5.0] testing and gdbstub updates, Peter Maydell, 2020/03/18