Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org, drow@false.org
Subject: [rfa, gdbserver] Fix breakage due to XML rework
Date: Thu, 27 Mar 2008 01:54:00 -0000	[thread overview]
Message-ID: <200803270153.m2R1rQkc006524@d12av02.megacenter.de.ibm.com> (raw)

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?

Bye,
Ulrich


ChangeLog:

	* 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.

gdbserver/ChangeLog:

	* 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+");
 
       return;
     }
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
 name:powerpc_32
-xmltarget:rs6000/powerpc-32.xml
+xmltarget:powerpc-32.xml
 expedite:r1,pc
 32:r0
 32:r1
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
 name:powerpc_64
-xmltarget:rs6000/powerpc-64.xml
+xmltarget:powerpc-64.xml
 expedite:r1,pc
 64:r0
 64:r1
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
 name:powerpc_e500
-xmltarget:rs6000/powerpc-e500.xml
+xmltarget:powerpc-e500.xml
 expedite:r1,pc
 32:r0
 32:r1
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


             reply	other threads:[~2008-03-27  1:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27  1:54 Ulrich Weigand [this message]
2008-03-27  2:02 ` Daniel Jacobowitz
2008-03-27 13:13   ` Ulrich Weigand
2008-04-04 17:32     ` Luis Machado
2008-04-04 19:18       ` Ulrich Weigand
2008-04-04 19:20         ` Daniel Jacobowitz
2008-04-04 19:48           ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803270153.m2R1rQkc006524@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox