gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / ctfread.c
index 120c7b4017a6730b79f2119e14c1b57fd7ced8a7..57a376329385eb6763c4288ea14b4b3dc96db929 100644 (file)
@@ -45,7 +45,7 @@
    The file header stores a magic number and version information, encoding
    flags, and the byte offset of each of the sections relative to the end of the
    header itself.  If the CTF data has been uniquified against another set of
-   CTF data, a reference to that data also appears in the the header.  This
+   CTF data, a reference to that data also appears in the header.  This
    reference is the name of the label corresponding to the types uniquified
    against.
 
@@ -88,9 +88,9 @@ static const struct objfile_key<htab, htab_deleter> ctf_tid_key;
 
 struct ctf_fp_info
 {
-    explicit ctf_fp_info (ctf_file_t *cfp) : fp (cfp) {}
-    ~ctf_fp_info ();
-    ctf_file_t *fp;
+  explicit ctf_fp_info (ctf_file_t *cfp) : fp (cfp) {}
+  ~ctf_fp_info ();
+  ctf_file_t *fp;
 };
 
 /* Cleanup function for the ctf_file_key data.  */
@@ -116,14 +116,15 @@ struct ctf_context
 };
 
 /* A partial symtab, specialized for this module.  */
-struct ctf_psymtab : public partial_symtab
+struct ctf_psymtab : public standard_psymtab
 {
   ctf_psymtab (const char *filename, struct objfile *objfile, CORE_ADDR addr)
-    : partial_symtab (filename, objfile, addr)
+    : standard_psymtab (filename, objfile, addr)
   {
   }
 
   void read_symtab (struct objfile *) override;
+  void expand_psymtab (struct objfile *) override;
 
   struct ctf_context *context;
 };
@@ -160,8 +161,6 @@ struct ctf_field_info
 
 /* Local function prototypes */
 
-static void psymtab_to_symtab (ctf_psymtab *);
-
 static int ctf_add_type_cb (ctf_id_t tid, void *arg);
 
 static struct type *read_array_type (struct ctf_context *cp, ctf_id_t tid);
@@ -309,15 +308,15 @@ attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
     return;
 
   /* Record the field count, allocate space for the array of fields.  */
-  TYPE_NFIELDS (type) = nfields;
-  TYPE_FIELDS (type)
-    = (struct field *) TYPE_ZALLOC (type, sizeof (struct field) * nfields);
+  type->set_num_fields (nfields);
+  type->set_fields
+    ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * nfields));
 
   /* Copy the saved-up fields into the field vector.  */
   for (int i = 0; i < nfields; ++i)
     {
       struct ctf_nextfield &field = fip->fields[i];
-      TYPE_FIELD (type, i) = field.field;
+      type->field (i) = field.field;
     }
 }
 
@@ -331,7 +330,7 @@ ctf_init_float_type (struct objfile *objfile,
                     const char *name,
                     const char *name_hint)
 {
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
+  struct gdbarch *gdbarch = objfile->arch ();
   const struct floatformat **format;
   struct type *type;
 
@@ -408,7 +407,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
 
   if (name != NULL)
     {
-      struct symbol *sym = allocate_symbol (ccp->of);
+      struct symbol *sym = new (&ccp->of->objfile_obstack) symbol;
       OBJSTAT (ccp->of, n_syms++);
 
       sym->set_language (language_c, &ccp->of->objfile_obstack);
@@ -437,7 +436,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL)
     {
-      sym = allocate_symbol (objfile);
+      sym = new (&objfile->objfile_obstack) symbol;
       OBJSTAT (objfile, n_syms++);
 
       sym->set_language (language_c, &objfile->objfile_obstack);
@@ -461,7 +460,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
            SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
            break;
          case CTF_K_CONST:
-           if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
+           if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID)
              SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int;
            break;
          case CTF_K_TYPEDEF:
@@ -522,7 +521,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
   if (kind == CTF_K_INTEGER)
     {
       uint32_t issigned, ischar, isbool;
-      struct gdbarch *gdbarch = get_objfile_arch (of);
+      struct gdbarch *gdbarch = of->arch ();
 
       issigned = cet.cte_format & CTF_INT_SIGNED;
       ischar = cet.cte_format & CTF_INT_CHAR;
@@ -554,7 +553,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
        {
          struct type *t
            = ctf_init_float_type (of, cet.cte_bits / 2, NULL, name);
-         type = init_complex_type (of, name, t);
+         type = init_complex_type (name, t);
        }
     }
   else
@@ -597,13 +596,13 @@ read_structure_type (struct ctf_context *ccp, ctf_id_t tid)
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL && strlen (name.get() ) != 0)
-    TYPE_NAME (type) = obstack_strdup (&of->objfile_obstack, name.get ());
+    type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
   kind = ctf_type_kind (fp, tid);
   if (kind == CTF_K_UNION)
-    TYPE_CODE (type) = TYPE_CODE_UNION;
+    type->set_code (TYPE_CODE_UNION);
   else
-    TYPE_CODE (type) = TYPE_CODE_STRUCT;
+    type->set_code (TYPE_CODE_STRUCT);
 
   TYPE_LENGTH (type) = ctf_type_size (fp, tid);
   set_type_align (type, ctf_type_align (fp, tid));
@@ -655,9 +654,9 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL && strlen (name.get ()) != 0)
-    TYPE_NAME (type) = obstack_strdup (&of->objfile_obstack, name.get ());
+    type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
-  TYPE_CODE (type) = TYPE_CODE_FUNC;
+  type->set_code (TYPE_CODE_FUNC);
   ctf_func_type_info (fp, tid, &cfi);
   rettype = get_tid_type (of, cfi.ctc_return);
   TYPE_TARGET_TYPE (type) = rettype;
@@ -681,9 +680,9 @@ read_enum_type (struct ctf_context *ccp, ctf_id_t tid)
 
   gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
   if (name != NULL && strlen (name.get ()) != 0)
-    TYPE_NAME (type) = obstack_strdup (&of->objfile_obstack, name.get ());
+    type->set_name (obstack_strdup (&of->objfile_obstack, name.get ()));
 
-  TYPE_CODE (type) = TYPE_CODE_ENUM;
+  type->set_code (TYPE_CODE_ENUM);
   TYPE_LENGTH (type) = ctf_type_size (fp, tid);
   ctf_func_type_info (fp, tid, &fi);
   target_type = get_tid_type (of, fi.ctc_return);
@@ -727,7 +726,7 @@ add_array_cv_type (struct ctf_context *ccp,
   base_type = copy_type (base_type);
   inner_array = base_type;
 
-  while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+  while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
     {
       TYPE_TARGET_TYPE (inner_array)
        = copy_type (TYPE_TARGET_TYPE (inner_array));
@@ -1072,7 +1071,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
          complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
          type = objfile_type (ccp->of)->builtin_error;
        }
-       sym = allocate_symbol (ccp->of);
+       sym = new (&ccp->of->objfile_obstack) symbol;
        OBJSTAT (ccp->of, n_syms++);
        SYMBOL_TYPE (sym) = type;
        SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -1140,12 +1139,12 @@ add_stt_func (struct ctf_context *ccp, unsigned long idx)
   ftype = get_tid_type (ccp->of, tid);
   if (finfo.ctc_flags & CTF_FUNC_VARARG)
     TYPE_VARARGS (ftype) = 1;
-  TYPE_NFIELDS (ftype) = argc;
+  ftype->set_num_fields (argc);
 
   /* If argc is 0, it has a "void" type.  */
   if (argc != 0)
-    TYPE_FIELDS (ftype)
-      = (struct field *) TYPE_ZALLOC (ftype, argc * sizeof (struct field));
+    ftype->set_fields
+      ((struct field *) TYPE_ZALLOC (ftype, argc * sizeof (struct field)));
 
   /* TYPE_FIELD_TYPE must never be NULL.  Fill it with void_type, if failed
      to find the argument type.  */
@@ -1216,15 +1215,15 @@ ctf_end_symtab (ctf_psymtab *pst,
 
 /* Read in full symbols for PST, and anything it depends on.  */
 
-static void
-psymtab_to_symtab (ctf_psymtab *pst)
+void
+ctf_psymtab::expand_psymtab (struct objfile *objfile)
 {
   struct symbol *sym;
   struct ctf_context *ccp;
 
-  gdb_assert (!pst->readin);
+  gdb_assert (!readin);
 
-  ccp = pst->context;
+  ccp = context;
 
   /* Iterate over entries in data types section.  */
   if (ctf_type_iter (ccp->fp, ctf_add_type_cb, ccp) == CTF_ERR)
@@ -1254,7 +1253,7 @@ psymtab_to_symtab (ctf_psymtab *pst)
       set_symbol_address (ccp->of, sym, sym->linkage_name ());
     }
 
-  pst->readin = true;
+  readin = true;
 }
 
 /* Expand partial symbol table PST into a full symbol table.
@@ -1279,7 +1278,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
 
       offset = get_objfile_text_range (objfile, &tsize);
       ctf_start_symtab (this, objfile, offset);
-      psymtab_to_symtab (this);
+      expand_psymtab (objfile);
 
       set_text_low (offset);
       set_text_high (offset + tsize);
@@ -1486,9 +1485,3 @@ elfctf_build_psymtabs (struct objfile *of)
 
   scan_partial_symbols (fp, of);
 }
-
-void _initialize_ctfread ();
-void
-_initialize_ctfread ()
-{
-}
This page took 0.037017 seconds and 4 git commands to generate.