From 1780a0edf4903787581db60d46e216acc7c70b37 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 13 Jun 2007 19:22:35 +0000 Subject: [PATCH] * gdb.texinfo (Target Description Format): Add version attribute for . * xml-tdesc.c (tdesc_start_target): New. (target_attributes): New. (tdesc_elements): Use it. * features/gdb-target.dtd: Add #FIXED version attribute for . --- gdb/ChangeLog | 8 ++++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 10 +++++++--- gdb/features/gdb-target.dtd | 2 ++ gdb/xml-tdesc.c | 25 +++++++++++++++++++++++-- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5bef65e7ebc..81a50bcbad3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2007-06-13 Daniel Jacobowitz + + * xml-tdesc.c (tdesc_start_target): New. + (target_attributes): New. + (tdesc_elements): Use it. + * features/gdb-target.dtd: Add #FIXED version attribute for + . + 2007-06-13 Arthur Huillet * mi/mi-cmd-var.c (mi_cmd_var_assign): Fix typo. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 52112511caf..8f7e7325d15 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2007-06-13 Daniel Jacobowitz + + * gdb.texinfo (Target Description Format): Add version attribute + for . + 2007-06-13 Daniel Jacobowitz * gdb.texinfo (MIPS Features): Document org.gnu.gdb.mips.linux. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9c71ad27072..230a6cad85e 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -25494,7 +25494,7 @@ target, or to warn you if you connect to an unsupported target. Here is a simple target description: @smallexample - + i386:x86-64 @end smallexample @@ -25510,7 +25510,7 @@ are explained further below. @smallexample - + @r{[}@var{architecture}@r{]} @r{[}@var{feature}@dots{}@r{]} @@ -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{} 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 diff --git a/gdb/features/gdb-target.dtd b/gdb/features/gdb-target.dtd index b05e063d9db..8ff10fc236a 100644 --- a/gdb/features/gdb-target.dtd +++ b/gdb/features/gdb-target.dtd @@ -7,6 +7,8 @@ + diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c index 31db9c35bda..9b2902fb6ae 100644 --- a/gdb/xml-tdesc.c +++ b/gdb/xml-tdesc.c @@ -109,6 +109,22 @@ tdesc_end_arch (struct gdb_xml_parser *parser, set_tdesc_architecture (data->tdesc, arch); } +/* Handle the start of a 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 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 } }; -- 2.30.2