+2018-04-18  Alan Hayward  <alan.hayward@arm.com>
+
+       * common/tdesc.h (tdesc_architecture_name): Add new declaration.
+       (tdesc_osabi_name): Likewise.
+       * target-descriptions.c (tdesc_architecture_name): Add new
+       function.
+       (tdesc_osabi_name): Likewise.
+
 2018-04-18  Alan Hayward  <alan.hayward@arm.com>
 
        * common/tdesc.c (tdesc_predefined_type): Move to here.
 
 void set_tdesc_architecture (target_desc *target_desc,
                             const char *name);
 
+/* Return the architecture associated with this target description as a string,
+   or NULL if no architecture was specified.  */
+const char *tdesc_architecture_name (const struct target_desc *target_desc);
+
 /* Set TARGET_DESC's osabi by NAME.  */
 void set_tdesc_osabi (target_desc *target_desc, const char *name);
 
+/* Return the osabi associated with this target description as a string,
+   or NULL if no osabi was specified.  */
+const char *tdesc_osabi_name (const struct target_desc *target_desc);
+
 /* Return the type associated with ID in the context of FEATURE, or
    NULL if none.  */
 struct tdesc_type *tdesc_named_type (const struct tdesc_feature *feature,
 
+2018-04-18  Alan Hayward  <alan.hayward@arm.com>
+
+       * tdesc.c (tdesc_architecture_name): Add new function.
+       (tdesc_osabi_name): Likewise.
+       (tdesc_get_features_xml): Use new functions.
+
 2018-04-18  Alan Hayward  <alan.hayward@arm.com>
 
        * tdesc.c (tdesc_create_flags): Remove.
 
 
 /* See common/tdesc.h.  */
 
+const char *
+tdesc_architecture_name (const struct target_desc *target_desc)
+{
+  return target_desc->arch;
+}
+
+/* See common/tdesc.h.  */
+
 void
 set_tdesc_architecture (struct target_desc *target_desc,
                        const char *name)
 
 /* See common/tdesc.h.  */
 
+const char *
+tdesc_osabi_name (const struct target_desc *target_desc)
+{
+  return target_desc->osabi;
+}
+
+/* See common/tdesc.h.  */
+
 void
 set_tdesc_osabi (struct target_desc *target_desc, const char *name)
 {
       buffer += "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">";
       buffer += "<target>";
       buffer += "<architecture>";
-      buffer += tdesc->arch;
+      buffer += tdesc_architecture_name (tdesc);
       buffer += "</architecture>";
 
-      if (tdesc->osabi != nullptr)
+      const char *osabi = tdesc_osabi_name (tdesc);
+      if (osabi != nullptr)
        {
          buffer += "<osabi>";
-         buffer += tdesc->osabi;
+         buffer += osabi;
          buffer += "</osabi>";
        }
 
 
   return target_desc->arch;
 }
 
+/* See common/tdesc.h.  */
+
+const char *
+tdesc_architecture_name (const struct target_desc *target_desc)
+{
+  return target_desc->arch->printable_name;
+}
+
 /* Return the OSABI associated with this target description, or
    GDB_OSABI_UNKNOWN if no osabi was specified.  */
 
   return target_desc->osabi;
 }
 
-\f
+/* See common/tdesc.h.  */
+
+const char *
+tdesc_osabi_name (const struct target_desc *target_desc)
+{
+  enum gdb_osabi osabi = tdesc_osabi (target_desc);
+  if (osabi > GDB_OSABI_UNKNOWN && osabi < GDB_OSABI_INVALID)
+    return gdbarch_osabi_name (osabi);
+  return nullptr;
+}
 
 /* Return 1 if this target description includes any registers.  */