+/* Completer for the "backtrace" command. */
+
+static void
+maint_print_c_tdesc_cmd_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker,
+ const char *text, const char *word)
+{
+ auto grp = make_maint_print_c_tdesc_options_def_group (nullptr);
+ if (gdb::option::complete_options
+ (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
+ return;
+
+ word = advance_to_filename_complete_word_point (tracker, text);
+ filename_completer (ignore, tracker, text, word);
+}
+
+/* Implement the maintenance print xml-tdesc command. */
+
+static void
+maint_print_xml_tdesc_cmd (const char *args, int from_tty)
+{
+ const struct target_desc *tdesc;
+
+ if (args == NULL)
+ {
+ /* Use the global target-supplied description, not the current
+ architecture's. This lets a GDB for one architecture generate XML
+ for another architecture's description, even though the gdbarch
+ initialization code will reject the new description. */
+ tdesc = get_tdesc_info (current_inferior ())->tdesc;
+ }
+ else
+ {
+ /* Use the target description from the XML file. */
+ tdesc = file_read_description_xml (args);
+ }
+
+ if (tdesc == NULL)
+ error (_("There is no target description to print."));
+
+ std::string buf;
+ print_xml_feature v (&buf);
+ tdesc->accept (v);
+ gdb_puts (buf.c_str ());
+}
+