qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v9 09/27] gdbstub: Implement set register (P pkt


From: Jon Doron
Subject: Re: [Qemu-devel] [PATCH v9 09/27] gdbstub: Implement set register (P pkt) with new infra
Date: Sun, 19 May 2019 13:32:41 +0300

You are right but I was under the impression you want the patches to
have the exact same logic of the original code, that why i kept
adding those null packets and the parameter checks to be < N rather than !=

Now that I understand you prefer to fix the implementation ill review
all the patches and add error replays accordingly

-- Jon.

On Wed, May 15, 2019 at 3:14 PM Alex Bennée <address@hidden> wrote:
>
>
> Jon Doron <address@hidden> writes:
>
> > Signed-off-by: Jon Doron <address@hidden>
> > ---
> >  gdbstub.c | 39 ++++++++++++++++++++++++++++++---------
> >  1 file changed, 30 insertions(+), 9 deletions(-)
> >
> > diff --git a/gdbstub.c b/gdbstub.c
> > index b42425b24c..10e3f12a68 100644
> > --- a/gdbstub.c
> > +++ b/gdbstub.c
> > @@ -1634,6 +1634,27 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx, 
> > void *user_ctx)
> >      put_packet(gdb_ctx->s, "E22");
> >  }
> >
> > +static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx)
> > +{
> > +    int reg_size;
> > +
> > +    if (!gdb_has_xml) {
> > +        put_packet(gdb_ctx->s, "");
> > +        return;
> > +    }
> > +
> > +    if (gdb_ctx->num_params < 2) {
>
> != 2?
>
> > +        put_packet(gdb_ctx->s, "");
> > +        return;
> > +    }
>
> I don't understand what these null put_packets have been added for.
> Should we not report an E code on failure?
>
> > +
> > +    reg_size = strlen(gdb_ctx->params[1].data) / 2;
> > +    hextomem(gdb_ctx->mem_buf, gdb_ctx->params[1].data, reg_size);
> > +    gdb_write_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf,
> > +                       gdb_ctx->params[0].val_ull);
> > +    put_packet(gdb_ctx->s, "OK");
> > +}
> > +
> >  static int gdb_handle_packet(GDBState *s, const char *line_buf)
> >  {
> >      CPUState *cpu;
> > @@ -1878,15 +1899,15 @@ static int gdb_handle_packet(GDBState *s, const 
> > char *line_buf)
> >          }
> >          break;
> >      case 'P':
> > -        if (!gdb_has_xml)
> > -            goto unknown_command;
> > -        addr = strtoull(p, (char **)&p, 16);
> > -        if (*p == '=')
> > -            p++;
> > -        reg_size = strlen(p) / 2;
> > -        hextomem(mem_buf, p, reg_size);
> > -        gdb_write_register(s->g_cpu, mem_buf, addr);
> > -        put_packet(s, "OK");
> > +        {
> > +            static const GdbCmdParseEntry set_reg_cmd_desc = {
> > +                .handler = handle_set_reg,
> > +                .cmd = "P",
> > +                .cmd_startswith = 1,
> > +                .schema = "L?s0"
> > +            };
> > +            cmd_parser = &set_reg_cmd_desc;
> > +        }
> >          break;
> >      case 'Z':
> >          {
>
>
> --
> Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]