public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Reuben Thomas <rrt@sc3d.org>
To: "Maciej W. Rozycki" <macro@wdc.com>
Cc: Christo Crause <christo.crause@gmail.com>,
	Reuben Thomas via Gdb <gdb@sourceware.org>
Subject: Re: Remote protocol question: the documentation says '?' is not required, but maybe it is?
Date: Tue, 21 Jul 2020 21:24:00 +0100	[thread overview]
Message-ID: <CAOnWdoh2hTb3rMnby4eZhj+2U7+KhqwXxS_+Wy-UFvYnk6O0Tw@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.21.2007212021180.24175@redsun52.ssa.fujisawa.hgst.com>

On Tue, 21 Jul 2020 at 20:34, Maciej W. Rozycki <macro@wdc.com> 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

  reply	other threads:[~2020-07-21 20:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19 19:08 Reuben Thomas
2020-07-21 10:22 ` Christo Crause
2020-07-21 10:29   ` Reuben Thomas
2020-07-21 11:33     ` Maciej W. Rozycki
2020-07-21 16:35       ` Christo Crause
2020-07-21 18:51       ` Reuben Thomas
2020-07-21 19:34         ` Maciej W. Rozycki
2020-07-21 20:24           ` Reuben Thomas [this message]
2020-07-21 20:26             ` Reuben Thomas
2020-07-21 20:48               ` Reuben Thomas
2020-07-21 21:19                 ` Maciej W. Rozycki
2020-07-21 21:23                   ` Reuben Thomas

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=CAOnWdoh2hTb3rMnby4eZhj+2U7+KhqwXxS_+Wy-UFvYnk6O0Tw@mail.gmail.com \
    --to=rrt@sc3d.org \
    --cc=christo.crause@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=macro@wdc.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).