Re: [remote protocol] Allow qSymbol response to continue packets

Andrew Cagney
2004-03-17T16:07:58Z

> That's not correct, unfortunately. A packet containing
> <symbol><cntrl-C>, sure, that's easy. But <retry><cntrl-C> is pretty
> hard. The call stack at this point goes through the middle of
> libthread_db; I can't resume the inferior to give it a real SIGINT
> without have to jump through hoops to re-initialize libthread_db after
> processing the SIGINT, so I would have to:
>
> - stop all other running threads, if there are any; there could be
> depending on what libthread_db is trying to look up
> - forge a stop-with-SIGINT packet
> - handle whatever packets GDB sends me while I'm stopped
> - wait for GDB to resume
> - cause the resume to trigger re-issue of the queued qSymbol "stop
> response"
> - repeat until this succeeds
> - return that result to libthread_db
>
> The long and short of it is that I'd have to duplicate or considerably
> modularize the packet processing, to make the main loop re-entrant, to
> support interruption of an otherwise non-blocking operation.

Unfortunatly, an event driven state machine is the "text book correct"
way of implementing a protocol (anything less is a crock). Thats why I
wrote RDA the way I did, and thats why gdb's remote code continues to
need an overhaul (hopefully eventually sharing code with gdbserver). If
the original author of that code had thought to read s/w telco text,
your and my life today would have been a lot easier, sigh.

Anyway, if F is used as the interaction model, should F also be used as
the packet format? Can I suggest, for queries to GDB, 'f' be used as
the packet prefix letter but use 'F' for the rest of the specification.
That would give us:

<- fSymbol,<symbol-name>

-> f0,0,;<symbol-value>
or
-> f0,EINTR,;
or
-> f0,EINTR,C;

I suspect that is sufficient (looking at the code I think "F" can be
simplified somewhat - time permitting :-().

The other option would be to generate T00 packets - cause GDB to go
through the motions but then resume it?

Andrew