aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 0f963e8..b90b9ce 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -942,6 +942,10 @@ handle_qxfer_libraries (const char *annex,
if (annex[0] != '\0' || !target_running ())
return -1;
+ /* Do not confuse this packet with qXfer:libraries-svr4:read. */
+ if (the_target->qxfer_libraries_svr4 != NULL)
+ return 0;
+
/* Over-estimate the necessary memory. Assume that every character
in the library name must be escaped. */
total_len = 64;
@@ -992,6 +996,23 @@ handle_qxfer_libraries (const char *annex,
return len;
}
+/* Handle qXfer:libraries-svr4:read. */
+
+static int
+handle_qxfer_libraries_svr4 (const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
+{
+ if (writebuf != NULL)
+ return -2;
+
+ if (annex[0] != '\0' || !target_running ()
+ || the_target->qxfer_libraries_svr4 == NULL)
+ return -1;
+
+ return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf, offset, len);
+}
+
/* Handle qXfer:osadata:read. */
static int
@@ -1216,6 +1237,7 @@ static const struct qxfer qxfer_packets[] =
{ "fdpic", handle_qxfer_fdpic},
{ "features", handle_qxfer_features },
{ "libraries", handle_qxfer_libraries },
+ { "libraries-svr4", handle_qxfer_libraries_svr4 },
{ "osdata", handle_qxfer_osdata },
{ "siginfo", handle_qxfer_siginfo },
{ "spu", handle_qxfer_spu },
@@ -1536,9 +1558,14 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
sprintf (own_buf, "PacketSize=%x;QPassSignals+", PBUFSIZ - 1);
- /* We do not have any hook to indicate whether the target backend
- supports qXfer:libraries:read, so always report it. */
- strcat (own_buf, ";qXfer:libraries:read+");
+ if (the_target->qxfer_libraries_svr4 != NULL)
+ strcat (own_buf, ";qXfer:libraries-svr4:read+");
+ else
+ {
+ /* We do not have any hook to indicate whether the non-SVR4 target
+ backend supports qXfer:libraries:read, so always report it. */
+ strcat (own_buf, ";qXfer:libraries:read+");
+ }
if (the_target->read_auxv != NULL)
strcat (own_buf, ";qXfer:auxv:read+");