Create xml from target descriptions

Add a print_xml_feature visitor class which turns a
target description into xml. Both gdb and gdbserver can do this.

gdb/
	* common/tdesc.c (print_xml_feature::visit_pre): Add xml parsing.
	(print_xml_feature::visit_post): Likewise.
	(print_xml_feature::visit): Likewise.
	* common/tdesc.h (tdesc_get_features_xml): Use const tdesc.
	(print_xml_feature): Add new class.
	* regformats/regdat.sh: Null xmltarget on feature targets.
	* target-descriptions.c (struct target_desc): Add xmltarget.
	(maintenance_check_tdesc_xml_convert): Add unittest function.
	(tdesc_get_features_xml): Add function to get xml.
	(maintenance_check_xml_descriptions): Test xml generation.
	* xml-tdesc.c (string_read_description_xml): Add function.
	* xml-tdesc.h (string_read_description_xml): Add declaration.

gdbserver/
	* gdb/gdbserver/server.c (get_features_xml): Remove cast.
	* tdesc.c (void target_desc::accept): Fill in function.
	(tdesc_get_features_xml): Remove old xml creation.
	(print_xml_feature::visit_pre): Add xml vistor.
	* tdesc.h (struct target_desc): Make xmltarget mutable.
	(tdesc_get_features_xml): Remove declaration.
This commit is contained in:
Alan Hayward
2018-04-18 20:09:12 +01:00
parent ad7fc756d1
commit e98577a9dc
11 changed files with 260 additions and 38 deletions

View File

@ -752,3 +752,15 @@ target_fetch_description_xml (struct target_ops *ops)
return output;
#endif
}
/* See xml-tdesc.h. */
const struct target_desc *
string_read_description_xml (const char *xml)
{
return tdesc_parse_xml (xml, [] (const char *href, void *baton)
{
error (_("xincludes are unsupported with this method"));
return gdb::optional<gdb::char_vector> ();
}, nullptr);
}