All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] gdbstub: fix sThreadInfo handler
Date: Mon, 22 Jul 2013 12:54:15 +0200	[thread overview]
Message-ID: <51ED0F57.9000605@suse.de> (raw)
In-Reply-To: <1374470667-14586-1-git-send-email-jcmvbkbc@gmail.com>

Am 22.07.2013 07:24, schrieb Max Filippov:
> After the commit 182735e cpu: Make first_cpu and next_cpu CPUState
> we can no longer blindly use cpu->next_cpu->env_ptr to get CPUArchState
> of the next CPU, as the next_cpu is NULL in the last CPU.
> 
> This fixes segfault caused by gdb command 'info threads'.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

This should be obsoleted by the patch on qom-cpu that I pointed you to,
no? I so far didn't send a pull for that alone since I was hoping to get
more gdbstub patches in - I added a comment explaining vaddr type as
requested by Peter, so a Reviewed-by/Acked-by for the modified Xtensa
subclasses would help push that forward, and no one bothered to review
the ..._read_register() changes yet IIRC, split up on rth's request. I
could just apply the initial set_pc stuff of course and wait some longer
with the rest.

Andreas

> ---
>  gdbstub.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index 0ee82a9..deb8159 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2406,10 +2406,11 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
>          } else if (strcmp(p,"sThreadInfo") == 0) {
>          report_cpuinfo:
>              if (s->query_cpu) {
> +                CPUState *cpu = ENV_GET_CPU(s->query_cpu);
>                  snprintf(buf, sizeof(buf), "m%x",
> -                         cpu_index(ENV_GET_CPU(s->query_cpu)));
> +                         cpu_index(cpu));
>                  put_packet(s, buf);
> -                s->query_cpu = ENV_GET_CPU(s->query_cpu)->next_cpu->env_ptr;
> +                s->query_cpu = cpu->next_cpu ? cpu->next_cpu->env_ptr : NULL;
>              } else
>                  put_packet(s, "l");
>              break;
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2013-07-22 10:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22  5:24 [Qemu-devel] [PATCH] gdbstub: fix sThreadInfo handler Max Filippov
2013-07-22 10:54 ` Andreas Färber [this message]
2013-07-22 11:32   ` Max Filippov

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=51ED0F57.9000605@suse.de \
    --to=afaerber@suse.de \
    --cc=jcmvbkbc@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.