Update release making notes.
[deliverable/binutils-gdb.git] / gdb / gdbserver / tdesc.c
index 1047949e6d375d98566aeb4693914c207356d6e7..de25e7cfb466cf00432e3c030c23649aa42dfd54 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -47,8 +47,21 @@ bool target_desc::operator== (const target_desc &other) const
 
 #endif
 
+void target_desc::accept (tdesc_element_visitor &v) const
+{
+#ifndef IN_PROCESS_AGENT
+  v.visit_pre (this);
+
+  for (const tdesc_feature_up &feature : features)
+    feature->accept (v);
+
+  v.visit_post (this);
+#endif
+}
+
 void
-init_target_desc (struct target_desc *tdesc)
+init_target_desc (struct target_desc *tdesc,
+                 const char **expedite_regs)
 {
   int offset = 0;
 
@@ -74,6 +87,10 @@ init_target_desc (struct target_desc *tdesc)
   /* Make sure PBUFSIZ is large enough to hold a full register
      packet.  */
   gdb_assert (2 * tdesc->registers_size + 32 <= PBUFSIZ);
+
+#ifndef IN_PROCESS_AGENT
+  tdesc->expedite_regs = expedite_regs;
+#endif
 }
 
 struct target_desc *
@@ -105,7 +122,15 @@ current_target_desc (void)
   return current_process ()->tdesc;
 }
 
-/* See common/tdesc.h.  */
+/* See gdbsupport/tdesc.h.  */
+
+const char *
+tdesc_architecture_name (const struct target_desc *target_desc)
+{
+  return target_desc->arch;
+}
+
+/* See gdbsupport/tdesc.h.  */
 
 void
 set_tdesc_architecture (struct target_desc *target_desc,
@@ -114,7 +139,15 @@ set_tdesc_architecture (struct target_desc *target_desc,
   target_desc->arch = xstrdup (name);
 }
 
-/* See common/tdesc.h.  */
+/* See gdbsupport/tdesc.h.  */
+
+const char *
+tdesc_osabi_name (const struct target_desc *target_desc)
+{
+  return target_desc->osabi;
+}
+
+/* See gdbsupport/tdesc.h.  */
 
 void
 set_tdesc_osabi (struct target_desc *target_desc, const char *name)
@@ -122,11 +155,10 @@ set_tdesc_osabi (struct target_desc *target_desc, const char *name)
   target_desc->osabi = xstrdup (name);
 }
 
-/* Return a string which is of XML format, including XML target
-   description to be sent to GDB.  */
+/* See gdbsupport/tdesc.h.  */
 
 const char *
-tdesc_get_features_xml (target_desc *tdesc)
+tdesc_get_features_xml (const target_desc *tdesc)
 {
   /* Either .xmltarget or .features is not NULL.  */
   gdb_assert (tdesc->xmltarget != NULL
@@ -135,30 +167,9 @@ tdesc_get_features_xml (target_desc *tdesc)
 
   if (tdesc->xmltarget == NULL)
     {
-      std::string buffer ("@<?xml version=\"1.0\"?>");
-
-      buffer += "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">";
-      buffer += "<target>";
-      buffer += "<architecture>";
-      buffer += tdesc->arch;
-      buffer += "</architecture>";
-
-      if (tdesc->osabi != nullptr)
-       {
-         buffer += "<osabi>";
-         buffer += tdesc->osabi;
-         buffer += "</osabi>";
-       }
-
-      for (const tdesc_feature_up &feature : tdesc->features)
-       {
-         buffer += "<xi:include href=\"";
-         buffer += feature->name;
-         buffer += "\"/>";
-       }
-
-      buffer += "</target>";
-
+      std::string buffer ("@");
+      print_xml_feature v (&buffer);
+      tdesc->accept (v);
       tdesc->xmltarget = xstrdup (buffer.c_str ());
     }
 
@@ -166,82 +177,28 @@ tdesc_get_features_xml (target_desc *tdesc)
 }
 #endif
 
-/* See common/tdesc.h.  */
+/* See gdbsupport/tdesc.h.  */
 
 struct tdesc_feature *
-tdesc_create_feature (struct target_desc *tdesc, const char *name,
-                     const char *xml)
+tdesc_create_feature (struct target_desc *tdesc, const char *name)
 {
-  struct tdesc_feature *new_feature = new tdesc_feature
-    (xml != nullptr ? xml : name);
+  struct tdesc_feature *new_feature = new tdesc_feature (name);
   tdesc->features.emplace_back (new_feature);
   return new_feature;
 }
 
-/* See common/tdesc.h.  */
-
-tdesc_type_with_fields *
-tdesc_create_flags (struct tdesc_feature *feature, const char *name,
-                   int size)
-{
-  return NULL;
-}
-
-/* See common/tdesc.h.  */
+/* See gdbsupport/tdesc.h.  */
 
-void
-tdesc_add_flag (tdesc_type_with_fields *type, int start,
-               const char *flag_name)
-{}
-
-/* See common/tdesc.h.  */
-
-struct tdesc_type *
-tdesc_named_type (const struct tdesc_feature *feature, const char *id)
-{
-  return NULL;
-}
-
-/* See common/tdesc.h.  */
-
-tdesc_type_with_fields *
-tdesc_create_union (struct tdesc_feature *feature, const char *id)
+bool
+tdesc_contains_feature (const target_desc *tdesc, const std::string &feature)
 {
-  return NULL;
-}
-
-/* See common/tdesc.h.  */
-
-tdesc_type_with_fields *
-tdesc_create_struct (struct tdesc_feature *feature, const char *id)
-{
-  return NULL;
-}
-
-/* See common/tdesc.h.  */
+  gdb_assert (tdesc != nullptr);
 
-struct tdesc_type *
-tdesc_create_vector (struct tdesc_feature *feature, const char *name,
-                    struct tdesc_type *field_type, int count)
-{
-  return NULL;
-}
-
-void
-tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
-                   int start, int end)
-{}
-
-/* See common/tdesc.h.  */
-
-void
-tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
-                struct tdesc_type *field_type)
-{}
-
-/* See common/tdesc.h.  */
+  for (const tdesc_feature_up &f : tdesc->features)
+    {
+      if (f->name == feature)
+       return true;
+    }
 
-void
-tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
-{
+  return false;
 }
This page took 0.027606 seconds and 4 git commands to generate.