[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] gdbstub: Fix client Ctrl-C handling
From: |
Matheus Tavares Bernardino |
Subject: |
Re: [PATCH] gdbstub: Fix client Ctrl-C handling |
Date: |
Tue, 11 Jul 2023 08:03:43 -0300 |
> Nicholas Piggin <npiggin@gmail.com> wrote:
>
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 6911b73c07..ce8b42eb15 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
> return;
> }
> if (runstate_is_running()) {
> - /* when the CPU is running, we cannot do anything except stop
> - it when receiving a char */
> + /*
> + * When the CPU is running, we cannot do anything except stop
> + * it when receiving a char. This is expected on a Ctrl-C in the
> + * gdb client. Because we are in all-stop mode, gdb sends a
> + * 0x03 byte which is not a usual packet, so we handle it specially
> + * here, but it does expect a stop reply.
> + */
> + if (ch != 0x03) {
> + warn_report("gdbstub: client sent packet while target
> running\n");
> + }
> + gdbserver_state.allow_stop_reply = true;
> vm_stop(RUN_STATE_PAUSED);
> } else
> #endif
Makes sense to me, but shouldn't we send the stop-reply packet only for
Ctrl+C/0x03?
Re: [PATCH] gdbstub: Fix client Ctrl-C handling, Nicholas Piggin, 2023/07/11