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]

Re: XML XInclude support


> Date: Wed, 7 Feb 2007 17:49:10 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> 2007-02-07  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* Makefile.in (XMLFILES): New.
> 	(COMMON_OBS): Add xml-builtin.o.
> 	(xml-builtin.c, stamp-xml): New rules.
> 	(xml-tdesc.o): Update.
> 	* features/feature_to_c.sh: New file.
> 	* xml-support.c (MAX_XINCLUDE_DEPTH): Define.
> 	(struct gdb_xml_parser): Add dtd_name and is_xinclude.
> 	(gdb_xml_start_element): Initialize scope after possibly reallocating
> 	scopes.  Move cleanup later.  Handle the XInclude description
> 	specially.
> 	(gdb_xml_end_element): Only parse the body if there is a current element.
> 	Call XML_DefaultCurrent if there is no element.
> 	(gdb_xml_fetch_external_entity, gdb_xml_use_dtd): New.
> 	(struct xinclude_parsing_data, xinclude_start_include)
> 	(xinclude_end_include, xml_xinclude_default)
> 	(xml_xinclude_start_doctype, xml_xinclude_end_doctype)
> 	(xml_xinclude_xml_decl, xml_xinclude_cleanup, xinclude_attributes)
> 	(xinclude_elements, xml_process_xincludes, fetch_xml_builtin): New.
> 	* xml-support.h (xml_fetch_another, xml_process_xincludes)
> 	(fetch_xml_builtin, xml_builtin, gdb_xml_use_dtd): New declarations.
> 	* xml-tdesc.c (tdesc_parse_xml): Add fetcher_baton argument.  Expand
> 	XInclude directives.  Use the compiled in DTD.
> 	(fetch_xml_from_file): Add baton argument.  Treat it as a containing
> 	directory name.  Do not warn here.
> 	(file_read_description_xml): Update call.  Warn here instead.  Pass
> 	a dirname as baton.
> 	(fetch_available_features_from_target): New.
> 	(target_read_description_xml): Use it.
> 	* features/gdb-target.dtd: Add copyright notice.  Use xinclude.dtd
> 	to handle XInclude.
> 	* features/xinclude.dtd: New file.
> 
> 2007-02-07  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* gdb.xml/bad-include.xml, gdb.xml/inc-2.xml, gdb.xml/inc-body.xml,
> 	gdb.xml/includes.xml, gdb.xml/tdesc-xinclude.exp: New files.
> 
> 2007-02-07  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* gdb.texinfo (Target Description Format): Add section on XInclude.


Hi Daniel,

This broke my builds on OpenBSD :(.  Here's the make output.

---

rm -f xml-builtin.tmp
AWK="nawk"  /bin/sh ../../../src/gdb/gdb/features/feature_to_c.sh  xml-builtin.tmp ../../../src/gdb/gdb/features/gdb-target.dtd ../../../src/gdb/gdb/features/xinclude.dtd
nawk: weird printf conversion %', 
 input record number 13, file 
 source line number 15
nawk: not enough args in printf('%', )
 input record number 13, file 
 source line number 15
/bin/sh ../../../src/gdb/gdb/../move-if-change xml-builtin.tmp xml-builtin.c
echo stamp > stamp-xml
gcc -c -g -O2     -I. -I../../../src/gdb/gdb -I../../../src/gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../../src/gdb/gdb/../include/opcode -I../../../src/gdb/gdb/../readline/..  -I../bfd -I../../../src/gdb/gdb/../bfd -I../../../src/gdb/gdb/../include    -DMI_OUT=1 -DTUI=1 -I/usr/local/include -Wall -Wpointer-arith -Wformat-nonliteral -Wno-unused -Wno-switch -Werror xml-builtin.c
xml-builtin.c:49: syntax error before `static'
xml-builtin.c:110: `xml_feature_xinclude_dtd' undeclared here (not in a function)
xml-builtin.c:110: initializer element is not constant
xml-builtin.c:110: (near initialization for `xml_builtin[1][1]')
*** Error code 1

Stop in /home/kettenis/obj/gdb/gdb.
*** Error code 1

Stop in /home/kettenis/obj/gdb (line 8486 of Makefile).

---

And here's the generated xml-builtin.c

---

static const char xml_feature_gdb_target_dtd[] = {
  '<', '!', '-', '-', ' ', 'C', 'o', 'p', 'y', 'r', 
   'i', 'g', 'h', 't', ' ', '(', 'C', ')', ' ', '2', 
   '0', '0', '7', ' ', 'F', 'r', 'e', 'e', ' ', 'S', 
   'o', 'f', 't', 'w', 'a', 'r', 'e', ' ', 'F', 'o', 
   'u', 'n', 'd', 'a', 't', 'i', 'o', 'n', ',', ' ', 
   'I', 'n', 'c', '.', '\n', 
  '\n', 
  ' ', ' ', ' ', ' ', ' ', 'C', 'o', 'p', 'y', 'i', 
   'n', 'g', ' ', 'a', 'n', 'd', ' ', 'd', 'i', 's', 
   't', 'r', 'i', 'b', 'u', 't', 'i', 'o', 'n', ' ', 
   'o', 'f', ' ', 't', 'h', 'i', 's', ' ', 'f', 'i', 
   'l', 'e', ',', ' ', 'w', 'i', 't', 'h', ' ', 'o', 
   'r', ' ', 'w', 'i', 't', 'h', 'o', 'u', 't', ' ', 
   'm', 'o', 'd', 'i', 'f', 'i', 'c', 'a', 't', 'i', 
   'o', 'n', ',', '\n', 
  ' ', ' ', ' ', ' ', ' ', 'a', 'r', 'e', ' ', 'p', 
   'e', 'r', 'm', 'i', 't', 't', 'e', 'd', ' ', 'i', 
   'n', ' ', 'a', 'n', 'y', ' ', 'm', 'e', 'd', 'i', 
   'u', 'm', ' ', 'w', 'i', 't', 'h', 'o', 'u', 't', 
   ' ', 'r', 'o', 'y', 'a', 'l', 't', 'y', ' ', 'p', 
   'r', 'o', 'v', 'i', 'd', 'e', 'd', ' ', 't', 'h', 
   'e', ' ', 'c', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 
   't', '\n', 
  ' ', ' ', ' ', ' ', ' ', 'n', 'o', 't', 'i', 'c', 
   'e', ' ', 'a', 'n', 'd', ' ', 't', 'h', 'i', 's', 
   ' ', 'n', 'o', 't', 'i', 'c', 'e', ' ', 'a', 'r', 
   'e', ' ', 'p', 'r', 'e', 's', 'e', 'r', 'v', 'e', 
   'd', '.', ' ', ' ', '-', '-', '>', '\n', 
  '\n', 
  '<', '!', '-', '-', ' ', 'T', 'h', 'e', ' ', 'r', 
   'o', 'o', 't', ' ', 'e', 'l', 'e', 'm', 'e', 'n', 
   't', ' ', 'o', 'f', ' ', 'a', ' ', 'G', 'D', 'B', 
   ' ', 't', 'a', 'r', 'g', 'e', 't', ' ', 'd', 'e', 
   's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', ' ', 
   'i', 's', ' ', '<', 't', 'a', 'r', 'g', 'e', 't', 
   '>', '.', ' ', ' ', '-', '-', '>', '\n', 
  '\n', 
  '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T', ' ', 
   't', 'a', 'r', 'g', 'e', 't', '\011', '(', 'a', 'r', 
   'c', 'h', 'i', 't', 'e', 'c', 't', 'u', 'r', 'e', 
   '?', ')', '>', '\n', 
  '\n', 
  '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T', ' ', 
   'a', 'r', 'c', 'h', 'i', 't', 'e', 'c', 't', 'u', 
   'r', 'e', '\011', '(', '#', 'P', 'C', 'D', 'A', 'T', 
   'A', ')', '>', '\n', 
  '\n', 
  '<', '!', 'E', 'N', 'T', 'I', 'T', 'Y', ' ', static const char xml_feature_xinclude_dtd[] = {
  '<', '!', '-', '-', ' ', 'C', 'o', 'p', 'y', 'r', 
   'i', 'g', 'h', 't', ' ', '(', 'C', ')', ' ', '2', 
   '0', '0', '7', ' ', 'F', 'r', 'e', 'e', ' ', 'S', 
   'o', 'f', 't', 'w', 'a', 'r', 'e', ' ', 'F', 'o', 
   'u', 'n', 'd', 'a', 't', 'i', 'o', 'n', ',', ' ', 
   'I', 'n', 'c', '.', '\n', 
  '\n', 
  ' ', ' ', ' ', ' ', ' ', 'C', 'o', 'p', 'y', 'i', 
   'n', 'g', ' ', 'a', 'n', 'd', ' ', 'd', 'i', 's', 
   't', 'r', 'i', 'b', 'u', 't', 'i', 'o', 'n', ' ', 
   'o', 'f', ' ', 't', 'h', 'i', 's', ' ', 'f', 'i', 
   'l', 'e', ',', ' ', 'w', 'i', 't', 'h', ' ', 'o', 
   'r', ' ', 'w', 'i', 't', 'h', 'o', 'u', 't', ' ', 
   'm', 'o', 'd', 'i', 'f', 'i', 'c', 'a', 't', 'i', 
   'o', 'n', ',', '\n', 
  ' ', ' ', ' ', ' ', ' ', 'a', 'r', 'e', ' ', 'p', 
   'e', 'r', 'm', 'i', 't', 't', 'e', 'd', ' ', 'i', 
   'n', ' ', 'a', 'n', 'y', ' ', 'm', 'e', 'd', 'i', 
   'u', 'm', ' ', 'w', 'i', 't', 'h', 'o', 'u', 't', 
   ' ', 'r', 'o', 'y', 'a', 'l', 't', 'y', ' ', 'p', 
   'r', 'o', 'v', 'i', 'd', 'e', 'd', ' ', 't', 'h', 
   'e', ' ', 'c', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 
   't', '\n', 
  ' ', ' ', ' ', ' ', ' ', 'n', 'o', 't', 'i', 'c', 
   'e', ' ', 'a', 'n', 'd', ' ', 't', 'h', 'i', 's', 
   ' ', 'n', 'o', 't', 'i', 'c', 'e', ' ', 'a', 'r', 
   'e', ' ', 'p', 'r', 'e', 's', 'e', 'r', 'v', 'e', 
   'd', '.', ' ', ' ', '-', '-', '>', '\n', 
  '\n', 
  '<', '!', '-', '-', ' ', 'G', 'D', 'B', ' ', 's', 
   'u', 'p', 'p', 'o', 'r', 't', 's', ' ', 'a', ' ', 
   's', 'u', 'b', 's', 'e', 't', ' ', 'o', 'f', ' ', 
   'X', 'I', 'n', 'c', 'l', 'u', 'd', 'e', '.', ' ', 
   ' ', 'O', 'n', 'l', 'y', ' ', 'w', 'h', 'o', 'l', 
   'e', ' ', 'd', 'o', 'c', 'u', 'm', 'e', 'n', 't', 
   's', ' ', 'c', 'a', 'n', '\n', 
  ' ', ' ', ' ', ' ', ' ', 'b', 'e', ' ', 'i', 'n', 
   'c', 'l', 'u', 'd', 'e', 'd', ',', ' ', 'a', 'n', 
   'd', ' ', 'o', 'n', 'l', 'y', ' ', 'a', 's', ' ', 
   'X', 'M', 'L', '.', ' ', ' ', '-', '-', '>', '\n', 
  '\n', 
  '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T', ' ', 
   'x', 'i', ':', 'i', 'n', 'c', 'l', 'u', 'd', 'e', 
   '\011', '(', 'E', 'M', 'P', 'T', 'Y', ')', '>', '\n', 
  '<', '!', 'A', 'T', 'T', 'L', 'I', 'S', 'T', ' ', 
   'x', 'i', ':', 'i', 'n', 'c', 'l', 'u', 'd', 'e', 
   '\n', 
  '\011', 'x', 'm', 'l', 'n', 's', ':', 'x', 'i', '\011', 
   'C', 'D', 'A', 'T', 'A', '\011', '#', 'F', 'I', 'X', 
   'E', 'D', ' ', '"', 'h', 't', 't', 'p', ':', '/', 
   '/', 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 
   'g', '/', '2', '0', '0', '1', '/', 'X', 'I', 'n', 
   'c', 'l', 'u', 'd', 'e', '"', '\n', 
  '\011', 'h', 'r', 'e', 'f', '\011', '\011', 'C', 'D', 'A', 
   'T', 'A', '\011', '#', 'R', 'E', 'Q', 'U', 'I', 'R', 
   'E', 'D', '>', '\n', 
  0 };

const char *const xml_builtin[][2] = {
  { "gdb-target.dtd", xml_feature_gdb_target_dtd },
  { "xinclude.dtd", xml_feature_xinclude_dtd },
  { 0, 0 }
};

---

which indeed isn't valid C code.  Did yoy use some GNU-isms in the
bits of awk that are used to generate this code?

Mark


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