Make the objfile destructor private
[deliverable/binutils-gdb.git] / gdb / hppa-tdep.c
index 16e44252f5f6bb42f9757bbc1c0dd0ba36715471..70f06585af68ca21a00d42ec1164595d3e5f96b0 100644 (file)
@@ -41,7 +41,7 @@
 #include "hppa-tdep.h"
 #include <algorithm>
 
-static int hppa_debug = 0;
+static bool hppa_debug = false;
 
 /* Some local constants.  */
 static const int hppa32_num_regs = 128;
@@ -84,9 +84,11 @@ struct hppa_objfile_private
    that separately and make this static. The solib data is probably hpux-
    specific, so we can create a separate extern objfile_data that is registered
    by hppa-hpux-tdep.c and shared with pa64solib.c and somsolib.c.  */
-static const struct objfile_data *hppa_objfile_priv_data = NULL;
+static const struct objfile_key<hppa_objfile_private,
+                               gdb::noop_deleter<hppa_objfile_private>>
+  hppa_objfile_priv_data;
 
-/* Get at various relevent fields of an instruction word.  */
+/* Get at various relevant fields of an instruction word.  */
 #define MASK_5 0x1f
 #define MASK_11 0x7ff
 #define MASK_14 0x3fff
@@ -208,7 +210,7 @@ hppa_init_objfile_priv_data (struct objfile *objfile)
   hppa_objfile_private *priv
     = OBSTACK_ZALLOC (&objfile->objfile_obstack, hppa_objfile_private);
 
-  set_objfile_data (objfile, hppa_objfile_priv_data, priv);
+  hppa_objfile_priv_data.set (objfile, priv);
 
   return priv;
 }
@@ -365,7 +367,7 @@ read_unwind_info (struct objfile *objfile)
 
   /* For reasons unknown the HP PA64 tools generate multiple unwinder
      sections in a single executable.  So we just iterate over every
-     section in the BFD looking for unwinder sections intead of trying
+     section in the BFD looking for unwinder sections instead of trying
      to do a lookup with bfd_get_section_by_name.
 
      First determine the total size of the unwind tables so that we
@@ -378,7 +380,7 @@ read_unwind_info (struct objfile *objfile)
       if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
          || strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
        {
-         unwind_size = bfd_section_size (objfile->obfd, unwind_sec);
+         unwind_size = bfd_section_size (unwind_sec);
          unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
 
          total_entries += unwind_entries;
@@ -391,7 +393,7 @@ read_unwind_info (struct objfile *objfile)
 
   if (stub_unwind_sec)
     {
-      stub_unwind_size = bfd_section_size (objfile->obfd, stub_unwind_sec);
+      stub_unwind_size = bfd_section_size (stub_unwind_sec);
       stub_entries = stub_unwind_size / STUB_UNWIND_ENTRY_SIZE;
     }
   else
@@ -419,7 +421,7 @@ read_unwind_info (struct objfile *objfile)
       if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
          || strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
        {
-         unwind_size = bfd_section_size (objfile->obfd, unwind_sec);
+         unwind_size = bfd_section_size (unwind_sec);
          unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
 
          internalize_unwinds (objfile, &ui->table[index], unwind_sec,
@@ -466,8 +468,7 @@ read_unwind_info (struct objfile *objfile)
         compare_unwind_entries);
 
   /* Keep a pointer to the unwind information.  */
-  obj_private = (struct hppa_objfile_private *) 
-               objfile_data (objfile, hppa_objfile_priv_data);
+  obj_private = hppa_objfile_priv_data.get (objfile);
   if (obj_private == NULL)
     obj_private = hppa_init_objfile_priv_data (objfile);
 
@@ -497,20 +498,18 @@ find_unwind_entry (CORE_ADDR pc)
       return NULL;
     }
 
-  for (objfile *objfile : all_objfiles (current_program_space))
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       struct hppa_unwind_info *ui;
       ui = NULL;
-      priv = ((struct hppa_objfile_private *)
-             objfile_data (objfile, hppa_objfile_priv_data));
+      priv = hppa_objfile_priv_data.get (objfile);
       if (priv)
        ui = ((struct hppa_objfile_private *) priv)->unwind_info;
 
       if (!ui)
        {
          read_unwind_info (objfile);
-         priv = ((struct hppa_objfile_private *)
-                 objfile_data (objfile, hppa_objfile_priv_data));
+         priv = hppa_objfile_priv_data.get (objfile);
          if (priv == NULL)
            error (_("Internal error reading unwind information."));
          ui = ((struct hppa_objfile_private *) priv)->unwind_info;
@@ -1183,7 +1182,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
 
   if (len > 16)
     {
-      /* All return values larget than 128 bits must be aggregate
+      /* All return values larger than 128 bits must be aggregate
          return values.  */
       gdb_assert (!hppa64_integral_or_pointer_p (type));
       gdb_assert (!hppa64_floating_p (type));
@@ -1297,7 +1296,7 @@ hppa64_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
   return align_up (addr, 16);
 }
 
-CORE_ADDR
+static CORE_ADDR
 hppa_read_pc (readable_regcache *regcache)
 {
   ULONGEST ipsw;
@@ -1432,7 +1431,7 @@ is_branch (unsigned long inst)
     - stw: 0x1a, store a word from a general register.
 
     - stwm: 0x1b, store a word from a general register and perform base
-      register modification (2.0 will still treate it as stw).
+      register modification (2.0 will still treat it as stw).
 
     - std: 0x1c, store a doubleword from a general register (2.0 only).
 
@@ -1593,7 +1592,7 @@ restart:
      For unoptimized GCC code and for any HP CC code this will never ever
      examine any user instructions.
 
-     For optimzied GCC code we're faced with problems.  GCC will schedule
+     For optimized GCC code we're faced with problems.  GCC will schedule
      its prologue and make prologue instructions available for delay slot
      filling.  The end result is user code gets mixed in with the prologue
      and a prologue instruction may be in the delay slot of the first branch
@@ -1760,7 +1759,7 @@ restart:
        final_iteration = 1;
     }
 
-  /* We've got a tenative location for the end of the prologue.  However
+  /* We've got a tentative location for the end of the prologue.  However
      because of limitations in the unwind descriptor mechanism we may
      have went too far into user code looking for the save of a register
      that does not exist.  So, if there registers we expected to be saved
@@ -2505,14 +2504,6 @@ static const struct frame_unwind hppa_stub_frame_unwind = {
   hppa_stub_unwind_sniffer
 };
 
-static struct frame_id
-hppa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-                                                      HPPA_SP_REGNUM),
-                        get_frame_pc (this_frame));
-}
-
 CORE_ADDR
 hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -2542,11 +2533,11 @@ hppa_lookup_stub_minimal_symbol (const char *name,
 {
   struct bound_minimal_symbol result = { NULL, NULL };
 
-  for (objfile *objfile : all_objfiles (current_program_space))
+  for (objfile *objfile : current_program_space->objfiles ())
     {
-      for (minimal_symbol *msym : objfile_msymbols (objfile))
+      for (minimal_symbol *msym : objfile->msymbols ())
        {
-         if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0)
+         if (strcmp (msym->linkage_name (), name) == 0)
            {
              struct unwind_table_entry *u;
 
@@ -2588,10 +2579,8 @@ unwind_command (const char *exp, int from_tty)
   printf_unfiltered ("unwind_table_entry (%s):\n", host_address_to_string (u));
 
   printf_unfiltered ("\tregion_start = %s\n", hex_string (u->region_start));
-  gdb_flush (gdb_stdout);
 
   printf_unfiltered ("\tregion_end = %s\n", hex_string (u->region_end));
-  gdb_flush (gdb_stdout);
 
 #define pif(FLD) if (u->FLD) printf_unfiltered (" "#FLD);
 
@@ -2880,7 +2869,7 @@ hppa_match_insns (struct gdbarch *gdbarch, CORE_ADDR pc,
   return 1;
 }
 
-/* This relaxed version of the insstruction matcher allows us to match
+/* This relaxed version of the instruction matcher allows us to match
    from somewhere inside the pattern, by looking backwards in the
    instruction scheme.  */
 
@@ -3156,7 +3145,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
 
   /* Frame unwind methods.  */
-  set_gdbarch_dummy_id (gdbarch, hppa_dummy_id);
   set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
@@ -3185,8 +3173,6 @@ _initialize_hppa_tdep (void)
 {
   gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
 
-  hppa_objfile_priv_data = register_objfile_data ();
-
   add_cmd ("unwind", class_maintenance, unwind_command,
           _("Print unwind table entry at given address."),
           &maintenanceprintlist);
This page took 0.027898 seconds and 4 git commands to generate.