This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] GDBserver: qXfer:libraries-svr4:read, malformed xml


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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]