qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: pbonzini@redhat.com, doug16k@gmail.com, imbrenda@linux.vnet.ibm.com
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PATCH v2 4/4] gdbstub: don't fail on vCont; C04:0; c packets
Date: Thu,  1 Jun 2017 15:49:15 +0100	[thread overview]
Message-ID: <20170601144915.20778-5-alex.bennee@linaro.org> (raw)
In-Reply-To: <20170601144915.20778-1-alex.bennee@linaro.org>

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 <alex.bennee@linaro.org>
Reviewed-by: Greg Kurz <groug@kaod.org>

---
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 45a3a0b16b..6b1e72e9f7 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -937,23 +937,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

  parent reply	other threads:[~2017-06-01 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 14:49 [Qemu-devel] [PATCH v2 0/4] some gdbstub fixes for debug and vcont Alex Bennée
2017-06-01 14:49 ` [Qemu-devel] [PATCH v2 1/4] gdbstub: modernise DEBUG_GDB Alex Bennée
2017-06-01 14:49 ` [Qemu-devel] [PATCH v2 2/4] gdbstub: rename cpu_index -> cpu_gdb_index Alex Bennée
2017-06-01 15:13   ` Greg Kurz
2017-06-01 15:48   ` Claudio Imbrenda
2017-06-02  5:02   ` Philippe Mathieu-Daudé
2017-06-01 14:49 ` [Qemu-devel] [PATCH v2 3/4] qom/cpu: remove host_tid field Alex Bennée
2017-06-01 15:32   ` Greg Kurz
2017-06-01 15:54     ` Claudio Imbrenda
2017-06-01 15:52   ` Philippe Mathieu-Daudé
2017-06-01 16:11   ` Laurent Vivier
2017-06-01 14:49 ` Alex Bennée [this message]
2017-06-01 15:54   ` [Qemu-devel] [PATCH v2 4/4] gdbstub: don't fail on vCont; C04:0; c packets Philippe Mathieu-Daudé
2017-06-01 15:54   ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170601144915.20778-5-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=doug16k@gmail.com \
    --cc=imbrenda@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).