public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/remote: fix qRcmd error handling
Date: Fri, 26 Apr 2024 16:12:04 +0100	[thread overview]
Message-ID: <87cyqctayj.fsf@redhat.com> (raw)
In-Reply-To: <87zfticueh.fsf@tromey.com>

Tom Tromey <tom@tromey.com> writes:

>>> The patch itself seems reasonable to me, but at the same time, isn't the
>>> behavior you describe also fine?
>>> 
>>> The docs describe "OK", other "O" output packets, the "E" response, and
>>> the empty response.  It seems to me that any other response could
>>> reasonably be treated as an error.
>
> Andrew> The behaviour I'm restoring is documented, see the 'OUTPUT' entry in the
> Andrew> 'Reply:' list:
>
> Andrew>        'OUTPUT'
> Andrew>             A command response with the hex encoded output string OUTPUT.
>
> I thought your patch was concerned with changing the output of responses
> other than 'E' or 'O'... did I misunderstand that?

I don't think so.  I guess I didn't explain myself very well.

After GDB sends a qRcmd packet to the remote, the remote can reply with
zero or more 'O' packets.  This patch is not about these replies; they
are still working fine.

The remote can also reply with an 'E' packet.  This patch is not about
these error reply packets; they are still working fine.

The remote can also reply with an empty packet indicating the qRcmd is
not supported.  This patch is not about this type of reply; this is
still working fine.

The remote can also reply with a packet containing the string "OK", this
is different from a general 'O' packet, this indicates that the remote
is done handling the qRcmd and so GDB is done too.  This patch is not
about this reply; this is still working fine.

The remote can also reply with a random hex encoded string, of the kind
that would appear after the 'O' in an 'O' packet, but without the adding
the leading 'O' character.  When GDB gets one of these packets GDB
decodes the string and prints it, after which the qRcmd is done.  This
patch is about this behaviour only.

This feature was broken in commit 3623271997a5c0d, after this the hex
encoded string would be treated as an error.  In fact, what happens is
that GDB calls packet_result::err_msg() which will then throw an
assertion error because the packet status is PACKET_OK, not
PACKET_ERROR.

Thanks,
Andrew
  


  reply	other threads:[~2024-04-26 15:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22  8:45 Andrew Burgess
     [not found] ` <8734rdsb51.fsf@tromey.com>
2024-04-23 20:04   ` Andrew Burgess
2024-04-24 21:39     ` Tom Tromey
2024-04-26 15:12       ` Andrew Burgess [this message]
2024-04-26 16:54 ` Tom Tromey
2024-04-29  9:02   ` Andrew Burgess

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=87cyqctayj.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).