public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: "Kévin Le Gouguec" <legouguec@adacore.com>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] Implement the notStopped DAP response
Date: Fri, 10 Nov 2023 07:52:32 -0700	[thread overview]
Message-ID: <87a5rlvexb.fsf@tromey.com> (raw)
In-Reply-To: <878r78bqlk.fsf@adacore.com> (=?utf-8?Q?=22K=C3=A9vin?= Le Gouguec"'s message of "Wed, 08 Nov 2023 09:23:51 +0100")

>>>>> "Kévin" == Kévin Le Gouguec <legouguec@adacore.com> writes:

>> +# True when the inferior is thought to be running, False otherwise.
>> +# This may be accessed from any thread, which can be racy.  However,
>> +# this unimportant because this global is only used for the
>> +# 'notStopped' response, which itself is inherently racy.
>> +inferior_running = False

Kévin> Out of curiosity, could `inferior_thread ()->state` have helped here?
Kévin> (Exposing it as a gdb.Inferior method perhaps?)

Kévin> Not necessarily with the "racy" part; thinking more of the "keep a
Kévin> single source of truth" part (i.e. dispense with relying on event
Kévin> notifications).

Possibly, but it couldn't be called from a non-gdb thread, so we'd have
to send a message to the gdb thread and then a message back.

>> +        # Import this as late as possible.  FIXME.
>> +        from .events import inferior_running

Kévin> Assuming this is what the FIXME is about (apologies if not): an
Kévin> alternative could be doing a bare `import .events`, then lookup
Kévin> `.events.inferior_running` in check().  Or defining an accessor function
Kévin> in .events and importing that instead of this global.

The problem is a circular import, as events imports from server.
I may just remove this comment?  Not sure.

Originally here I was thinking of putting more event listeners in
server.py, but it seemed strange not to just reuse the existing ones.

Tom

  reply	other threads:[~2023-11-10 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 18:29 [PATCH 0/3] Implement the DAP notStopped response Tom Tromey
2023-11-07 18:29 ` [PATCH 1/3] Automatically run (most) DAP requests in gdb thread Tom Tromey
2023-11-13 12:59   ` Alexandra Petlanova Hajkova
2023-11-07 18:29 ` [PATCH 2/3] Remove ExecutionInvoker Tom Tromey
2023-11-13 13:57   ` Alexandra Petlanova Hajkova
2023-11-07 18:29 ` [PATCH 3/3] Implement the notStopped DAP response Tom Tromey
2023-11-08  8:23   ` Kévin Le Gouguec
2023-11-10 14:52     ` Tom Tromey [this message]
2023-11-10 15:14       ` Kévin Le Gouguec
2023-11-10 15:18         ` Tom Tromey
2023-11-10 15:08     ` 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=87a5rlvexb.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=legouguec@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).