Re: Remote protocol question: the documentation says '?' is not required, but maybe it is?

Reuben Thomas via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAOnWdoh2hTb3rMnby4eZhj+2U7+KhqwXxS_+Wy-UFvYnk6O0Tw@mail.gmail.com>
On Tue, 21 Jul 2020 at 20:34, Maciej W. Rozycki <[email protected]> wrote:

> On Tue, 21 Jul 2020, Reuben Thomas wrote:
>
> > >  FYI, I do believe `?' is indeed mandatory, as GDB needs to figure out
> the
> > > initial state of the remote target as it has connected to it, and
> there is
> > > no other way.
> >
> > It seems to be more complicated than that. In principle, '?' isn't needed
> > in principle to figure out the initial state: the T packet, or in my
> > current case, the S packet tells GDB the signal, and yet GDB still asks
> for
> > it again with '?'. The signal that caused the remote to halt is not going
> > to change until the next 'c', so there's no need for GDB to ask for it
> > again; and yet it does.
>
>  I take you mean a `T' or `S' stop reply, right?
>
>  Well, such replies are only expected by GDB in response to specific
> packets, which are all listed at the top of Section E.3 "Stop Reply
> Packets".  If you issue an unsolicited stop reply from your debug stub,
> then at best GDB will ignore it and at worst GDB will get confused.
>

Sorry, I didn't explain this clearly enough before.

As you can see in section E.3, T is an allowed reply to the 'c' command.

As I explained in my previous message, the first packet that the debug stub
sends is discarded by gdb.

Therefore, the stub is only sending the T packet when it is allowed: the
first time, it is discarded, and every other time, it is in response to a
'c' command.

-- 
https://rrt.sc3d.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.