This is the mail archive of the 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]

[rfa, gdbserver] Fix breakage due to XML rework

Hello Dan,

I just noticed that my XML target rework patch introduced a stupid
error in get_features_xml that causes gdbserver to never actually
report a target.xml file.

Once this was fixed, it still didn't work on powerpc as the xmltarget
statement in the regformats file referred to "rs6000/powerpc-32.xml"
while the generated xml-builtins.c file only supported the file
name "powerpc-32.xml" without the subdirectory name.  As all the 
secondary XML files were already using just the base name, I've
now changes the regformats xmltarget statements to also use the
base name only.

The third problem shows up only in --multi mode.  Here it can happen
that on the first call to the target's arch_setup routine, register
settings without any XML target are installed, but on a later call
arch_setup, XML target setting are added.  However, as the target
initially did not support any target.xml file, gdbserver common
code replied to GDB's qSupported query that it does not support
the qXfer:features:read command.  As it appears the qSupported
query is never repeated, GDB will actually never notice that the
target now does provide an target.xml file ...   I've simply changed
handle_query to always claim to support qXfer:features:read; and as
gdbserver actually *does* always handle it, this cannot hurt anything.

I'm not sure how I missed those problems in my original testing.
Interestingly enough, even with target.xml completely broken like
this, gdbserver still passes the altivec-regs.exp test cases ...

Sorry for the breakage.

The patch below fixes all three problems; tested on powerpc-linux
and powerpc64-linux using local gdbserver testing.

OK to apply?



	* features/Makefile (%.dat): Set xmltarget to the base filename
	of the XML source, without subdirectory.
	* regformats/rs6000/powerpc-32.dat: Regenerate.
	* regformats/rs6000/powerpc-64.dat: Regenerate.
	* regformats/rs6000/powerpc-e500.dat: Regenerate.


	* server.c (get_features_xml): Fix inverted condition.
	(handle_query): Always support qXfer:feature:read.

diff -urNp gdb-orig/gdb/features/Makefile gdb-head/gdb/features/Makefile
--- gdb-orig/gdb/features/Makefile	2008-03-27 02:29:55.625448991 +0100
+++ gdb-head/gdb/features/Makefile	2008-03-27 02:29:40.979424568 +0100
@@ -55,7 +55,7 @@ all: $(OUTPUTS)
 $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
 	echo "# DO NOT EDIT: generated from $<" > $(outdir)/$*.tmp
 	echo "name:`echo $(notdir $*) | sed 's/-/_/g'`" >> $(outdir)/$*.tmp
-	echo "xmltarget:$<" >> $(outdir)/$*.tmp
+	echo "xmltarget:$(<F)" >> $(outdir)/$*.tmp
 	echo "expedite:$($*-expedite)" >> $(outdir)/$*.tmp
 	$(XSLTPROC) --path "$(PWD)" --xinclude number-regs.xsl $< | \
 	  $(XSLTPROC) sort-regs.xsl - | \
diff -urNp gdb-orig/gdb/gdbserver/server.c gdb-head/gdb/gdbserver/server.c
--- gdb-orig/gdb/gdbserver/server.c	2008-03-27 02:29:55.632447986 +0100
+++ gdb-head/gdb/gdbserver/server.c	2008-03-27 00:49:00.822578882 +0100
@@ -276,7 +276,7 @@ get_features_xml (const char *annex)
      init_registers_... routine for the current target.  */
   if (gdbserver_xmltarget
-      && strcmp (annex, "target.xml") != 0)
+      && strcmp (annex, "target.xml") == 0)
       if (*gdbserver_xmltarget == '@')
 	return gdbserver_xmltarget + 1;
@@ -618,8 +618,11 @@ handle_query (char *own_buf, int packet_
       if (the_target->qxfer_spu != NULL)
 	strcat (own_buf, ";qXfer:spu:read+;qXfer:spu:write+");
-      if (get_features_xml ("target.xml") != NULL)
-	strcat (own_buf, ";qXfer:features:read+");
+      /* We always report qXfer:features:read, as targets may
+	 install XML files on a subsequent call to arch_setup.
+	 If we reported to GDB on startup that we don't support
+	 qXfer:feature:read at all, we will never be re-queried.  */
+      strcat (own_buf, ";qXfer:features:read+");
diff -urNp gdb-orig/gdb/regformats/rs6000/powerpc-32.dat gdb-head/gdb/regformats/rs6000/powerpc-32.dat
--- gdb-orig/gdb/regformats/rs6000/powerpc-32.dat	2008-03-27 02:29:55.637447268 +0100
+++ gdb-head/gdb/regformats/rs6000/powerpc-32.dat	2008-03-27 02:29:41.098407486 +0100
@@ -1,6 +1,6 @@
 # DO NOT EDIT: generated from rs6000/powerpc-32.xml
diff -urNp gdb-orig/gdb/regformats/rs6000/powerpc-64.dat gdb-head/gdb/regformats/rs6000/powerpc-64.dat
--- gdb-orig/gdb/regformats/rs6000/powerpc-64.dat	2008-03-27 02:29:55.640446837 +0100
+++ gdb-head/gdb/regformats/rs6000/powerpc-64.dat	2008-03-27 02:29:41.102406912 +0100
@@ -1,6 +1,6 @@
 # DO NOT EDIT: generated from rs6000/powerpc-64.xml
diff -urNp gdb-orig/gdb/regformats/rs6000/powerpc-e500.dat gdb-head/gdb/regformats/rs6000/powerpc-e500.dat
--- gdb-orig/gdb/regformats/rs6000/powerpc-e500.dat	2008-03-27 02:29:55.644446263 +0100
+++ gdb-head/gdb/regformats/rs6000/powerpc-e500.dat	2008-03-26 23:35:00.476149379 +0100
@@ -1,6 +1,6 @@
 # DO NOT EDIT: generated from rs6000/powerpc-e500.xml
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE

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