public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Kévin Le Gouguec" <legouguec@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] Avoid exception from attach in DAP
Date: Wed, 13 Dec 2023 17:36:01 +0100	[thread overview]
Message-ID: <87o7eu3vri.fsf@adacore.com> (raw)
In-Reply-To: <20231212-dap-no-test-exceptions-v1-3-af0e33f10093@adacore.com> (Tom Tromey's message of "Tue, 12 Dec 2023 10:44:44 -0700")

Tom Tromey <tromey@adacore.com> writes:

> +    if "reason" not in event.details:
> +        # This can only really happen via a "repl" evaluation of
> +        # something like "attach".  In this case just emit a generic
> +        # stop.
> +        obj["reason"] = "stopped"
>      else:
> -        obj["reason"] = stop_reason_map[reason]
> +        reason = event.details["reason"]
> +        if (
> +                _expected_pause
> +                and reason == "signal-received"
> +                and event.details["signal-name"] in ("SIGINT", "SIGSTOP")
> +        ):
> +            obj["reason"] = "pause"
> +        else:
> +            global stop_reason_map
> +            obj["reason"] = stop_reason_map[reason]
>      _expected_pause = False
>      send_event("stopped", obj)

Nit: I'd find

    if "reason" not in event.details:
        # ...
        obj["reason"] = "stopped"
    elif (
        _expected_pause
        and event.details["reason"] == "signal-received"
        and event.details["signal-name"] in ("SIGINT", "SIGSTOP")
    ):
        obj["reason"] = "pause"
    else:
        global stop_reason_map
        obj["reason"] = stop_reason_map[event.details["reason"]]

slightly more legible (less nesting; easier to understand that the
purpose of each branch is to set obj["reason"]), even if it means
repeating event.details["reason"].  Really not a huge deal though, good
to go as-is for me.

Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>

  reply	other threads:[~2023-12-13 16:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 17:44 [PATCH 0/4] Check for rogue DAP exceptions Tom Tromey
2023-12-12 17:44 ` [PATCH 1/4] Introduce and use DAPException Tom Tromey
2023-12-12 17:44 ` [PATCH 2/4] Add DAP log level parameter Tom Tromey
2023-12-12 18:39   ` Eli Zaretskii
2023-12-14 19:02     ` Tom Tromey
2023-12-13 16:35   ` Kévin Le Gouguec
2023-12-14 19:06     ` Tom Tromey
2023-12-12 17:44 ` [PATCH 3/4] Avoid exception from attach in DAP Tom Tromey
2023-12-13 16:36   ` Kévin Le Gouguec [this message]
2023-12-14 18:52     ` Tom Tromey
2023-12-12 17:44 ` [PATCH 4/4] Check for rogue DAP exceptions in test suite Tom Tromey
2023-12-13 16:36 ` [PATCH 0/4] Check for rogue DAP exceptions Kévin Le Gouguec
2023-12-22 16:57 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7eu3vri.fsf@adacore.com \
    --to=legouguec@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).