[Pdbg] [PATCH v2 30/39] gdbserver: tidy poll()
Joel Stanley
joel at jms.id.au
Tue May 3 17:32:07 AEST 2022
On Wed, 20 Apr 2022 at 06:51, Nicholas Piggin <npiggin at gmail.com> wrote:
>
> Remove the pointless case statement and reduce indentation.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
Reviewed-by: Joel Stanley <joel at jms.id.au>
> ---
> src/pdbgproxy.c | 46 +++++++++++++++++++++-------------------------
> 1 file changed, 21 insertions(+), 25 deletions(-)
>
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index 01419108..c5870091 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -708,40 +708,36 @@ static void poll(void)
> {
> struct thread_state status;
>
> + if (state != SIGNAL_WAIT)
> + return;
> +
> thread_target->probe(thread_target);
> status = thread_status(thread_target);
>
> - switch (state) {
> - case IDLE:
> - break;
> -
> - case SIGNAL_WAIT:
> - if (!(status.quiesced))
> - break;
> -
> - set_attn(false);
> + if (!(status.quiesced))
> + return;
>
> - state = IDLE;
> - poll_interval = VCONT_POLL_DELAY;
> + set_attn(false);
>
> - if (thread_check_attn(thread_target)) {
> - uint64_t nia;
> + state = IDLE;
> + poll_interval = VCONT_POLL_DELAY;
>
> - if (!(status.active)) {
> - PR_ERROR("Thread inactive after trap\n");
> - send_response(fd, ERROR(EPERM));
> - return;
> - }
> + if (thread_check_attn(thread_target)) {
> + uint64_t nia;
>
> - /* Restore NIA */
> - if (thread_getnia(thread_target, &nia))
> - PR_ERROR("Error during getnia\n");
> - if (thread_putnia(thread_target, nia - 4))
> - PR_ERROR("Error during putnia\n");
> + if (!(status.active)) {
> + PR_ERROR("Thread inactive after trap\n");
> + send_response(fd, ERROR(EPERM));
> + return;
> }
> - send_response(fd, TRAP);
> - break;
> +
> + /* Restore NIA */
> + if (thread_getnia(thread_target, &nia))
> + PR_ERROR("Error during getnia\n");
> + if (thread_putnia(thread_target, nia - 4))
> + PR_ERROR("Error during putnia\n");
> }
> + send_response(fd, TRAP);
> }
>
> static void cmd_default(uint64_t *stack, void *priv)
> --
> 2.35.1
>
> --
> Pdbg mailing list
> Pdbg at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
More information about the Pdbg
mailing list