* gdb.texinfo (Target Description Format): Add version attribute
authorDaniel Jacobowitz <drow@false.org>
Wed, 13 Jun 2007 19:22:35 +0000 (19:22 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 13 Jun 2007 19:22:35 +0000 (19:22 +0000)
for <target>.

* xml-tdesc.c (tdesc_start_target): New.
(target_attributes): New.
(tdesc_elements): Use it.
* features/gdb-target.dtd: Add #FIXED version attribute for
<target>.

gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/features/gdb-target.dtd
gdb/xml-tdesc.c

index 5bef65e7ebca66ba0a57423ea67434498bcb54b1..81a50bcbad3dab3a9b072fc7cf00c47f6bd881d3 100644 (file)
@@ -1,3 +1,11 @@
+2007-06-13  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * xml-tdesc.c (tdesc_start_target): New.
+       (target_attributes): New.
+       (tdesc_elements): Use it.
+       * features/gdb-target.dtd: Add #FIXED version attribute for
+       <target>.
+
 2007-06-13  Arthur Huillet  <arthur.huillet@free.fr>
 
        * mi/mi-cmd-var.c (mi_cmd_var_assign): Fix typo.
index 52112511cafbd05fa8dea38f3064093e71e69d6b..8f7e7325d15025e753936b3ef408c485abd25277 100644 (file)
@@ -1,3 +1,8 @@
+2007-06-13  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb.texinfo (Target Description Format): Add version attribute
+       for <target>.
+
 2007-06-13  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gdb.texinfo (MIPS Features): Document org.gnu.gdb.mips.linux.
index 9c71ad270725c84c3a1d8972d9662267c030f5d3..230a6cad85ede1c1b0c9ab6db06d35a216df7b99 100644 (file)
@@ -25494,7 +25494,7 @@ target, or to warn you if you connect to an unsupported target.
 Here is a simple target description:
 
 @smallexample
-<target>
+<target version="1.0">
   <architecture>i386:x86-64</architecture>
 </target>
 @end smallexample
@@ -25510,7 +25510,7 @@ are explained further below.
 @smallexample
 <?xml version="1.0"?>
 <!DOCTYPE target SYSTEM "gdb-target.dtd">
-<target>
+<target version="1.0">
   @r{[}@var{architecture}@r{]}
   @r{[}@var{feature}@dots{}@r{]}
 </target>
@@ -25521,7 +25521,11 @@ The description is generally insensitive to whitespace and line
 breaks, under the usual common-sense rules.  The XML version
 declaration and document type declaration can generally be omitted
 (@value{GDBN} does not require them), but specifying them may be
-useful for XML validation tools.
+useful for XML validation tools.  The @samp{version} attribute for
+@samp{<target>} may also be omitted, but we recommend
+including it; if future versions of @value{GDBN} use an incompatible
+revision of @file{gdb-target.dtd}, they will detect and report
+the version mismatch.
 
 @subsection Inclusion
 @cindex target descriptions, inclusion
index b05e063d9db7ab537a4441a3cd4e880d1dacb737..8ff10fc236afcf90e1356bd1ff040ae2828a49a8 100644 (file)
@@ -7,6 +7,8 @@
 <!-- The root element of a GDB target description is <target>.  -->
 
 <!ELEMENT target       (architecture?, feature*)>
+<!ATTLIST target
+       version         CDATA   #FIXED "1.0">
 
 <!ELEMENT architecture (#PCDATA)>
 
index 31db9c35bda4ed2e80d2da43ce3ef3c19df40a38..9b2902fb6aebe47f6e3cefb15e6b2567b2629abb 100644 (file)
@@ -109,6 +109,22 @@ tdesc_end_arch (struct gdb_xml_parser *parser,
   set_tdesc_architecture (data->tdesc, arch);
 }
 
+/* Handle the start of a <target> element.  */
+
+static void
+tdesc_start_target (struct gdb_xml_parser *parser,
+                   const struct gdb_xml_element *element,
+                   void *user_data, VEC(gdb_xml_value_s) *attributes)
+{
+  struct tdesc_parsing_data *data = user_data;
+  char *version = VEC_index (gdb_xml_value_s, attributes, 0)->value;
+
+  if (strcmp (version, "1.0") != 0)
+    gdb_xml_error (parser,
+                  _("Target description has unsupported version \"%s\""),
+                  version);
+}
+
 /* Handle the start of a <feature> element.  */
 
 static void
@@ -328,6 +344,11 @@ static const struct gdb_xml_element feature_children[] = {
   { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
 };
 
+static const struct gdb_xml_attribute target_attributes[] = {
+  { "version", GDB_XML_AF_NONE, NULL, NULL },
+  { NULL, GDB_XML_AF_NONE, NULL, NULL }
+};
+
 static const struct gdb_xml_element target_children[] = {
   { "architecture", NULL, NULL, GDB_XML_EF_OPTIONAL,
     NULL, tdesc_end_arch },
@@ -338,8 +359,8 @@ static const struct gdb_xml_element target_children[] = {
 };
 
 static const struct gdb_xml_element tdesc_elements[] = {
-  { "target", NULL, target_children, GDB_XML_EF_NONE,
-    NULL, NULL },
+  { "target", target_attributes, target_children, GDB_XML_EF_NONE,
+    tdesc_start_target, NULL },
   { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
 };
 
This page took 0.056084 seconds and 4 git commands to generate.