All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] gdb: Fix gdb error
Date: Mon, 12 Aug 2013 10:48:41 +0200	[thread overview]
Message-ID: <5208A169.4010109@suse.de> (raw)
In-Reply-To: <1376244860-19714-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

Hi Aneesh,

Am 11.08.2013 20:14, schrieb Aneesh Kumar K.V:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 
> Don't update the global register count if not requested.
> Without this patch a remote gdb session gives
> 
> (gdb) target remote localhost:1234
> Remote debugging using localhost:1234
> Remote 'g' packet reply is too long:
> 0000000028000084c000000000ccba50c000000000c ...
> ....
> ...
> (gdb)
> 
> This is a regression introduce by a0e372f0c49ac01faeaeb73a6e8f50e8ac615f34
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Thanks for tracking this down. I'm willing to include a variation in
today's pull to fix 1.6.0-rc3. However, did you find an explanation
*why* it needs to be like this? I understand it is a revert to using the
static variable, updated to using the CPUClass field rather than the
previous preprocessor constant.

> ---
>  gdbstub.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index 1af25a6..4b58a1e 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -598,6 +598,12 @@ void gdb_register_coprocessor(CPUState *cpu,
>  {
>      GDBRegisterState *s;
>      GDBRegisterState **p;
> +    static int last_reg;
> +    CPUClass *cc = CPU_GET_CLASS(cpu);
> +
> +    if (!last_reg) {
> +        last_reg = cc->gdb_num_core_regs;
> +    }
>  
>      p = &cpu->gdb_regs;
>      while (*p) {
> @@ -608,19 +614,21 @@ void gdb_register_coprocessor(CPUState *cpu,
>      }
>  
>      s = g_new0(GDBRegisterState, 1);
> -    s->base_reg = cpu->gdb_num_regs;
> +    s->base_reg = last_reg;
>      s->num_regs = num_regs;
>      s->get_reg = get_reg;
>      s->set_reg = set_reg;
>      s->xml = xml;
>  
>      /* Add to end of list.  */
> -    cpu->gdb_num_regs += num_regs;
> +    last_reg += num_regs;
>      *p = s;
>      if (g_pos) {
>          if (g_pos != s->base_reg) {
>              fprintf(stderr, "Error: Bad gdb register numbering for '%s'\n"
>                      "Expected %d got %d\n", xml, g_pos, s->base_reg);

> +        } else {
> +            cpu->gdb_num_regs = last_reg;

This bit looks wrong to me - it is updating the per-CPU count with the
global value. Could you retest without this please?

Regards,
Andreas

>          }
>      }
>  }
> 


-- 
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-08-12  8:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11 18:14 [Qemu-devel] [PATCH] gdb: Fix gdb error Aneesh Kumar K.V
2013-08-12  8:48 ` Andreas Färber [this message]
2013-08-12  9:17   ` Aneesh Kumar K.V
2013-08-12 17:40     ` Andreas Färber

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=5208A169.4010109@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.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 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.