qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 06/27] gdbstub: Implement set_thread (H pkt)


From: Alex Bennée
Subject: Re: [Qemu-devel] [PATCH v9 06/27] gdbstub: Implement set_thread (H pkt) with new infra
Date: Wed, 15 May 2019 11:06:44 +0100
User-agent: mu4e 1.3.1; emacs 26.1

Jon Doron <address@hidden> writes:

> Signed-off-by: Jon Doron <address@hidden>
> ---
>  gdbstub.c | 79 ++++++++++++++++++++++++++++++++++---------------------
>  1 file changed, 49 insertions(+), 30 deletions(-)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index 469aaeb875..21cdaf4678 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -1547,6 +1547,47 @@ static void handle_cont_with_sig(GdbCmdContext 
> *gdb_ctx, void *user_ctx)
>      gdb_continue(gdb_ctx->s);
>  }
>
> +static void handle_set_thread(GdbCmdContext *gdb_ctx, void *user_ctx)
> +{
> +    CPUState *cpu;
> +
> +    if (gdb_ctx->num_params < 2) {

Given we should have a fixed number of parameters != 2 perhaps?

> +        put_packet(gdb_ctx->s, "E22");
> +        return;
> +    }
> +
> +    if (gdb_ctx->params[1].thread_id.kind == GDB_READ_THREAD_ERR) {
> +        put_packet(gdb_ctx->s, "E22");
> +        return;
> +    }
> +
> +    if (gdb_ctx->params[1].thread_id.kind != GDB_ONE_THREAD) {
> +        put_packet(gdb_ctx->s, "OK");
> +        return;
> +    }
> +
> +    cpu = gdb_get_cpu(gdb_ctx->s, gdb_ctx->params[1].thread_id.pid,
> +                      gdb_ctx->params[1].thread_id.tid);
> +    if (!cpu) {
> +        put_packet(gdb_ctx->s, "E22");
> +        return;
> +    }
> +
> +    switch (gdb_ctx->params[0].opcode) {


Perhaps a comment here to say this is a legacy command and modern gdb's
should be using vCont?

> +    case 'c':
> +        gdb_ctx->s->c_cpu = cpu;
> +        put_packet(gdb_ctx->s, "OK");
> +        break;
> +    case 'g':
> +        gdb_ctx->s->g_cpu = cpu;
> +        put_packet(gdb_ctx->s, "OK");
> +        break;
> +    default:
> +        put_packet(gdb_ctx->s, "E22");
> +        break;
> +    }
> +}
<snip>

Otherwise:

Reviewed-by: Alex Bennée <address@hidden>

--
Alex Bennée



reply via email to

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