1 /* XML target description support for GDB.
3 Copyright (C) 2006-2019 Free Software Foundation, Inc.
5 Contributed by CodeSourcery.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "target-descriptions.h"
25 #include "xml-support.h"
26 #include "xml-tdesc.h"
28 #include "filenames.h"
29 #include <unordered_map>
33 This is just to catch obviously wrong values. */
34 #define MAX_FIELD_SIZE 65536
35 #define MAX_FIELD_BITSIZE (MAX_FIELD_SIZE * TARGET_CHAR_BIT)
36 #define MAX_VECTOR_SIZE 65536
38 #if !defined(HAVE_LIBEXPAT)
40 /* Parse DOCUMENT into a target description. Or don't, since we don't have
43 static struct target_desc *
44 tdesc_parse_xml (const char *document, xml_fetch_another fetcher,
47 static int have_warned;
52 warning (_("Can not parse XML target description; XML support was "
53 "disabled at compile time"));
59 #else /* HAVE_LIBEXPAT */
61 /* A record of every XML description we have parsed. We never discard
62 old descriptions, because we never discard gdbarches. As long as we
63 have a gdbarch referencing this description, we want to have a copy
64 of it here, so that if we parse the same XML document again we can
65 return the same "struct target_desc *"; if they are not singletons,
66 then we will create unnecessary duplicate gdbarches. See
67 gdbarch_list_lookup_by_info. */
69 static std::unordered_map<std::string, target_desc_up> xml_cache;
71 /* Callback data for target description parsing. */
73 struct tdesc_parsing_data
75 /* The target description we are building. */
76 struct target_desc *tdesc;
78 /* The target feature we are currently parsing, or last parsed. */
79 struct tdesc_feature *current_feature;
81 /* The register number to use for the next register we see, if
82 it does not have its own. This starts at zero. */
85 /* The struct or union we are currently parsing, or last parsed. */
86 tdesc_type_with_fields *current_type;
88 /* The byte size of the current struct/flags type, if specified. Zero
89 if not specified. Flags values must specify a size. */
90 int current_type_size;
93 /* Handle the end of an <architecture> element and its value. */
96 tdesc_end_arch (struct gdb_xml_parser *parser,
97 const struct gdb_xml_element *element,
98 void *user_data, const char *body_text)
100 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
101 const struct bfd_arch_info *arch;
103 arch = bfd_scan_arch (body_text);
105 gdb_xml_error (parser, _("Target description specified unknown "
106 "architecture \"%s\""), body_text);
107 set_tdesc_architecture (data->tdesc, arch);
110 /* Handle the end of an <osabi> element and its value. */
113 tdesc_end_osabi (struct gdb_xml_parser *parser,
114 const struct gdb_xml_element *element,
115 void *user_data, const char *body_text)
117 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
118 enum gdb_osabi osabi;
120 osabi = osabi_from_tdesc_string (body_text);
121 if (osabi == GDB_OSABI_UNKNOWN)
122 warning (_("Target description specified unknown osabi \"%s\""),
125 set_tdesc_osabi (data->tdesc, osabi);
128 /* Handle the end of a <compatible> element and its value. */
131 tdesc_end_compatible (struct gdb_xml_parser *parser,
132 const struct gdb_xml_element *element,
133 void *user_data, const char *body_text)
135 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
136 const struct bfd_arch_info *arch;
138 arch = bfd_scan_arch (body_text);
139 tdesc_add_compatible (data->tdesc, arch);
142 /* Handle the start of a <target> element. */
145 tdesc_start_target (struct gdb_xml_parser *parser,
146 const struct gdb_xml_element *element,
147 void *user_data, std::vector<gdb_xml_value> &attributes)
150 = (char *) xml_find_attribute (attributes, "version")->value.get ();
152 if (strcmp (version, "1.0") != 0)
153 gdb_xml_error (parser,
154 _("Target description has unsupported version \"%s\""),
158 /* Handle the start of a <feature> element. */
161 tdesc_start_feature (struct gdb_xml_parser *parser,
162 const struct gdb_xml_element *element,
163 void *user_data, std::vector<gdb_xml_value> &attributes)
165 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
166 char *name = (char *) xml_find_attribute (attributes, "name")->value.get ();
168 data->current_feature = tdesc_create_feature (data->tdesc, name);
171 /* Handle the start of a <reg> element. Fill in the optional
172 attributes and attach it to the containing feature. */
175 tdesc_start_reg (struct gdb_xml_parser *parser,
176 const struct gdb_xml_element *element,
177 void *user_data, std::vector<gdb_xml_value> &attributes)
179 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
183 int bitsize, regnum, save_restore;
185 int length = attributes.size ();
187 name = (char *) attributes[ix++].value.get ();
188 bitsize = * (ULONGEST *) attributes[ix++].value.get ();
190 if (ix < length && strcmp (attributes[ix].name, "regnum") == 0)
191 regnum = * (ULONGEST *) attributes[ix++].value.get ();
193 regnum = data->next_regnum;
195 if (ix < length && strcmp (attributes[ix].name, "type") == 0)
196 type = (char *) attributes[ix++].value.get ();
200 if (ix < length && strcmp (attributes[ix].name, "group") == 0)
201 group = (char *) attributes[ix++].value.get ();
205 if (ix < length && strcmp (attributes[ix].name, "save-restore") == 0)
206 save_restore = * (ULONGEST *) attributes[ix++].value.get ();
210 if (strcmp (type, "int") != 0
211 && strcmp (type, "float") != 0
212 && tdesc_named_type (data->current_feature, type) == NULL)
213 gdb_xml_error (parser, _("Register \"%s\" has unknown type \"%s\""),
216 tdesc_create_reg (data->current_feature, name, regnum, save_restore, group,
219 data->next_regnum = regnum + 1;
222 /* Handle the start of a <union> element. Initialize the type and
223 record it with the current feature. */
226 tdesc_start_union (struct gdb_xml_parser *parser,
227 const struct gdb_xml_element *element,
228 void *user_data, std::vector<gdb_xml_value> &attributes)
230 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
231 char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
233 data->current_type = tdesc_create_union (data->current_feature, id);
234 data->current_type_size = 0;
237 /* Handle the start of a <struct> element. Initialize the type and
238 record it with the current feature. */
241 tdesc_start_struct (struct gdb_xml_parser *parser,
242 const struct gdb_xml_element *element,
243 void *user_data, std::vector<gdb_xml_value> &attributes)
245 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
246 char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
247 struct gdb_xml_value *attr;
249 tdesc_type_with_fields *type_with_fields
250 = tdesc_create_struct (data->current_feature, id);
251 data->current_type = type_with_fields;
252 data->current_type_size = 0;
254 attr = xml_find_attribute (attributes, "size");
257 ULONGEST size = * (ULONGEST *) attr->value.get ();
259 if (size > MAX_FIELD_SIZE)
261 gdb_xml_error (parser,
262 _("Struct size %s is larger than maximum (%d)"),
263 pulongest (size), MAX_FIELD_SIZE);
265 tdesc_set_struct_size (type_with_fields, size);
266 data->current_type_size = size;
271 tdesc_start_flags (struct gdb_xml_parser *parser,
272 const struct gdb_xml_element *element,
273 void *user_data, std::vector<gdb_xml_value> &attributes)
275 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
276 char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
277 ULONGEST size = * (ULONGEST *)
278 xml_find_attribute (attributes, "size")->value.get ();
280 if (size > MAX_FIELD_SIZE)
282 gdb_xml_error (parser,
283 _("Flags size %s is larger than maximum (%d)"),
284 pulongest (size), MAX_FIELD_SIZE);
287 data->current_type = tdesc_create_flags (data->current_feature, id, size);
288 data->current_type_size = size;
292 tdesc_start_enum (struct gdb_xml_parser *parser,
293 const struct gdb_xml_element *element,
294 void *user_data, std::vector<gdb_xml_value> &attributes)
296 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
297 char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
298 int size = * (ULONGEST *)
299 xml_find_attribute (attributes, "size")->value.get ();
301 if (size > MAX_FIELD_SIZE)
303 gdb_xml_error (parser,
304 _("Enum size %s is larger than maximum (%d)"),
305 pulongest (size), MAX_FIELD_SIZE);
308 data->current_type = tdesc_create_enum (data->current_feature, id, size);
309 data->current_type_size = 0;
312 /* Handle the start of a <field> element. Attach the field to the
313 current struct, union or flags. */
316 tdesc_start_field (struct gdb_xml_parser *parser,
317 const struct gdb_xml_element *element,
318 void *user_data, std::vector<gdb_xml_value> &attributes)
320 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
321 struct gdb_xml_value *attr;
322 struct tdesc_type *field_type;
323 char *field_name, *field_type_id;
326 field_name = (char *) xml_find_attribute (attributes, "name")->value.get ();
328 attr = xml_find_attribute (attributes, "type");
331 field_type_id = (char *) attr->value.get ();
332 field_type = tdesc_named_type (data->current_feature, field_type_id);
336 field_type_id = NULL;
340 attr = xml_find_attribute (attributes, "start");
343 ULONGEST ul_start = * (ULONGEST *) attr->value.get ();
345 if (ul_start > MAX_FIELD_BITSIZE)
347 gdb_xml_error (parser,
348 _("Field start %s is larger than maximum (%d)"),
349 pulongest (ul_start), MAX_FIELD_BITSIZE);
356 attr = xml_find_attribute (attributes, "end");
359 ULONGEST ul_end = * (ULONGEST *) attr->value.get ();
361 if (ul_end > MAX_FIELD_BITSIZE)
363 gdb_xml_error (parser,
364 _("Field end %s is larger than maximum (%d)"),
365 pulongest (ul_end), MAX_FIELD_BITSIZE);
374 tdesc_type_with_fields *t = data->current_type;
376 /* Older versions of gdb can't handle elided end values.
377 Stick with that for now, to help ensure backward compatibility.
378 E.g., If a newer gdbserver is talking to an older gdb. */
380 gdb_xml_error (parser, _("Missing end value"));
382 if (data->current_type_size == 0)
383 gdb_xml_error (parser,
384 _("Bitfields must live in explicitly sized types"));
386 if (field_type_id != NULL
387 && strcmp (field_type_id, "bool") == 0
390 gdb_xml_error (parser,
391 _("Boolean fields must be one bit in size"));
395 gdb_xml_error (parser,
396 _("Bitfield \"%s\" goes past "
397 "64 bits (unsupported)"),
400 /* Assume that the bit numbering in XML is "lsb-zero". Most
401 architectures other than PowerPC use this ordering. In the
402 future, we can add an XML tag to indicate "msb-zero" numbering. */
404 gdb_xml_error (parser, _("Bitfield \"%s\" has start after end"),
406 if (end >= data->current_type_size * TARGET_CHAR_BIT)
407 gdb_xml_error (parser, _("Bitfield \"%s\" does not fit in struct"),
410 if (field_type != NULL)
411 tdesc_add_typed_bitfield (t, field_name, start, end, field_type);
412 else if (start == end)
413 tdesc_add_flag (t, start, field_name);
415 tdesc_add_bitfield (t, field_name, start, end);
417 else if (start == -1 && end != -1)
418 gdb_xml_error (parser, _("End specified but not start"));
419 else if (field_type_id != NULL)
421 /* TDESC_TYPE_FLAGS values are explicitly sized, so the following test
422 catches adding non-bitfield types to flags as well. */
423 if (data->current_type_size != 0)
424 gdb_xml_error (parser,
425 _("Explicitly sized type cannot "
426 "contain non-bitfield \"%s\""),
429 if (field_type == NULL)
430 gdb_xml_error (parser, _("Field \"%s\" references undefined "
432 field_name, field_type_id);
434 tdesc_add_field (data->current_type, field_name, field_type);
437 gdb_xml_error (parser, _("Field \"%s\" has neither type nor bit position"),
441 /* Handle the start of an <evalue> element. Attach the value to the
445 tdesc_start_enum_value (struct gdb_xml_parser *parser,
446 const struct gdb_xml_element *element,
447 void *user_data, std::vector<gdb_xml_value> &attributes)
449 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
450 struct gdb_xml_value *attr;
455 field_name = (char *) xml_find_attribute (attributes, "name")->value.get ();
457 attr = xml_find_attribute (attributes, "value");
458 ul_value = * (ULONGEST *) attr->value.get ();
459 if (ul_value > INT_MAX)
461 gdb_xml_error (parser,
462 _("Enum value %s is larger than maximum (%d)"),
463 pulongest (ul_value), INT_MAX);
467 tdesc_add_enum_value (data->current_type, value, field_name);
470 /* Handle the start of a <vector> element. Initialize the type and
471 record it with the current feature. */
474 tdesc_start_vector (struct gdb_xml_parser *parser,
475 const struct gdb_xml_element *element,
476 void *user_data, std::vector<gdb_xml_value> &attributes)
478 struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
479 struct tdesc_type *field_type;
480 char *id, *field_type_id;
483 id = (char *) attributes[0].value.get ();
484 field_type_id = (char *) attributes[1].value.get ();
485 count = * (ULONGEST *) attributes[2].value.get ();
487 if (count > MAX_VECTOR_SIZE)
489 gdb_xml_error (parser,
490 _("Vector size %s is larger than maximum (%d)"),
491 pulongest (count), MAX_VECTOR_SIZE);
494 field_type = tdesc_named_type (data->current_feature, field_type_id);
495 if (field_type == NULL)
496 gdb_xml_error (parser, _("Vector \"%s\" references undefined type \"%s\""),
499 tdesc_create_vector (data->current_feature, id, field_type, count);
502 /* The elements and attributes of an XML target description. */
504 static const struct gdb_xml_attribute field_attributes[] = {
505 { "name", GDB_XML_AF_NONE, NULL, NULL },
506 { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
507 { "start", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
508 { "end", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
509 { NULL, GDB_XML_AF_NONE, NULL, NULL }
512 static const struct gdb_xml_attribute enum_value_attributes[] = {
513 { "name", GDB_XML_AF_NONE, NULL, NULL },
514 { "value", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
515 { NULL, GDB_XML_AF_NONE, NULL, NULL }
518 static const struct gdb_xml_element struct_union_children[] = {
519 { "field", field_attributes, NULL, GDB_XML_EF_REPEATABLE,
520 tdesc_start_field, NULL },
521 { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
524 static const struct gdb_xml_element enum_children[] = {
525 { "evalue", enum_value_attributes, NULL, GDB_XML_EF_REPEATABLE,
526 tdesc_start_enum_value, NULL },
527 { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
530 static const struct gdb_xml_attribute reg_attributes[] = {
531 { "name", GDB_XML_AF_NONE, NULL, NULL },
532 { "bitsize", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
533 { "regnum", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
534 { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
535 { "group", GDB_XML_AF_OPTIONAL, NULL, NULL },
536 { "save-restore", GDB_XML_AF_OPTIONAL,
537 gdb_xml_parse_attr_enum, gdb_xml_enums_boolean },
538 { NULL, GDB_XML_AF_NONE, NULL, NULL }
541 static const struct gdb_xml_attribute struct_union_attributes[] = {
542 { "id", GDB_XML_AF_NONE, NULL, NULL },
543 { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL},
544 { NULL, GDB_XML_AF_NONE, NULL, NULL }
547 static const struct gdb_xml_attribute flags_attributes[] = {
548 { "id", GDB_XML_AF_NONE, NULL, NULL },
549 { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
550 { NULL, GDB_XML_AF_NONE, NULL, NULL }
553 static const struct gdb_xml_attribute enum_attributes[] = {
554 { "id", GDB_XML_AF_NONE, NULL, NULL },
555 { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
556 { NULL, GDB_XML_AF_NONE, NULL, NULL }
559 static const struct gdb_xml_attribute vector_attributes[] = {
560 { "id", GDB_XML_AF_NONE, NULL, NULL },
561 { "type", GDB_XML_AF_NONE, NULL, NULL },
562 { "count", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
563 { NULL, GDB_XML_AF_NONE, NULL, NULL }
566 static const struct gdb_xml_attribute feature_attributes[] = {
567 { "name", GDB_XML_AF_NONE, NULL, NULL },
568 { NULL, GDB_XML_AF_NONE, NULL, NULL }
571 static const struct gdb_xml_element feature_children[] = {
572 { "reg", reg_attributes, NULL,
573 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
574 tdesc_start_reg, NULL },
575 { "struct", struct_union_attributes, struct_union_children,
576 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
577 tdesc_start_struct, NULL },
578 { "union", struct_union_attributes, struct_union_children,
579 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
580 tdesc_start_union, NULL },
581 { "flags", flags_attributes, struct_union_children,
582 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
583 tdesc_start_flags, NULL },
584 { "enum", enum_attributes, enum_children,
585 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
586 tdesc_start_enum, NULL },
587 { "vector", vector_attributes, NULL,
588 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
589 tdesc_start_vector, NULL },
590 { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
593 static const struct gdb_xml_attribute target_attributes[] = {
594 { "version", GDB_XML_AF_NONE, NULL, NULL },
595 { NULL, GDB_XML_AF_NONE, NULL, NULL }
598 static const struct gdb_xml_element target_children[] = {
599 { "architecture", NULL, NULL, GDB_XML_EF_OPTIONAL,
600 NULL, tdesc_end_arch },
601 { "osabi", NULL, NULL, GDB_XML_EF_OPTIONAL,
602 NULL, tdesc_end_osabi },
603 { "compatible", NULL, NULL, GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
604 NULL, tdesc_end_compatible },
605 { "feature", feature_attributes, feature_children,
606 GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
607 tdesc_start_feature, NULL },
608 { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
611 static const struct gdb_xml_element tdesc_elements[] = {
612 { "target", target_attributes, target_children, GDB_XML_EF_NONE,
613 tdesc_start_target, NULL },
614 { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
617 /* Parse DOCUMENT into a target description and return it. */
619 static struct target_desc *
620 tdesc_parse_xml (const char *document, xml_fetch_another fetcher,
623 struct tdesc_parsing_data data;
625 /* Expand all XInclude directives. */
626 std::string expanded_text;
628 if (!xml_process_xincludes (expanded_text,
629 _("target description"),
630 document, fetcher, fetcher_baton, 0))
632 warning (_("Could not load XML target description; ignoring"));
636 /* Check for an exact match in the list of descriptions we have
637 previously parsed. */
638 const auto it = xml_cache.find (expanded_text);
639 if (it != xml_cache.end ())
640 return it->second.get ();
642 memset (&data, 0, sizeof (struct tdesc_parsing_data));
643 target_desc_up description (allocate_target_description ());
644 data.tdesc = description.get ();
646 if (gdb_xml_parse_quick (_("target description"), "gdb-target.dtd",
647 tdesc_elements, expanded_text.c_str (), &data) == 0)
649 /* Parsed successfully. */
650 xml_cache.emplace (std::move (expanded_text), std::move (description));
655 warning (_("Could not load XML target description; ignoring"));
659 #endif /* HAVE_LIBEXPAT */
662 /* Read an XML target description from FILENAME. Parse it, and return
663 the parsed description. */
665 const struct target_desc *
666 file_read_description_xml (const char *filename)
668 gdb::optional<gdb::char_vector> tdesc_str
669 = xml_fetch_content_from_file (filename, NULL);
672 warning (_("Could not open \"%s\""), filename);
676 return tdesc_parse_xml (tdesc_str->data (), xml_fetch_content_from_file,
677 (void *) ldirname (filename).c_str ());
680 /* Read a string representation of available features from the target,
681 using TARGET_OBJECT_AVAILABLE_FEATURES. The returned string is
682 malloc allocated and NUL-terminated. NAME should be a non-NULL
683 string identifying the XML document we want; the top level document
684 is "target.xml". Other calls may be performed for the DTD or
687 static gdb::optional<gdb::char_vector>
688 fetch_available_features_from_target (const char *name, void *baton_)
690 struct target_ops *ops = (struct target_ops *) baton_;
692 /* Read this object as a string. This ensures that a NUL
693 terminator is added. */
694 return target_read_stralloc (ops,
695 TARGET_OBJECT_AVAILABLE_FEATURES,
700 /* Read an XML target description using OPS. Parse it, and return the
701 parsed description. */
703 const struct target_desc *
704 target_read_description_xml (struct target_ops *ops)
706 gdb::optional<gdb::char_vector> tdesc_str
707 = fetch_available_features_from_target ("target.xml", ops);
711 return tdesc_parse_xml (tdesc_str->data (),
712 fetch_available_features_from_target,
716 /* Fetches an XML target description using OPS, processing
717 includes, but not parsing it. Used to dump whole tdesc
718 as a single XML file. */
720 gdb::optional<std::string>
721 target_fetch_description_xml (struct target_ops *ops)
723 #if !defined(HAVE_LIBEXPAT)
724 static int have_warned;
729 warning (_("Can not fetch XML target description; XML support was "
730 "disabled at compile time"));
735 gdb::optional<gdb::char_vector>
736 tdesc_str = fetch_available_features_from_target ("target.xml", ops);
741 if (!xml_process_xincludes (output,
742 _("target description"),
744 fetch_available_features_from_target, ops, 0))
746 warning (_("Could not load XML target description; ignoring"));
753 /* See xml-tdesc.h. */
755 const struct target_desc *
756 string_read_description_xml (const char *xml)
758 return tdesc_parse_xml (xml, [] (const char *href, void *baton)
760 error (_("xincludes are unsupported with this method"));
761 return gdb::optional<gdb::char_vector> ();