Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: Stan Shebs <stanshebs@earthlink.net>, gdb-patches@sourceware.org
Subject: Re: Documenting E. packet. (was Re: [patch] Fix PR 13392 : check offset of JMP insn)
Date: Wed, 07 Mar 2012 20:59:00 -0000	[thread overview]
Message-ID: <4F57CC1B.3030104@redhat.com> (raw)
In-Reply-To: <1331152865.2209.46.camel@soleil>

On 03/07/2012 08:41 PM, Philippe Waroquiers wrote:

> On Tue, 2012-03-06 at 13:47 -0800, Stan Shebs wrote:
> 
>>> Is there somewhere a description of what an E. packet is,
>>> and when this is allowed ?
>>>
> ...
>> It doesn't look like it's officially described in the manual.  The 
> ...
>>
>> It's conceivable that one could do something with GDB that interprets 
>> the error reply (whether NN or a string) and does something differently, 
>> but in practice, if the target side is reporting errors, things are 
>> going straight downhill and the user needs to decide what to do about 
>> it.  Also, if a particular result is common enough that GDB has code to 
>> cope with it, then maybe it's just another element of the protocol, not 
>> really an error. :-)
> 
> Effectively, having GDB trying to do something sophisticated depending
> on the E NN nr or E. string received from the stub looks difficult.
> 
> There is however already some kind of logic in GDB.
> E.g. in remote.c, the function trace_error handles differently E.,
> E1? and E2?.


Yeah, that's old legacy stuff.  :-(  We're probably safe in removing those
special E1 and E2 handlings (which all I know about is what's in the code)
by now.

See: packet_ok -> packet_check_result

      /* Always treat "E." as an error.  This will be used for
	 more verbose error messages, such as E.memtypes.  */
      if (buf[0] == 'E' && buf[1] == '.')
	return PACKET_ERROR;

So all places that use the modern packet_ok explicitly handle this.

It's very lame that we print the leading '.'.  We should fix that.

> 
> There are other places where only E NN is considered as an error.
> E. is not considered as an error.
> Example: qRcmd.


I think CS/Maciej had a patch for this.

> When I did the Valgrind gdbserver, I had to return a readable error
> msg to the user but did not find a way to do that in the doc.
> I found the E. by reading the gdb sources and used it (believing
> I was doing a nasty thing. But now, I see it is just an officially
> accepted error packet, just not documented :).
> => it looks better to document this E. packet.
> 
> However, it is not clear to me what is exactly expected for
> this documentation/behaviour.
> 
> It looks better if at all places where an E NN is accepted by GDB,
> GDB would also accept an E. packet.


Yeah, though we'd a careful audit.  We should be careful in avoiding the
case of with newer stubs sending "E.xxx" to GDBs that haven't been updated,
and those GDBs not understanding it as an error packet.

> But that is not the current behaviour, so either remote.c is
> changed to consistently accept E NN and E. everywhere,
> or the protocol doc must match the current behaviour,
> and indicate for each packet if an E NN and/or an E. error is
> accepted.


In any case, the documentation should be updated.

-- 
Pedro Alves


  reply	other threads:[~2012-03-07 20:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 13:39 [patch] Fix PR 13392 : check offset of JMP insn Yao Qi
2012-03-06 17:03 ` Pedro Alves
2012-03-06 20:15   ` Philippe Waroquiers
2012-03-06 21:48     ` Stan Shebs
2012-03-07 20:41       ` Documenting E. packet. (was Re: [patch] Fix PR 13392 : check offset of JMP insn) Philippe Waroquiers
2012-03-07 20:59         ` Pedro Alves [this message]
2012-03-07 21:21           ` Philippe Waroquiers
2012-03-07  8:25   ` [patch] Fix PR 13392 : check offset of JMP insn Yao Qi
2012-03-08 17:07     ` Pedro Alves
2012-03-09  3:51       ` Yao Qi

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=4F57CC1B.3030104@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    --cc=stanshebs@earthlink.net \
    /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