[PATCH] gdbserver: Introduce write_error_msg

Philippe Waroquiers philippe.waroquiers@skynet.be
Wed Nov 23 20:40:00 GMT 2016


On Wed, 2016-11-23 at 15:35 +0000, Pedro Alves wrote:
> Instead of writing an error message to (gdbserver's) stderr and then
> returning back "E01" to GDB, send the error message to GDB directly
> using the E.MSG format, so the user can potentially see it.  Several
> places in the code already do this manually.  This patch adds a new
> function (write_error_msg) that abstracts out the "E." prefix detail.
The protocol description/doc does not (very) clearly describe E. prefix.
In the doc, I found the E. is used only at a few places:
  vFlashWrite and a few packets used for branch tracing,
while the gdbserver code uses it at more places.

I think that gdb will accept such an error reply
as a reply to any? many?  packet that can cause an error
(at least I have used E. here and there in Valgrind gdbserver
and it is always accepted by gdb).

The E (error packet) is not formally described.
In the protocol Overview, there is:
"   The error response returned for some packets includes a two
character error number.  That number is not well defined."

But the E packet itself seems not well defined :).

This patch is maybe the occasion to clarify/document
explicitely what gdbserver stubs are allowed to send as an
error response, and then change the doc to just indicate
what packets can send an E error message, rather than
document that 'E NN' is only to be expected for many
packets. 

Thanks

Philippe




More information about the Gdb-patches mailing list