Thread awareness in remote serial protocol Z packet
Andrew Cagney
ac131313@ges.redhat.com
Thu Sep 12 13:36:00 GMT 2002
[watch out for mozilla messing up the ``>'' in the below]
> On Wed, Sep 11, 2002 at 11:38:25AM -0700, Earl Chew wrote:
>
>> Daniel Jacobowitz wrote:
>
>> > Earl wrote:
>
>> > > Perhaps extended the Z protocol to allow Zt,addr,length,id
>> > > (plus the corresponding change in breakpoint.c) would be sufficient
>> > > to allow this. Old targets presumably would ignore the ,id
>> > > argument and proceed as before.
When it comes to introducing a syntax change, the protocol is poorly
defined. Targets often respond with ``Enn'' when they should (?)
respond with ``'' (not recognised) when someone sends down a packet with
a different syntax.
Several alternatives:
<letter><thread-id>;<original-packet-syntax>
Z<n++>,<new syntax>
Another would be to have a ``H<letter>'' packet that specified the
thread that succeeding operations applied to.
Note that GDB thinks that Z0 breakpoints are implemented using memory
operations and hence apply across all threads. Not sure how well GDB
would handle per-thread breakpoints. It needs to though. Per-thread
breakpoints are a very common feature and implementing Z0 by putting
separate thread breakpoints on all threads is pretty lame.
>> > Either that or we'd need to specify a different packet type for
>> > this... gdbserver doesn't support the Z packet right now, so it
>> > wouldn't care; it could easily be extended to support the Z packet
>> > and to support thread-specific breakpoints but I haven't had a chance.
>
>>
>> As to whether extending the Z packet is possible, I suppose it
>> depends on whether targets that support it explicitly check
>> for end-of-packet after reading the existing length field.
>>
>> Do you know of any remote agents implementing Z and their behaviours?
>
>
> I believe RedBoot does, but I'm not familiar with it. Someone else on
> this list probably is though.
Yes, redboot does (http://sources.redhat.com/redboot/). This where all
the protocol ``fixes'' are comming from. But redboot doesn't need to
worry about threads.
>> Another related question I'm pondering is how to have the remote
>> agent react when one thread hits a breakpoint. My browsing of
>> the documentation and source suggests that gdb expects all threads
>> to stop when any one thread hits a breakpoint.
>>
>> Is this correct?
>>
>> I think that this means that mult-threaded embedded targets would
>> have to suspend related threads when a thread-specific breakpoint hits.
>
>
> Yes. It's not always desirable but GDB does not like to have some
> threads running and some stopped at the moment; this requires changes
> to core GDB. GDB assumes that if you send a stopped-status response
> all threads are stopped.
Andrew
More information about the Gdb
mailing list