[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 4/4] gdbstub: don't fail on vCont; C04:0; c packe
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v4 4/4] gdbstub: don't fail on vCont; C04:0; c packets |
Date: |
Wed, 12 Jul 2017 11:52:16 +0100 |
The thread-id of 0 means any CPU but we then ignore the fact we find
the first_cpu in this case who can have an index of 0. Instead of
bailing out just test if we have managed to match up thread-id to a
CPU.
Otherwise you get:
gdb_handle_packet: command='vCont;C04:0;c'
put_packet: reply='E22'
The actual reason for gdb sending vCont;C04:0;c was fixed in a
previous commit where we ensure the first_cpu's tid is correctly
reported to gdb however we should still behave correctly next time it
does send 0.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Reviewed-by: Claudio Imbrenda <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
v4
- one more r-b
v2
- used Greg's less convoluted suggestion
- expand commit message
---
gdbstub.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index 484e96dbd9..a576585638 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -938,23 +938,16 @@ static int gdb_handle_vcont(GDBState *s, const char *p)
if (res) {
goto out;
}
- idx = tmp;
+
/* 0 means any thread, so we pick the first valid CPU */
- if (!idx) {
- idx = cpu_gdb_index(first_cpu);
- }
+ cpu = tmp ? find_cpu(tmp) : first_cpu;
- /*
- * If we are in user mode, the thread specified is actually a
- * thread id, and not an index. We need to find the actual
- * CPU first, and only then we can use its index.
- */
- cpu = find_cpu(idx);
/* invalid CPU/thread specified */
- if (!idx || !cpu) {
+ if (!cpu) {
res = -EINVAL;
goto out;
}
+
/* only use if no previous match occourred */
if (newstates[cpu->cpu_index] == 1) {
newstates[cpu->cpu_index] = cur_action;
--
2.13.0
- [Qemu-devel] [PATCH v4 0/4] some gdbstub fixes for debug and vcont, Alex Bennée, 2017/07/12
- [Qemu-devel] [PATCH v4 2/4] gdbstub: rename cpu_index -> cpu_gdb_index, Alex Bennée, 2017/07/12
- [Qemu-devel] [PATCH v4 1/4] gdbstub: modernise DEBUG_GDB, Alex Bennée, 2017/07/12
- [Qemu-devel] [PATCH v4 3/4] qom/cpu: remove host_tid field, Alex Bennée, 2017/07/12
- [Qemu-devel] [PATCH v4 4/4] gdbstub: don't fail on vCont; C04:0; c packets,
Alex Bennée <=
- Re: [Qemu-devel] [PATCH v4 0/4] some gdbstub fixes for debug and vcont, Philippe Mathieu-Daudé, 2017/07/12
- Re: [Qemu-devel] [PATCH v4 0/4] some gdbstub fixes for debug and vcont, Paolo Bonzini, 2017/07/12