This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix gdbserver queued packet handling


On Fri, Apr 30, 2010 at 10:55 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> 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.

Blech.  I wish I had gone with my original thought.

[btw, IWBN if one didn't have to have the state machine - e.g. if one
could query whether an event was scheduled.  One could register timer
callbacks first, get a stable handle to use in the query, and then
schedule them, for example.]

I like this patch better.
[Essentially all it does is the same thing gdb does, except that it
doesn't bring over the complexity of timer handling, which isn't
needed.]

P.S. IWBN if one didn't have to continually keep bringing stuff over
from gdb.  Wouldn't it be nice if one could just include an
event-loop.h (or some such) and use it.  I'm developing the feeling
that this is another instance where IWBN if gdb and gdbserver could
share code.

2010-05-03  Doug Evans  <dje@google.com>

        * event-loop.c (struct callback_event): New struct.
        (callback_list): New global.
        (append_callback_event, delete_callback_event): New functions.
        (process_callback): New function.
        (start_event_loop): Call it.
        * remote-utils.c (NOT_SCHEDULED): Define.
        (readchar_buf, readchar_bufcnt, readchar_bufp): New static globals,
        moved out of readchar.
        (readchar): Rewrite.  Call reschedule before returning.
        (reset_readchar): New function.
        (remote_close): Call it.
        (process_remaining, reschedule): New functions.
        * server.h (callback_handler_func): New typedef.
        (append_callback_event, delete_callback_event): Declare.

Attachment: gdb-100503-gdbserver-queue-2.patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]