This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch v10 05/21] gdbserver: preserve error message in handle_qXfer
- From: Markus Metzger <markus dot t dot metzger at intel dot com>
- To: jan dot kratochvil at redhat dot com
- Cc: gdb-patches at sourceware dot org, markus dot t dot metzger at gmail dot com, Pedro Alves <palves at redhat dot com>
- Date: Fri, 8 Mar 2013 10:15:52 +0100
- Subject: [patch v10 05/21] gdbserver: preserve error message in handle_qXfer
- References: <1362734168-1725-1-git-send-email-markus.t.metzger@intel.com>
Preserve a verbose error message of xfer functions if they return -3.
CC: Pedro Alves <palves@redhat.com>
2013-03-08 Markus Metzger <markus.t.metzger@intel.com>
gdbserver/
* server.c (handle_qxfer): Preserve error message if -3 is
returned.
(qxfer): Document the -3 return value.
---
gdb/gdbserver/server.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 768eae7..3738280 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -892,10 +892,10 @@ struct qxfer
data-specific information to the target.
Return the number of bytes actually transfered, zero when no
- further transfer is possible, -1 on error, and -2 when the
- transfer is not supported. Return of a positive value smaller
- than LEN does not indicate the end of the object, only the end of
- the transfer.
+ further transfer is possible, -1 on error, -2 when the transfer
+ is not supported, and -3 on a verbose error message that should
+ be preserved. Return of a positive value smaller than LEN does
+ not indicate the end of the object, only the end of the transfer.
One, and only one, of readbuf or writebuf must be non-NULL. */
int (*xfer) (const char *annex,
@@ -1323,6 +1323,10 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
free (data);
return 0;
}
+ else if (n == -3)
+ {
+ /* Preserve error message. */
+ }
else if (n < 0)
write_enn (own_buf);
else if (n > len)
@@ -1361,6 +1365,10 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
free (data);
return 0;
}
+ else if (n == -3)
+ {
+ /* Preserve error message. */
+ }
else if (n < 0)
write_enn (own_buf);
else
--
1.7.1