Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: Re: [RFA] Fix gdbserver queued packet handling
Date: Fri, 30 Apr 2010 17:55:00 -0000	[thread overview]
Message-ID: <201004301855.12464.pedro@codesourcery.com> (raw)
In-Reply-To: <20100430171731.5600984398@ruffy.mtv.corp.google.com>

On Friday 30 April 2010 18:17:31, Doug Evans wrote:

> 2010-04-30  Doug Evans  <dje@google.com>
> 
> 	* server.h (queue_file_read_event): Declare.
> 	(reschedule_remote): Declare.
> 	* event-loop.c (queue_file_read_event): New function.
> 	* remote-utils.c (reschedule_remote): New function.
> 	(readchar_buf, readchar_bufcnt, readchar_bufp): New static globals,
> 	moved out of readchar.
> 	* server.c (handle_serial_event): Call reschedule_remote.

This looks good, thanks.  Please apply.

> @@ -3009,6 +3009,10 @@ handle_serial_event (int err, gdb_client
>       Important in the non-stop mode asynchronous protocol.  */
>    set_desired_inferior (1);
>  
> +  /* Give the packet reader a chance to schedule more work before
> +     we go to sleep.  */
> +  reschedule_remote ();
> +

This seems to break the abstraction a bit.  GDB attempts
a reschedule on every `readchar', and avoids unnecessary calls
into the event loop by maintaining a state machine, so
everything is nicelly hidden within the serial handling code.
But I'm fine with this simpler mechanism.  I can't think
of any reads from the socket outside of handle_serial_event;
we'd be still in trouble this way if there were.  In non-stop, we
push stop notifications to gdb when handling target events, but
asynchronous RSP notifications are a special kind of packet
that is never acked, even if no-ack is off, so not even those
cause reads that could cause data being pulled to the buffer.

-- 
Pedro Alves


  reply	other threads:[~2010-04-30 17:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-30 17:17 Doug Evans
2010-04-30 17:55 ` Pedro Alves [this message]
2010-05-03 19:53   ` Doug Evans
2010-05-03 20:41     ` Pedro Alves

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=201004301855.12464.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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