[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
- Re: [Qemu-devel] [PATCH v9 14/27] gdbstub: Implement read all registers (g pkt) with new infra, (continued)
[Qemu-devel] [PATCH v9 10/27] gdbstub: Implement get register (p pkt) with new infra, Jon Doron, 2019/05/02
[Qemu-devel] [PATCH v9 09/27] gdbstub: Implement set register (P pkt) with new infra, Jon Doron, 2019/05/02
[Qemu-devel] [PATCH v9 17/27] gdbstub: Implement v commands with new infra, Jon Doron, 2019/05/02
[Qemu-devel] [PATCH v9 06/27] gdbstub: Implement set_thread (H pkt) with new infra, Jon Doron, 2019/05/02
- Re: [Qemu-devel] [PATCH v9 06/27] gdbstub: Implement set_thread (H pkt) with new infra,
Alex Bennée <=
[Qemu-devel] [PATCH v9 22/27] gdbstub: Implement generic query qemu.Supported, Jon Doron, 2019/05/02
[Qemu-devel] [PATCH v9 07/27] gdbstub: Implement insert breakpoint (Z pkt) with new infra, Jon Doron, 2019/05/02
[Qemu-devel] [PATCH v9 20/27] gdbstub: Implement target halted (? pkt) with new infra, Jon Doron, 2019/05/02
[Qemu-devel] [PATCH v9 12/27] gdbstub: Implement read memory (m pkt) with new infra, Jon Doron, 2019/05/02