This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/2] GDBserver: qXfer:libraries-svr4:read, malformed xml
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 23 Mar 2012 21:11:06 +0000
- Subject: [PATCH 2/2] GDBserver: qXfer:libraries-svr4:read, malformed xml
- References: <20120323211054.23826.11742.stgit@brno.lan>
Debugging a 32-bit inferior with a 64-bit gdbserver on PowerPC
GNU/Linux shows:
(gdb) start
Temporary breakpoint 1 at 0x1000044c: main. (2 locations)
Starting program: /home/palves/gdb/tests/main32
warning: while parsing target library list: not well-formed (invalid token)
warning: while parsing target library list: not well-formed (invalid token)
...
You can still debug fine even with that warning, since GDB will fall
back to reading the DSO list out of inferior memory itself.
Turning on remote debugging reveals:
Sending packet: $qXfer:libraries-svr4:read::0,fff#91...Packet received: l<library-list-svr4 version="1.0"</library-list-svr4>
warning: while parsing target library list: not well-formed (invalid token)
The '<library-list-svr4 version="1.0"' element start wasn't properly
finished. The patch below fixes it.
2012-03-23 Pedro Alves <palves@redhat.com>
* linux-low.c (linux_qxfer_libraries_svr4): Terminate the
"library-list-svr4" element's start tag when the the DSO list is
empty.
---
0 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 2dc903d..71cde01 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5630,7 +5630,13 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
lm_addr = l_next;
}
done:
- strcpy (p, "</library-list-svr4>");
+ if (!header_done)
+ {
+ /* Empty list; terminate `<library-list-svr4'. */
+ strcpy (p, "/>");
+ }
+ else
+ strcpy (p, "</library-list-svr4>");
}
document_len = strlen (document);