From: "Alex Bennée" <alex.bennee@linaro.org>
To: Greg Kurz <groug@kaod.org>
Cc: pbonzini@redhat.com, doug16k@gmail.com,
imbrenda@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 2/2] gdbstub: don't fail on vCont; C04:0; c packets
Date: Wed, 31 May 2017 17:27:04 +0100 [thread overview]
Message-ID: <87wp8xrnzb.fsf@linaro.org> (raw)
In-Reply-To: <20170531181732.13140426@bahia.lan>
Greg Kurz <groug@kaod.org> writes:
> On Wed, 31 May 2017 16:09:33 +0100
> Alex Bennée <alex.bennee@linaro.org> wrote:
>
>> 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
>
> The index can never be 0 in system mode actually, but you're right that this
> check doesn't make sense.
>
> The code still looks a bit convoluted IMHO. What about something like the
> following ?
>
> /* 0 means any thread, so we pick the first valid CPU */
> cpu = tmp ? find_cpu(tmp) : first_cpu;
>
> /* invalid CPU/thread specified */
> if (!cpu) {
> res = -EINVAL;
> goto out;
> }
Yeah that will make it cleaner, I'll apply to v2.
>
> Anyway, the fix looks ok.
>
> Reviewed-by: Greg Kurz <groug@kaod.org>
>
>> 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'
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>> gdbstub.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdbstub.c b/gdbstub.c
>> index a249846954..29c9ed3002 100644
>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -934,8 +934,8 @@ static int gdb_handle_vcont(GDBState *s, const char *p)
>> * CPU first, and only then we can use its index.
>> */
>> cpu = find_cpu(idx);
>> - /* invalid CPU/thread specified */
>> - if (!idx || !cpu) {
>> + /* invalid thread specified, cpu not found. */
>> + if (!cpu) {
>> res = -EINVAL;
>> goto out;
>> }
--
Alex Bennée
next prev parent reply other threads:[~2017-05-31 16:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 15:09 [Qemu-devel] [PATCH v1 0/2] some gdbstub fixes for debug and vcont Alex Bennée
2017-05-31 15:09 ` [Qemu-devel] [PATCH v1 1/2] gdbstub: modernise DEBUG_GDB Alex Bennée
2017-05-31 15:22 ` Philippe Mathieu-Daudé
2017-05-31 15:50 ` Greg Kurz
2017-05-31 15:09 ` [Qemu-devel] [PATCH v1 2/2] gdbstub: don't fail on vCont; C04:0; c packets Alex Bennée
2017-05-31 16:17 ` Greg Kurz
2017-05-31 16:27 ` Alex Bennée [this message]
2017-05-31 16:17 ` Claudio Imbrenda
2017-05-31 16:26 ` Alex Bennée
2017-05-31 16:33 ` Greg Kurz
2017-05-31 16:51 ` Claudio Imbrenda
2017-05-31 17:06 ` Greg Kurz
2017-05-31 17:40 ` Claudio Imbrenda
2017-05-31 18:16 ` Alex Bennée
2017-05-31 18:33 ` Greg Kurz
2017-05-31 17:23 ` Alex Bennée
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=87wp8xrnzb.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=doug16k@gmail.com \
--cc=groug@kaod.org \
--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).