public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
Cc: Tom de Vries <tdevries@suse.de>,  Tom Tromey <tom@tromey.com>
Subject: Re: [RFC 3/3] [gdb/dap] Allow WAIT_FOR_EVENTS input
Date: Wed, 10 May 2023 10:29:18 -0600	[thread overview]
Message-ID: <874jok5ew1.fsf@tromey.com> (raw)
In-Reply-To: <20230314130535.6369-4-tdevries@suse.de> (Tom de Vries via Gdb-patches's message of "Tue, 14 Mar 2023 14:05:35 +0100")

>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> Modify the dap input format to allow a WAIT_FOR_EVENTS line:
Tom> ...
Tom> Content-Length: 54
Tom> WAIT_FOR_EVENTS: 1
Tom> {"seq": 1, "type": "request", "command": "initialize"}
Tom> Content-Length: 163

I think the commit message would benefit from an explanation of the
rationale.

Tom> +        if line.startswith(b"WAIT_FOR_EVENTS:") and content_length != None:
Tom> +            line = line[16:].strip()
Tom> +            wait_for_events = int(line)
Tom> +            break

A comment here explaining why gdb accepts this header and what it's
useful for would also be good.

Tom> +            while True:
Tom> +                if wait_for_events <= self.send_event_cnt:
Tom> +                    self.send_event_cnt -= wait_for_events
Tom> +                    break
Tom> +                time.sleep(1)

Can't this be

   while wait_for_events > self.send_event_cnt:
       time.sleep(1)

Instead of sleep it is probably more efficient to use a queue of some
kind and have the event-generation code write to it when the required
number of events have been sent.  Not sure if we really care in debug
mode though.

Tom

      parent reply	other threads:[~2023-05-10 16:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 13:05 [RFC 0/3] [gdb/dap] Handle DAP command files Tom de Vries
2023-03-14 13:05 ` [RFC 1/3] [gdb/dap] Add logging of ignored lines Tom de Vries
2023-03-14 14:12   ` Tom Tromey
2023-03-24  8:10     ` Tom de Vries
2023-03-14 13:05 ` [RFC 2/3] [gdb/dap] Allow Content-Length on separate line Tom de Vries
2023-03-14 14:13   ` Tom Tromey
2023-03-14 15:35     ` Tom de Vries
2023-05-05 13:09       ` Tom Tromey
2023-03-14 13:05 ` [RFC 3/3] [gdb/dap] Allow WAIT_FOR_EVENTS input Tom de Vries
2023-05-05 13:09   ` Tom Tromey
2023-05-05 14:01     ` Tom de Vries
2023-05-10 16:23       ` Tom Tromey
2023-05-10 16:29   ` Tom Tromey [this message]

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=874jok5ew1.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).