]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: change objfiles_iterator to yield references
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 7 Oct 2025 19:02:57 +0000 (15:02 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 7 Oct 2025 20:22:15 +0000 (16:22 -0400)
Same rationale as the previous patches.

Change-Id: I4673cedaa902c9a327d24d73508b18cf60a2cd02
Approved-By: Tom Tromey <tom@tromey.com>
37 files changed:
gdb/ada-lang.c
gdb/agent.c
gdb/breakpoint.c
gdb/dwarf2/frame.c
gdb/dwarf2/index-write.c
gdb/gcore.c
gdb/guile/scm-objfile.c
gdb/guile/scm-pretty-print.c
gdb/guile/scm-progspace.c
gdb/hppa-tdep.c
gdb/ia64-tdep.c
gdb/jit.c
gdb/linespec.c
gdb/linux-thread-db.c
gdb/main.c
gdb/maint.c
gdb/minsyms.c
gdb/objc-lang.c
gdb/objfiles.c
gdb/printcmd.c
gdb/probe.c
gdb/progspace.c
gdb/progspace.h
gdb/psymtab.c
gdb/python/py-prettyprint.c
gdb/python/py-progspace.c
gdb/python/py-symbol.c
gdb/python/py-xmethods.c
gdb/solib-svr4.c
gdb/solib.c
gdb/source.c
gdb/symfile-debug.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/windows-tdep.c
gdb/z80-tdep.c

index cdf7c88d83fffd0e72c5eaeca6c34e5f7bd990b3..ac6270d54f07816b45d4236282ce09571ce6ff1c 100644 (file)
@@ -5584,11 +5584,11 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
 
   bool is_wild_match = lookup_name.ada ().wild_match_p ();
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      map_matching_symbols (objfile, lookup_name, domain, global, data);
+      map_matching_symbols (&objfile, lookup_name, domain, global, data);
 
-      for (compunit_symtab *cu : objfile->compunits ())
+      for (compunit_symtab *cu : objfile.compunits ())
        {
          const struct block *global_block
            = cu->blockvector ()->global_block ();
@@ -5605,8 +5605,8 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
       std::string bracket_name = std::string ("<_ada_") + name + '>';
       lookup_name_info name1 (bracket_name, symbol_name_match_type::FULL);
 
-      for (objfile *objfile : current_program_space->objfiles ())
-       map_matching_symbols (objfile, name1, domain, global, data);
+      for (objfile &objfile : current_program_space->objfiles ())
+       map_matching_symbols (&objfile, name1, domain, global, data);
     }
 }
 
@@ -13053,16 +13053,16 @@ ada_add_standard_exceptions (compiled_regex *preg,
          /* Iterate over all objfiles irrespective of scope or linker
             namespaces so we get all exceptions anywhere in the
             progspace.  */
-         for (objfile *objfile : current_program_space->objfiles ())
+         for (objfile &objfile : current_program_space->objfiles ())
            {
-             for (minimal_symbol *msymbol : objfile->msymbols ())
+             for (minimal_symbol *msymbol : objfile.msymbols ())
                {
                  if (match_name (msymbol->linkage_name (), lookup_name,
                                  nullptr)
                      && msymbol->type () != mst_solib_trampoline)
                    {
                      ada_exc_info info
-                       = {name, msymbol->value_address (objfile)};
+                       = {name, msymbol->value_address (&objfile)};
 
                      exceptions->push_back (info);
                    }
@@ -13146,7 +13146,7 @@ ada_add_global_exceptions (compiled_regex *preg,
 
   /* Iterate over all objfiles irrespective of scope or linker namespaces
      so we get all exceptions anywhere in the progspace.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       auto callback = [&] (compunit_symtab *s)
        {
@@ -13175,7 +13175,7 @@ ada_add_global_exceptions (compiled_regex *preg,
         the regular expression used to do the matching refers to the
         natural name.  So match against the decoded name.  */
       auto any = lookup_name_info::match_any ();
-      objfile->search
+      objfile.search
        (nullptr,
         &any,
         [&] (const char *search_name)
@@ -13709,9 +13709,9 @@ public:
        anything that isn't a text symbol (everything else will be
        handled by the psymtab code above).  */
 
-    for (objfile *objfile : current_program_space->objfiles ())
+    for (objfile &objfile : current_program_space->objfiles ())
       {
-       for (minimal_symbol *msymbol : objfile->msymbols ())
+       for (minimal_symbol *msymbol : objfile.msymbols ())
          {
            QUIT;
 
@@ -13767,7 +13767,7 @@ public:
     /* Go through the symtabs and check the externs and statics for
        symbols which match.  */
 
-    for (objfile *objfile : current_program_space->objfiles ())
+    for (objfile &objfile : current_program_space->objfiles ())
       {
        auto callback = [&] (compunit_symtab *s)
          {
@@ -13795,7 +13795,7 @@ public:
            return true;
          };
 
-       objfile->search
+       objfile.search
          (nullptr, &lookup_name, nullptr, callback,
           SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
           SEARCH_ALL_DOMAINS);
index dd3a557f2d1474399b8033949e49417e696ef41d..c01f5324d9583974082d7122ec186fa743ae0dd2 100644 (file)
@@ -52,8 +52,8 @@ set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
     {
       /* Since the setting was off, we may not have observed the objfiles and
         therefore not looked up the required symbols.  Do so now.  */
-      for (objfile *objfile : current_program_space->objfiles ())
-       if (agent_look_up_symbols (objfile) == 0)
+      for (objfile &objfile : current_program_space->objfiles ())
+       if (agent_look_up_symbols (&objfile) == 0)
          break;
     }
   if (target_use_agent (can_use) == 0)
index 6dba1dc2ca6a224d40003af5876f58c3bfa46393..6ee0cde10dfee69ac97a7e23fff5835ebb64ecce 100644 (file)
@@ -3664,13 +3664,13 @@ create_overlay_event_breakpoint (void)
 {
   const char *const func_name = "_ovly_debug_event";
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       struct breakpoint *b;
       struct breakpoint_objfile_data *bp_objfile_data;
       CORE_ADDR addr;
 
-      bp_objfile_data = get_breakpoint_objfile_data (objfile);
+      bp_objfile_data = get_breakpoint_objfile_data (&objfile);
 
       if (msym_not_found_p (bp_objfile_data->overlay_msym.minsym))
        continue;
@@ -3679,7 +3679,7 @@ create_overlay_event_breakpoint (void)
        {
          bound_minimal_symbol m
            = lookup_minimal_symbol_text (current_program_space, func_name,
-                                         objfile);
+                                         &objfile);
          if (m.minsym == NULL)
            {
              /* Avoid future lookups in this objfile.  */
@@ -3690,7 +3690,7 @@ create_overlay_event_breakpoint (void)
        }
 
       addr = bp_objfile_data->overlay_msym.value_address ();
-      b = create_internal_breakpoint (objfile->arch (), addr,
+      b = create_internal_breakpoint (objfile.arch (), addr,
                                      bp_overlay_event);
       b->locspec = new_explicit_location_spec_function (func_name);
 
@@ -3815,19 +3815,19 @@ create_longjmp_master_breakpoint (void)
     {
       set_current_program_space (pspace);
 
-      for (objfile *obj : pspace->objfiles ())
+      for (objfile &obj : pspace->objfiles ())
        {
          /* Skip separate debug object, it's handled in the loop below.  */
-         if (obj->separate_debug_objfile_backlink != nullptr)
+         if (obj.separate_debug_objfile_backlink != nullptr)
            continue;
 
          /* Try a probe kind breakpoint on main objfile.  */
-         if (create_longjmp_master_breakpoint_probe (obj))
+         if (create_longjmp_master_breakpoint_probe (&obj))
            continue;
 
          /* Try longjmp_names kind breakpoints on main and separate_debug
             objfiles.  */
-         for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+         for (objfile *debug_objfile : obj.separate_debug_objfiles ())
            if (create_longjmp_master_breakpoint_names (debug_objfile))
              break;
        }
@@ -3847,12 +3847,12 @@ create_std_terminate_master_breakpoint (void)
     {
       set_current_program_space (pspace);
 
-      for (objfile *objfile : pspace->objfiles ())
+      for (objfile &objfile : pspace->objfiles ())
        {
          struct breakpoint *b;
          struct breakpoint_objfile_data *bp_objfile_data;
 
-         bp_objfile_data = get_breakpoint_objfile_data (objfile);
+         bp_objfile_data = get_breakpoint_objfile_data (&objfile);
 
          if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym))
            continue;
@@ -3861,7 +3861,7 @@ create_std_terminate_master_breakpoint (void)
            {
              bound_minimal_symbol m
                = lookup_minimal_symbol (current_program_space, func_name,
-                                        objfile);
+                                        &objfile);
              if (m.minsym == NULL || (m.minsym->type () != mst_text
                                       && m.minsym->type () != mst_file_text))
                {
@@ -3872,7 +3872,7 @@ create_std_terminate_master_breakpoint (void)
              bp_objfile_data->terminate_msym = m;
            }
 
-         b = create_internal_breakpoint (objfile->arch (),
+         b = create_internal_breakpoint (objfile.arch (),
                                          bp_objfile_data->terminate_msym,
                                          bp_std_terminate_master);
          b->locspec = new_explicit_location_spec_function (func_name);
@@ -3976,19 +3976,19 @@ create_exception_master_breakpoint_hook (objfile *objfile)
 static void
 create_exception_master_breakpoint (void)
 {
-  for (objfile *obj : current_program_space->objfiles ())
+  for (objfile &obj : current_program_space->objfiles ())
     {
       /* Skip separate debug object.  */
-      if (obj->separate_debug_objfile_backlink)
+      if (obj.separate_debug_objfile_backlink)
        continue;
 
       /* Try a probe kind breakpoint.  */
-      if (create_exception_master_breakpoint_probe (obj))
+      if (create_exception_master_breakpoint_probe (&obj))
        continue;
 
       /* Iterate over main and separate debug objects and try an
         _Unwind_DebugHook kind breakpoint.  */
-      for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+      for (objfile *debug_objfile : obj.separate_debug_objfiles ())
        if (create_exception_master_breakpoint_hook (debug_objfile))
          break;
     }
index 7a37285884ea9a95b778cace301450d3cedec442..8d0d59fb5671685ffa625e0b01d4914cb36e4da4 100644 (file)
@@ -1619,18 +1619,18 @@ set_comp_unit (struct objfile *objfile, struct comp_unit *unit)
 static struct dwarf2_fde *
 dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
 {
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       CORE_ADDR offset;
 
-      if (objfile->obfd == nullptr)
+      if (objfile.obfd == nullptr)
        continue;
 
-      comp_unit *unit = find_comp_unit (objfile);
+      comp_unit *unit = find_comp_unit (&objfile);
       if (unit == NULL)
        {
-         dwarf2_build_frame_info (objfile);
-         unit = find_comp_unit (objfile);
+         dwarf2_build_frame_info (&objfile);
+         unit = find_comp_unit (&objfile);
        }
       gdb_assert (unit != NULL);
 
@@ -1638,8 +1638,8 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
       if (fde_table->empty ())
        continue;
 
-      gdb_assert (!objfile->section_offsets.empty ());
-      offset = objfile->text_section_offset ();
+      gdb_assert (!objfile.section_offsets.empty ());
+      offset = objfile.text_section_offset ();
 
       gdb_assert (!fde_table->empty ());
       unrelocated_addr seek_pc = (unrelocated_addr) (*pc - offset);
@@ -1652,7 +1652,7 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
        {
          *pc = (CORE_ADDR) (*it)->initial_location + offset;
          if (out_per_objfile != nullptr)
-           *out_per_objfile = get_dwarf2_per_objfile (objfile);
+           *out_per_objfile = get_dwarf2_per_objfile (&objfile);
 
          return *it;
        }
index 37e66a59c16defff696e588030792f39b5f074d4..52131bef2167c5df41b23c2795a5784d3e1f31b7 100644 (file)
@@ -1767,19 +1767,19 @@ save_gdb_index_command (const char *args, int from_tty)
   dw_index_kind index_kind
     = (opts.dwarf_5 ? dw_index_kind::DEBUG_NAMES : dw_index_kind::GDB_INDEX);
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       /* If the objfile does not correspond to an actual file, skip it.  */
-      if ((objfile->flags & OBJF_NOT_FILENAME) != 0)
+      if ((objfile.flags & OBJF_NOT_FILENAME) != 0)
        continue;
 
-      dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+      dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (&objfile);
 
       if (per_objfile != NULL)
        {
          try
            {
-             const char *basename = lbasename (objfile_name (objfile));
+             const char *basename = lbasename (objfile_name (&objfile));
              const dwz_file *dwz = per_objfile->per_bfd->get_dwz_file ();
              const char *dwz_basename = NULL;
 
@@ -1793,7 +1793,7 @@ save_gdb_index_command (const char *args, int from_tty)
            {
              exception_fprintf (gdb_stderr, except,
                                 _("Error while writing index for `%s': "),
-                                objfile_name (objfile));
+                                objfile_name (&objfile));
            }
        }
 
index b42df8395fd93ed16391a3c6c0b386f56264d0ad..e015f448a103457e13739f517c16e7722feb179f 100644 (file)
@@ -424,10 +424,10 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, bool read,
       /* See if this region of memory lies inside a known file on disk.
         If so, we can avoid copying its contents by clearing SEC_LOAD.  */
 
-      for (objfile *objfile : current_program_space->objfiles ())
-       for (obj_section &objsec : objfile->sections ())
+      for (objfile &objfile : current_program_space->objfiles ())
+       for (obj_section &objsec : objfile.sections ())
          {
-           bfd *abfd = objfile->obfd.get ();
+           bfd *abfd = objfile.obfd.get ();
            asection *asec = objsec.the_bfd_section;
            bfd_vma align = (bfd_vma) 1 << bfd_section_alignment (asec);
            bfd_vma start = objsec.addr () & -align;
@@ -440,7 +440,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, bool read,
 
               This BFD was synthesized from reading target memory,
               we don't want to omit that.  */
-           if (objfile->separate_debug_objfile_backlink == NULL
+           if (objfile.separate_debug_objfile_backlink == NULL
                && ((vaddr >= start && vaddr + size <= end)
                    || (start >= vaddr && end <= vaddr + size))
                && !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
@@ -532,14 +532,14 @@ objfile_find_memory_regions (struct target_ops *self,
   bfd_vma temp_bottom = 0, temp_top = 0;
 
   /* Call callback function for each objfile section.  */
-  for (objfile *objfile : current_program_space->objfiles ())
-    for (obj_section &objsec : objfile->sections ())
+  for (objfile &objfile : current_program_space->objfiles ())
+    for (obj_section &objsec : objfile.sections ())
       {
        asection *isec = objsec.the_bfd_section;
        flagword flags = bfd_section_flags (isec);
 
        /* Separate debug info files are irrelevant for gcore.  */
-       if (objfile->separate_debug_objfile_backlink != NULL)
+       if (objfile.separate_debug_objfile_backlink != NULL)
          continue;
 
        if ((flags & SEC_ALLOC) || (flags & SEC_LOAD))
index b15a4f909b5746c4a05fc775459a2748da68631c..35477d8015d44615c1a38d073bbf3652435eb221 100644 (file)
@@ -353,9 +353,9 @@ gdbscm_objfiles (void)
 
   result = SCM_EOL;
 
-  for (objfile *objf : current_program_space->objfiles ())
+  for (objfile &objf : current_program_space->objfiles ())
     {
-      SCM item = ofscm_scm_from_objfile (objf);
+      SCM item = ofscm_scm_from_objfile (&objf);
 
       result = scm_cons (item, result);
     }
index c4bb052a204bf265bf313104b43c4d4930066c35..95a663704c83699703c3dd866acfa545238d78f7 100644 (file)
@@ -427,9 +427,9 @@ ppscm_search_pp_list (SCM list, SCM value)
 static SCM
 ppscm_find_pretty_printer_from_objfiles (SCM value)
 {
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile);
+      objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (&objfile);
       SCM pp
        = ppscm_search_pp_list (ofscm_objfile_smob_pretty_printers (o_smob),
                                value);
index 757d66d0ab00c564d91e7a15900f751ca58a45fc..06936a8d2c28e6a52f4139ac6092f3f653d71c1c 100644 (file)
@@ -277,11 +277,11 @@ gdbscm_progspace_objfiles (SCM self)
 
   result = SCM_EOL;
 
-  for (objfile *objfile : p_smob->pspace->objfiles ())
+  for (objfile &objfile : p_smob->pspace->objfiles ())
     {
-      if (objfile->separate_debug_objfile_backlink == NULL)
+      if (objfile.separate_debug_objfile_backlink == NULL)
        {
-         SCM item = ofscm_scm_from_objfile (objfile);
+         SCM item = ofscm_scm_from_objfile (&objfile);
 
          result = scm_cons (item, result);
        }
index 6f0cebe6d95a518de9090cde94859ffe8d151e15..acd002863b31bd2d636279aa753c62ae83eaa02e 100644 (file)
@@ -487,18 +487,18 @@ find_unwind_entry (CORE_ADDR pc)
       return NULL;
     }
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       struct hppa_unwind_info *ui;
       ui = NULL;
-      struct hppa_objfile_private *priv = hppa_objfile_priv_data.get (objfile);
+      struct hppa_objfile_private *priv = hppa_objfile_priv_data.get (&objfile);
       if (priv)
        ui = priv->unwind_info;
 
       if (!ui)
        {
-         read_unwind_info (objfile);
-         priv = hppa_objfile_priv_data.get (objfile);
+         read_unwind_info (&objfile);
+         priv = hppa_objfile_priv_data.get (&objfile);
          if (priv == NULL)
            error (_("Internal error reading unwind information."));
          ui = priv->unwind_info;
index 6cf29867565afd12860e2e022633b24daa4e5a29..370973a652f513c0cb751772241a2ac793ec4a58 100644 (file)
@@ -2861,13 +2861,13 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
   if (!libunwind_is_initialized ())
     return -UNW_ENOINFO;
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       void *buf = NULL;
 
-      text_sec = objfile->sections + SECT_OFF_TEXT (objfile);
+      text_sec = objfile.sections + SECT_OFF_TEXT ((&objfile));
       ip = text_sec->addr ();
-      ret = ia64_find_unwind_table (objfile, ip, &di, &buf);
+      ret = ia64_find_unwind_table (&objfile, ip, &di, &buf);
       if (ret >= 0)
        {
          addr = libunwind_find_dyn_list (as, &di, arg);
@@ -2880,7 +2880,7 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
                gdb_printf (gdb_stdlog,
                            "dynamic unwind table in objfile %s "
                            "at %s (gp=%s)\n",
-                           bfd_get_filename (objfile->obfd),
+                           bfd_get_filename (objfile.obfd),
                            hex_string (addr), hex_string (di.gp));
              *dilap = addr;
              return 0;
index b105697b9b7c333b7a744f37516fd34b89bfe7ac..a1e41fc2ac749ca75efd515b72b5c457b6629af9 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -80,9 +80,9 @@ maint_info_jit_cmd (const char *args, int from_tty)
   std::optional<ui_out_emit_table> table_emitter;
 
   /* Print a line for each JIT-ed objfile.  */
-  for (objfile *obj : inf->pspace->objfiles ())
+  for (objfile &obj : inf->pspace->objfiles ())
     {
-      if (obj->jited_data == nullptr)
+      if (obj.jited_data == nullptr)
        continue;
 
       if (!printed_header)
@@ -91,7 +91,7 @@ maint_info_jit_cmd (const char *args, int from_tty)
 
          /* The +2 allows for the leading '0x', then one character for
             every 4-bits.  */
-         int addr_width = 2 + (gdbarch_ptr_bit (obj->arch ()) / 4);
+         int addr_width = 2 + (gdbarch_ptr_bit (obj.arch ()) / 4);
 
          /* The std::max here selects between the width of an address (as
             a string) and the width of the column header string.  */
@@ -109,12 +109,12 @@ maint_info_jit_cmd (const char *args, int from_tty)
 
       ui_out_emit_tuple tuple_emitter (current_uiout, "jit-objfile");
 
-      current_uiout->field_core_addr ("jit_code_entry-address", obj->arch (),
-                                     obj->jited_data->addr);
-      current_uiout->field_core_addr ("symfile-address", obj->arch (),
-                                     obj->jited_data->symfile_addr);
+      current_uiout->field_core_addr ("jit_code_entry-address", obj.arch (),
+                                     obj.jited_data->addr);
+      current_uiout->field_core_addr ("symfile-address", obj.arch (),
+                                     obj.jited_data->symfile_addr);
       current_uiout->field_unsigned ("symfile-size",
-                                     obj->jited_data->symfile_size);
+                                     obj.jited_data->symfile_size);
       current_uiout->text ("\n");
     }
 }
@@ -833,10 +833,10 @@ jit_register_code (struct gdbarch *gdbarch,
 static struct objfile *
 jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
 {
-  for (objfile *objf : current_program_space->objfiles ())
+  for (objfile &objf : current_program_space->objfiles ())
     {
-      if (objf->jited_data != nullptr && objf->jited_data->addr == entry_addr)
-       return objf;
+      if (objf.jited_data != nullptr && objf.jited_data->addr == entry_addr)
+       return &objf;
     }
 
   return NULL;
@@ -853,9 +853,9 @@ jit_breakpoint_deleted (struct breakpoint *b)
 
   for (bp_location &iter : b->locations ())
     {
-      for (objfile *objf : iter.pspace->objfiles ())
+      for (objfile &objf : iter.pspace->objfiles ())
        {
-         jiter_objfile_data *jiter_data = objf->jiter_data.get ();
+         jiter_objfile_data *jiter_data = objf.jiter_data.get ();
 
          if (jiter_data != nullptr
              && jiter_data->jit_breakpoint == iter.owner)
@@ -873,44 +873,44 @@ jit_breakpoint_deleted (struct breakpoint *b)
 static void
 jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
 {
-  for (objfile *the_objfile : pspace->objfiles ())
+  for (objfile &the_objfile : pspace->objfiles ())
     {
       /* Skip separate debug objects.  */
-      if (the_objfile->separate_debug_objfile_backlink != nullptr)
+      if (the_objfile.separate_debug_objfile_backlink != nullptr)
        continue;
 
-      if (the_objfile->skip_jit_symbol_lookup)
+      if (the_objfile.skip_jit_symbol_lookup)
        continue;
 
       /* Lookup the registration symbol.  If it is missing, then we
         assume we are not attached to a JIT.  */
       bound_minimal_symbol reg_symbol
-       = lookup_minimal_symbol_text (pspace, jit_break_name, the_objfile);
+       = lookup_minimal_symbol_text (pspace, jit_break_name, &the_objfile);
       if (reg_symbol.minsym == NULL
          || reg_symbol.value_address () == 0)
        {
          /* No need to repeat the lookup the next time.  */
-         the_objfile->skip_jit_symbol_lookup = true;
+         the_objfile.skip_jit_symbol_lookup = true;
          continue;
        }
 
       bound_minimal_symbol desc_symbol
        = lookup_minimal_symbol_linkage (jit_descriptor_name,
-                                        the_objfile, true);
+                                        &the_objfile, true);
       if (desc_symbol.minsym == NULL
          || desc_symbol.value_address () == 0)
        {
          /* No need to repeat the lookup the next time.  */
-         the_objfile->skip_jit_symbol_lookup = true;
+         the_objfile.skip_jit_symbol_lookup = true;
          continue;
        }
 
       jiter_objfile_data *objf_data
-       = get_jiter_objfile_data (the_objfile);
+       = get_jiter_objfile_data (&the_objfile);
       objf_data->register_code = reg_symbol.minsym;
       objf_data->descriptor = desc_symbol.minsym;
 
-      CORE_ADDR addr = objf_data->register_code->value_address (the_objfile);
+      CORE_ADDR addr = objf_data->register_code->value_address (&the_objfile);
       jit_debug_printf ("breakpoint_addr = %s", paddress (gdbarch, addr));
 
       /* Check if we need to re-create the breakpoint.  */
@@ -1176,14 +1176,14 @@ jit_inferior_init (inferior *inf)
 
   jit_breakpoint_re_set_internal (gdbarch, pspace);
 
-  for (objfile *jiter : pspace->objfiles ())
+  for (objfile &jiter : pspace->objfiles ())
     {
-      if (jiter->jiter_data == nullptr)
+      if (jiter.jiter_data == nullptr)
        continue;
 
       /* Read the descriptor so we can check the version number and load
         any already JITed functions.  */
-      if (!jit_read_descriptor (gdbarch, &descriptor, jiter))
+      if (!jit_read_descriptor (gdbarch, &descriptor, &jiter))
        continue;
 
       /* Check that the version number agrees with that we support.  */
@@ -1248,10 +1248,10 @@ jit_breakpoint_re_set (void)
 static void
 jit_inferior_exit_hook (struct inferior *inf)
 {
-  for (objfile *objf : current_program_space->objfiles_safe ())
+  for (objfile &objf : current_program_space->objfiles_safe ())
     {
-      if (objf->jited_data != nullptr && objf->jited_data->addr != 0)
-       objf->unlink ();
+      if (objf.jited_data != nullptr && objf.jited_data->addr != 0)
+       objf.unlink ();
     }
 }
 
index 2ddc495babf76ee1c8f6d9ed868212eddc88f52e..bc14a21640ab20c970864b2e037bc909d4bdcd06 100644 (file)
@@ -1137,7 +1137,7 @@ iterate_over_all_matching_symtabs
 
       set_current_program_space (pspace);
 
-      for (objfile *objfile : pspace->objfiles ())
+      for (objfile &objfile : pspace->objfiles ())
        {
          auto expand_callback = [&] (compunit_symtab *cu)
            {
@@ -1170,8 +1170,8 @@ iterate_over_all_matching_symtabs
              return true;
            };
 
-         objfile->search (nullptr, &lookup_name, nullptr, expand_callback,
-                          SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, domain);
+         objfile.search (nullptr, &lookup_name, nullptr, expand_callback,
+                         SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, domain);
        }
     }
 }
@@ -4176,12 +4176,12 @@ search_minsyms_for_name (struct collect_info *info,
 
          set_current_program_space (pspace);
 
-         for (objfile *objfile : pspace->objfiles ())
+         for (objfile &objfile : pspace->objfiles ())
            {
-             iterate_over_minimal_symbols (objfile, name,
+             iterate_over_minimal_symbols (&objfile, name,
                                            [&] (struct minimal_symbol *msym)
                                            {
-                                             add_minsym (msym, objfile, nullptr,
+                                             add_minsym (msym, &objfile, nullptr,
                                                          info->state->list_mode,
                                                          &minsyms);
                                              return false;
index d30b25f4d1964b1c08a59bffecc26e126c6f69b1..63e4c69c9817d3bbda23d4d53eb790522db3df02 100644 (file)
@@ -1074,17 +1074,17 @@ try_thread_db_load_from_pdir (const char *subdir)
   if (!auto_load_thread_db)
     return false;
 
-  for (objfile *obj : current_program_space->objfiles ())
-    if (libpthread_objfile_p (obj))
+  for (objfile &obj : current_program_space->objfiles ())
+    if (libpthread_objfile_p (&obj))
       {
-       if (try_thread_db_load_from_pdir_1 (obj, subdir))
+       if (try_thread_db_load_from_pdir_1 (&obj, subdir))
          return true;
 
        /* We may have found the separate-debug-info version of
           libpthread, and it may live in a directory without a matching
           libthread_db.  */
-       if (obj->separate_debug_objfile_backlink != NULL)
-         return try_thread_db_load_from_pdir_1 (obj->separate_debug_objfile_backlink,
+       if (obj.separate_debug_objfile_backlink != NULL)
+         return try_thread_db_load_from_pdir_1 (obj.separate_debug_objfile_backlink,
                                                 subdir);
 
        return false;
@@ -1183,8 +1183,8 @@ thread_db_load_search (void)
 static bool
 has_libpthread (void)
 {
-  for (objfile *obj : current_program_space->objfiles ())
-    if (libpthread_objfile_p (obj))
+  for (objfile &obj : current_program_space->objfiles ())
+    if (libpthread_objfile_p (&obj))
       return true;
 
   return false;
index 3d56a31eb0c1d38cba0a7aafb16402088195a08f..3b861fb3e61e6514fe43c6b6585b610f031952f9 100644 (file)
@@ -1342,8 +1342,8 @@ captured_main_1 (struct captured_main_args *context)
      We wait until now because it is common to add to the source search
      path in local_gdbinit.  */
   global_auto_load = save_auto_load;
-  for (objfile *objfile : current_program_space->objfiles ())
-    load_auto_scripts_for_objfile (objfile);
+  for (objfile &objfile : current_program_space->objfiles ())
+    load_auto_scripts_for_objfile (&objfile);
 
   /* Process '-x' and '-ex' options.  */
   execute_cmdargs (&cmdarg_vec, CMDARG_FILE, CMDARG_COMMAND, &ret);
index 8bc28562d1006af276643657749702939116cc3c..ca7648f1030df4ac20556b179db163e91232e641 100644 (file)
@@ -464,14 +464,14 @@ maintenance_info_sections (const char *arg, int from_tty)
   gdb::option::process_options
     (&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
 
-  for (objfile *ofile : current_program_space->objfiles ())
+  for (objfile &ofile : current_program_space->objfiles ())
     {
-      if (ofile->obfd == current_program_space->exec_bfd ())
-       maint_print_all_sections (_("Exec file: "), ofile->obfd.get (),
-                                 ofile, arg);
+      if (ofile.obfd == current_program_space->exec_bfd ())
+       maint_print_all_sections (_("Exec file: "), ofile.obfd.get (),
+                                 &ofile, arg);
       else if (opts.all_objects)
-       maint_print_all_sections (_("Object file: "), ofile->obfd.get (),
-                                 ofile, arg);
+       maint_print_all_sections (_("Object file: "), ofile.obfd.get (),
+                                 &ofile, arg);
     }
 
   if (current_program_space->core_bfd () != nullptr)
@@ -580,8 +580,8 @@ maintenance_translate_address (const char *arg, int from_tty)
       int arg_len = p - arg;
       p = skip_spaces (p + 1);
 
-      for (objfile *objfile : current_program_space->objfiles ())
-       for (obj_section &iter : objfile->sections ())
+      for (objfile &objfile : current_program_space->objfiles ())
+       for (obj_section &iter : objfile.sections ())
          {
            if (strncmp (iter.the_bfd_section->name, arg, arg_len) == 0)
              goto found;
@@ -969,9 +969,9 @@ count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_compunit_symtabs_ptr,
      current_program_space may be NULL.  */
   if (current_program_space != NULL)
     {
-      for (objfile *o : current_program_space->objfiles ())
+      for (objfile &o : current_program_space->objfiles ())
        {
-         for (compunit_symtab *cu : o->compunits ())
+         for (compunit_symtab *cu : o.compunits ())
            {
              ++nr_compunit_symtabs;
              nr_blocks += cu->blockvector ()->num_blocks ();
index c23d170663744a03bda2a7ccec7e3a0763aace60..194a016033d8bfe89e4a9fa3396b509215168033 100644 (file)
@@ -372,23 +372,23 @@ lookup_minimal_symbol (program_space *pspace, const char *name, objfile *objf,
 
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
-  for (objfile *objfile : pspace->objfiles ())
+  for (objfile &objfile : pspace->objfiles ())
     {
       if (found.external_symbol.minsym != NULL)
        break;
 
-      if (objf == NULL || objf == objfile
-         || objf == objfile->separate_debug_objfile_backlink)
+      if (objf == NULL || objf == &objfile
+         || objf == objfile.separate_debug_objfile_backlink)
        {
          symbol_lookup_debug_printf ("lookup_minimal_symbol (%s, %s, %s, %s)",
                                      host_address_to_string (pspace),
                                      name, sfile != NULL ? sfile : "NULL",
-                                     objfile_debug_name (objfile));
+                                     objfile_debug_name (&objfile));
 
          /* Do two passes: the first over the ordinary hash table,
             and the second over the demangled hash table.  */
-         lookup_minimal_symbol_mangled (name, sfile, objfile,
-                                        objfile->per_bfd->msymbol_hash,
+         lookup_minimal_symbol_mangled (name, sfile, &objfile,
+                                        objfile.per_bfd->msymbol_hash,
                                         mangled_hash, mangled_cmp, found);
 
          /* If not found, try the demangled hash table.  */
@@ -398,7 +398,7 @@ lookup_minimal_symbol (program_space *pspace, const char *name, objfile *objf,
                 table (usually just zero or one languages).  */
              for (unsigned iter = 0; iter < nr_languages; ++iter)
                {
-                 if (!objfile->per_bfd->demangled_hash_languages.test (iter))
+                 if (!objfile.per_bfd->demangled_hash_languages.test (iter))
                    continue;
                  enum language lang = (enum language) iter;
 
@@ -410,9 +410,9 @@ lookup_minimal_symbol (program_space *pspace, const char *name, objfile *objf,
                    = language_def (lang)->get_symbol_name_matcher
                                                        (lookup_name);
                  struct minimal_symbol **msymbol_demangled_hash
-                   = objfile->per_bfd->msymbol_demangled_hash;
+                   = objfile.per_bfd->msymbol_demangled_hash;
 
-                 lookup_minimal_symbol_demangled (lookup_name, sfile, objfile,
+                 lookup_minimal_symbol_demangled (lookup_name, sfile, &objfile,
                                                   msymbol_demangled_hash,
                                                   hash, match, found);
 
@@ -587,16 +587,16 @@ bound_minimal_symbol
 lookup_minimal_symbol_linkage (program_space *pspace, const char *name,
                               bool match_static_type, bool only_main)
 {
-  for (objfile *objfile : pspace->objfiles ())
+  for (objfile &objfile : pspace->objfiles ())
     {
-      if (objfile->separate_debug_objfile_backlink != nullptr)
+      if (objfile.separate_debug_objfile_backlink != nullptr)
        continue;
 
-      if (only_main && (objfile->flags & OBJF_MAINLINE) == 0)
+      if (only_main && (objfile.flags & OBJF_MAINLINE) == 0)
        continue;
 
       bound_minimal_symbol minsym
-       = lookup_minimal_symbol_linkage (name, objfile, match_static_type);
+       = lookup_minimal_symbol_linkage (name, &objfile, match_static_type);
       if (minsym.minsym != nullptr)
        return minsym;
     }
@@ -644,11 +644,11 @@ lookup_minimal_symbol_text (program_space *pspace, const char *name,
 
   if (objf == nullptr)
     {
-      for (objfile *objfile : pspace->objfiles ())
+      for (objfile &objfile : pspace->objfiles ())
        {
          if (found_symbol.minsym != NULL)
            break;
-         search (objfile);
+         search (&objfile);
        }
     }
   else
@@ -679,16 +679,16 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
 
   unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      if (objf == NULL || objf == objfile
-         || objf == objfile->separate_debug_objfile_backlink)
+      if (objf == NULL || objf == &objfile
+         || objf == objfile.separate_debug_objfile_backlink)
        {
-         for (msymbol = objfile->per_bfd->msymbol_hash[hash];
+         for (msymbol = objfile.per_bfd->msymbol_hash[hash];
               msymbol != NULL;
               msymbol = msymbol->hash_next)
            {
-             if (msymbol->value_address (objfile) == pc
+             if (msymbol->value_address (&objfile) == pc
                  && strcmp (msymbol->linkage_name (), name) == 0)
                return msymbol;
            }
@@ -1589,9 +1589,9 @@ find_solib_trampoline_target (const frame_info_ptr &frame, CORE_ADDR pc)
 
   if (tsymbol != NULL)
     {
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         for (minimal_symbol *msymbol : objfile->msymbols ())
+         for (minimal_symbol *msymbol : objfile.msymbols ())
            {
              /* Also handle minimal symbols pointing to function
                 descriptors.  */
@@ -1606,7 +1606,7 @@ find_solib_trampoline_target (const frame_info_ptr &frame, CORE_ADDR pc)
 
                  /* Ignore data symbols that are not function
                     descriptors.  */
-                 if (msymbol_is_function (objfile, msymbol, &func))
+                 if (msymbol_is_function (&objfile, msymbol, &func))
                    return func;
                }
            }
index 492020df8dcff0b6375215aadd10c2f95fd6ebaa..e70dc12e20117144a9b149dfa3f7c5bf6c3bbba0 100644 (file)
@@ -601,9 +601,9 @@ info_selectors_command (const char *regexp, int from_tty)
     }
 
   /* First time through is JUST to get max length and count.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      for (minimal_symbol *msymbol : objfile->msymbols ())
+      for (minimal_symbol *msymbol : objfile.msymbols ())
        {
          QUIT;
          name = msymbol->natural_name ();
@@ -641,9 +641,9 @@ info_selectors_command (const char *regexp, int from_tty)
 
       sym_arr = XALLOCAVEC (struct symbol *, matches);
       matches = 0;
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         for (minimal_symbol *msymbol : objfile->msymbols ())
+         for (minimal_symbol *msymbol : objfile.msymbols ())
            {
              QUIT;
              name = msymbol->natural_name ();
@@ -755,9 +755,9 @@ info_classes_command (const char *regexp, int from_tty)
     }
 
   /* First time through is JUST to get max length and count.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      for (minimal_symbol *msymbol : objfile->msymbols ())
+      for (minimal_symbol *msymbol : objfile.msymbols ())
        {
          QUIT;
          name = msymbol->natural_name ();
@@ -782,9 +782,9 @@ info_classes_command (const char *regexp, int from_tty)
                  regexp ? regexp : "*");
       sym_arr = XALLOCAVEC (struct symbol *, matches);
       matches = 0;
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         for (minimal_symbol *msymbol : objfile->msymbols ())
+         for (minimal_symbol *msymbol : objfile.msymbols ())
            {
              QUIT;
              name = msymbol->natural_name ();
@@ -988,7 +988,7 @@ find_methods (char type, const char *theclass, const char *category,
 
   gdb_assert (symbol_names != NULL);
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       unsigned int *objc_csym;
 
@@ -999,12 +999,12 @@ find_methods (char type, const char *theclass, const char *category,
 
       unsigned int objfile_csym = 0;
 
-      objc_csym = objc_objfile_data.get (objfile);
+      objc_csym = objc_objfile_data.get (&objfile);
       if (objc_csym != NULL && *objc_csym == 0)
        /* There are no ObjC symbols in this objfile.  Skip it entirely.  */
        continue;
 
-      for (minimal_symbol *msymbol : objfile->msymbols ())
+      for (minimal_symbol *msymbol : objfile.msymbols ())
        {
          QUIT;
 
@@ -1051,7 +1051,7 @@ find_methods (char type, const char *theclass, const char *category,
        }
 
       if (objc_csym == NULL)
-       objc_csym = objc_objfile_data.emplace (objfile, objfile_csym);
+       objc_csym = objc_objfile_data.emplace (&objfile, objfile_csym);
       else
        /* Count of ObjC methods in this objfile should be constant.  */
        gdb_assert (*objc_csym == objfile_csym);
index d0eb678f4512873d8c7bfd7172b8d92c443b5b83..18189efabb5a8a6fbe425773f11f94b5029a610b 100644 (file)
@@ -695,8 +695,8 @@ objfile::has_symbols ()
 bool
 have_partial_symbols (program_space *pspace)
 {
-  for (objfile *ofp : pspace->objfiles ())
-    if (ofp->has_partial_symbols ())
+  for (objfile &ofp : pspace->objfiles ())
+    if (ofp.has_partial_symbols ())
       return true;
 
   return false;
@@ -707,8 +707,8 @@ have_partial_symbols (program_space *pspace)
 bool
 have_full_symbols (program_space *pspace)
 {
-  for (objfile *ofp : pspace->objfiles ())
-    if (ofp->has_full_symbols ())
+  for (objfile &ofp : pspace->objfiles ())
+    if (ofp.has_full_symbols ())
       return true;
 
   return false;
@@ -720,13 +720,13 @@ have_full_symbols (program_space *pspace)
 void
 objfile_purge_solibs (program_space *pspace)
 {
-  for (objfile *objf : pspace->objfiles_safe ())
+  for (objfile &objf : pspace->objfiles_safe ())
     {
       /* We assume that the solib package has been purged already, or will
         be soon.  */
 
-      if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
-       objf->unlink ();
+      if (!(objf.flags & OBJF_USERLOADED) && (objf.flags & OBJF_SHARED))
+       objf.unlink ();
     }
 }
 
@@ -735,8 +735,8 @@ objfile_purge_solibs (program_space *pspace)
 bool
 have_minimal_symbols (program_space *pspace)
 {
-  for (objfile *ofp : pspace->objfiles ())
-    if (ofp->per_bfd->minimal_symbol_count > 0)
+  for (objfile &ofp : pspace->objfiles ())
+    if (ofp.per_bfd->minimal_symbol_count > 0)
       return true;
 
   return false;
@@ -803,10 +803,10 @@ sort_cmp (const struct obj_section *sect1, const obj_section *sect2)
        {
          /* Sort on sequence number of the objfile in the chain.  */
 
-         for (objfile *objfile : current_program_space->objfiles ())
-           if (objfile == objfile1)
+         for (objfile &objfile : current_program_space->objfiles ())
+           if (&objfile == objfile1)
              return true;
-           else if (objfile == objfile2)
+           else if (&objfile == objfile2)
              return false;
 
          /* We should have found one of the objfiles before getting here.  */
@@ -993,9 +993,9 @@ update_section_map (struct program_space *pspace,
   xfree (map);
 
   alloc_size = 0;
-  for (objfile *objfile : pspace->objfiles ())
-    for (obj_section &s : objfile->sections ())
-      if (insert_section_p (objfile->obfd.get (), s.the_bfd_section))
+  for (objfile &objfile : pspace->objfiles ())
+    for (obj_section &s : objfile.sections ())
+      if (insert_section_p (objfile.obfd.get (), s.the_bfd_section))
        alloc_size += 1;
 
   /* This happens on detach/attach (e.g. in gdb.base/attach.exp).  */
@@ -1009,9 +1009,9 @@ update_section_map (struct program_space *pspace,
   map = XNEWVEC (struct obj_section *, alloc_size);
 
   i = 0;
-  for (objfile *objfile : pspace->objfiles ())
-    for (obj_section &s : objfile->sections ())
-      if (insert_section_p (objfile->obfd.get (), s.the_bfd_section))
+  for (objfile &objfile : pspace->objfiles ())
+    for (obj_section &s : objfile.sections ())
+      if (insert_section_p (objfile.obfd.get (), s.the_bfd_section))
        map[i++] = &s;
 
   std::sort (map, map + alloc_size, sort_cmp);
@@ -1144,10 +1144,10 @@ bool
 shared_objfile_contains_address_p (struct program_space *pspace,
                                   CORE_ADDR address)
 {
-  for (objfile *objfile : pspace->objfiles ())
+  for (objfile &objfile : pspace->objfiles ())
     {
-      if ((objfile->flags & OBJF_SHARED) != 0
-         && is_addr_in_objfile (address, objfile))
+      if ((objfile.flags & OBJF_SHARED) != 0
+         && is_addr_in_objfile (address, &objfile))
        return true;
     }
 
index 661d721fe6f8f4550371d39bf2a8741848ee57ec..e27ccd05d4fbda32c7b531587001bcfddefe8a54 100644 (file)
@@ -1492,12 +1492,12 @@ info_symbol_command (const char *arg, int from_tty)
     error_no_arg (_("address"));
 
   addr = parse_and_eval_address (arg);
-  for (objfile *objfile : current_program_space->objfiles ())
-    for (obj_section &osect : objfile->sections ())
+  for (objfile &objfile : current_program_space->objfiles ())
+    for (obj_section &osect : objfile.sections ())
       {
        /* Only process each object file once, even if there's a separate
           debug file.  */
-       if (objfile->separate_debug_objfile_backlink)
+       if (objfile.separate_debug_objfile_backlink)
          continue;
 
        sect_addr = overlay_mapped_address (addr, &osect);
@@ -1511,7 +1511,7 @@ info_symbol_command (const char *arg, int from_tty)
            const char *loc_string;
 
            matches = 1;
-           offset = sect_addr - msymbol->value_address (objfile);
+           offset = sect_addr - msymbol->value_address (&objfile);
            mapped = section_is_mapped (&osect) ? _("mapped") : _("unmapped");
            sec_name = osect.the_bfd_section->name;
            msym_name = msymbol->print_name ();
index c2b8270a476be3fb421782ddc939a2b239ac0fe5..4533a08d38d32320edb5ed296be72b4b47c434b8 100644 (file)
@@ -71,19 +71,19 @@ parse_probes_in_pspace (const static_probe_ops *spops,
                        const char *name,
                        std::vector<symtab_and_line> *result)
 {
-  for (objfile *objfile : search_pspace->objfiles ())
+  for (objfile &objfile : search_pspace->objfiles ())
     {
-      if (!objfile->sf || !objfile->sf->sym_probe_fns)
+      if (!objfile.sf || !objfile.sf->sym_probe_fns)
        continue;
 
       if (objfile_namestr
-         && FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0
-         && FILENAME_CMP (lbasename (objfile_name (objfile)),
+         && FILENAME_CMP (objfile_name (&objfile), objfile_namestr) != 0
+         && FILENAME_CMP (lbasename (objfile_name (&objfile)),
                           objfile_namestr) != 0)
        continue;
 
       const std::vector<std::unique_ptr<probe>> &probes
-       = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+       = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
 
       for (auto &p : probes)
        {
@@ -97,12 +97,12 @@ parse_probes_in_pspace (const static_probe_ops *spops,
            continue;
 
          symtab_and_line sal;
-         sal.pc = p->get_relocated_address (objfile);
+         sal.pc = p->get_relocated_address (&objfile);
          sal.explicit_pc = 1;
          sal.section = find_pc_overlay (sal.pc);
          sal.pspace = search_pspace;
          sal.prob = p.get ();
-         sal.objfile = objfile;
+         sal.objfile = &objfile;
 
          result->push_back (std::move (sal));
        }
@@ -245,19 +245,19 @@ find_probe_by_pc (CORE_ADDR pc)
   result.objfile = NULL;
   result.prob = NULL;
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      if (!objfile->sf || !objfile->sf->sym_probe_fns
-         || objfile->sect_index_text == -1)
+      if (!objfile.sf || !objfile.sf->sym_probe_fns
+         || objfile.sect_index_text == -1)
        continue;
 
       /* If this proves too inefficient, we can replace with a hash.  */
       const std::vector<std::unique_ptr<probe>> &probes
-       = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+       = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
       for (auto &p : probes)
-       if (p->get_relocated_address (objfile) == pc)
+       if (p->get_relocated_address (&objfile) == pc)
          {
-           result.objfile = objfile;
+           result.objfile = &objfile;
            result.prob = p.get ();
            return result;
          }
@@ -290,19 +290,19 @@ collect_probes (const std::string &objname, const std::string &provider,
     obj_pat.emplace (objname.c_str (), REG_NOSUB,
                     _("Invalid object file regexp"));
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      if (! objfile->sf || ! objfile->sf->sym_probe_fns)
+      if (! objfile.sf || ! objfile.sf->sym_probe_fns)
        continue;
 
       if (obj_pat)
        {
-         if (obj_pat->exec (objfile_name (objfile), 0, NULL, 0) != 0)
+         if (obj_pat->exec (objfile_name (&objfile), 0, NULL, 0) != 0)
            continue;
        }
 
       const std::vector<std::unique_ptr<probe>> &probes
-       = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+       = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
 
       for (auto &p : probes)
        {
@@ -317,7 +317,7 @@ collect_probes (const std::string &objname, const std::string &provider,
              && probe_pat->exec (p->get_name ().c_str (), 0, NULL, 0) != 0)
            continue;
 
-         result.emplace_back (p.get (), objfile);
+         result.emplace_back (p.get (), &objfile);
        }
     }
 
index db8879a4121ce3b980aa9c8c6386639116977ac7..6ee0134f20b822da13f0e64ec82a0c89942ef85d 100644 (file)
@@ -153,8 +153,8 @@ program_space::iterate_over_objfiles_in_search_order
     return m_solib_ops->iterate_over_objfiles_in_search_order
       (cb, current_objfile);
 
-  for (const auto objfile : this->objfiles ())
-    if (cb (objfile))
+  for (auto &objfile : this->objfiles ())
+    if (cb (&objfile))
       return;
 }
 
@@ -197,13 +197,13 @@ program_space::remove_objfile (struct objfile *objfile)
 struct objfile *
 program_space::objfile_for_address (CORE_ADDR address)
 {
-  for (auto iter : objfiles ())
+  for (auto &iter : objfiles ())
     {
       /* Don't check separate debug objfiles.  */
-      if (iter->separate_debug_objfile_backlink != nullptr)
+      if (iter.separate_debug_objfile_backlink != nullptr)
        continue;
-      if (is_addr_in_objfile (address, iter))
-       return iter;
+      if (is_addr_in_objfile (address, &iter))
+       return &iter;
     }
   return nullptr;
 }
index 61e5211e857f8ee0d36c2791acf2cd681240539d..300cfae95a915031646b60ceca7fef89322cbe4d 100644 (file)
@@ -30,7 +30,6 @@
 #include "gdbsupport/owning_intrusive_list.h"
 #include "gdbsupport/refcounted-object.h"
 #include "gdbsupport/gdb_ref_ptr.h"
-#include "gdbsupport/reference-to-pointer-iterator.h"
 #include <vector>
 
 struct target_ops;
@@ -185,14 +184,13 @@ struct program_space
      a program space.  */
   ~program_space ();
 
-  using objfiles_iterator
-    = reference_to_pointer_iterator<intrusive_list<objfile>::iterator>;
+  using objfiles_iterator = intrusive_list<objfile>::iterator;
   using objfiles_range = iterator_range<objfiles_iterator>;
 
   /* Return an iterable object that can be used to iterate over all
      objfiles.  The basic use is in a foreach, like:
 
-     for (objfile *objf : pspace->objfiles ()) { ... }  */
+     for (objfile &objf : pspace->objfiles ()) { ... }  */
   objfiles_range objfiles ()
   {
     return objfiles_range (objfiles_iterator (m_objfiles_list.begin ()));
@@ -203,7 +201,7 @@ struct program_space
   /* An iterable object that can be used to iterate over all objfiles.
      The basic use is in a foreach, like:
 
-     for (objfile *objf : pspace->objfiles_safe ()) { ... }
+     for (objfile &objf : pspace->objfiles_safe ()) { ... }
 
      This variant uses a basic_safe_iterator so that objfiles can be
      deleted during iteration.  */
index 6d19e76639ba14f81e1c6c178d76997d848cf956..413212d25ed74d8c9a9423973afb55899ad2b978 100644 (file)
@@ -1259,7 +1259,7 @@ maintenance_print_psymbols (const char *args, int from_tty)
     }
 
   found = 0;
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       int printed_objfile_header = 0;
       int print_for_objfile = 1;
@@ -1267,12 +1267,12 @@ maintenance_print_psymbols (const char *args, int from_tty)
       QUIT;
       if (objfile_arg != NULL)
        print_for_objfile
-         = compare_filenames_for_search (objfile_name (objfile),
+         = compare_filenames_for_search (objfile_name (&objfile),
                                          objfile_arg);
       if (!print_for_objfile)
        continue;
 
-      for (const auto &iter : objfile->qf)
+      for (const auto &iter : objfile.qf)
        {
          psymbol_functions *psf
            = dynamic_cast<psymbol_functions *> (iter.get ());
@@ -1286,22 +1286,22 @@ maintenance_print_psymbols (const char *args, int from_tty)
              /* We don't assume each pc has a unique objfile (this is for
                 debugging).  */
              struct partial_symtab *ps
-               = psf->find_pc_sect_psymtab (objfile, pc, section, msymbol);
+               = psf->find_pc_sect_psymtab (&objfile, pc, section, msymbol);
              if (ps != NULL)
                {
                  if (!printed_objfile_header)
                    {
                      outfile->printf ("\nPartial symtabs for objfile %s\n",
-                                      objfile_name (objfile));
+                                      objfile_name (&objfile));
                      printed_objfile_header = 1;
                    }
-                 dump_psymtab (objfile, ps, outfile);
+                 dump_psymtab (&objfile, ps, outfile);
                  found = 1;
                }
            }
          else
            {
-             for (partial_symtab *ps : psf->partial_symbols (objfile))
+             for (partial_symtab *ps : psf->partial_symbols (&objfile))
                {
                  int print_for_source = 0;
 
@@ -1318,10 +1318,10 @@ maintenance_print_psymbols (const char *args, int from_tty)
                      if (!printed_objfile_header)
                        {
                          outfile->printf ("\nPartial symtabs for objfile %s\n",
-                                          objfile_name (objfile));
+                                          objfile_name (&objfile));
                          printed_objfile_header = 1;
                        }
-                     dump_psymtab (objfile, ps, outfile);
+                     dump_psymtab (&objfile, ps, outfile);
                    }
                }
            }
@@ -1346,21 +1346,21 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
     re_comp (regexp);
 
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
-       struct gdbarch *gdbarch = objfile->arch ();
+       struct gdbarch *gdbarch = objfile.arch ();
 
        /* We don't want to print anything for this objfile until we
           actually find a symtab whose name matches.  */
        int printed_objfile_start = 0;
 
-       for (const auto &iter : objfile->qf)
+       for (const auto &iter : objfile.qf)
          {
            psymbol_functions *psf
              = dynamic_cast<psymbol_functions *> (iter.get ());
            if (psf == nullptr)
              continue;
-           for (partial_symtab *psymtab : psf->partial_symbols (objfile))
+           for (partial_symtab *psymtab : psf->partial_symbols (&objfile))
              {
                QUIT;
 
@@ -1369,10 +1369,10 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
                  {
                    if (! printed_objfile_start)
                      {
-                       gdb_printf ("{ objfile %s ", objfile_name (objfile));
+                       gdb_printf ("{ objfile %s ", objfile_name (&objfile));
                        gdb_stdout->wrap_here (2);
                        gdb_printf ("((struct objfile *) %s)\n",
-                                   host_address_to_string (objfile));
+                                   host_address_to_string (&objfile));
                        printed_objfile_start = 1;
                      }
 
@@ -1382,16 +1382,16 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
                                host_address_to_string (psymtab));
 
                    gdb_printf ("    readin %s\n",
-                               psymtab->readin_p (objfile) ? "yes" : "no");
+                               psymtab->readin_p (&objfile) ? "yes" : "no");
                    gdb_printf ("    fullname %s\n",
                                psymtab->fullname
                                ? psymtab->fullname : "(null)");
                    gdb_printf ("    text addresses ");
                    gdb_puts (paddress (gdbarch,
-                                       psymtab->text_low (objfile)));
+                                       psymtab->text_low (&objfile)));
                    gdb_printf (" -- ");
                    gdb_puts (paddress (gdbarch,
-                                       psymtab->text_high (objfile)));
+                                       psymtab->text_high (&objfile)));
                    gdb_printf ("\n");
                    gdb_printf ("    globals ");
                    if (!psymtab->global_psymbols.empty ())
@@ -1455,33 +1455,33 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
   const struct blockvector *bv;
   const struct block *b;
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      for (const auto &iter : objfile->qf)
+      for (const auto &iter : objfile.qf)
        {
          psymbol_functions *psf
            = dynamic_cast<psymbol_functions *> (iter.get ());
          if (psf == nullptr)
            continue;
 
-         for (partial_symtab *ps : psf->partial_symbols (objfile))
+         for (partial_symtab *ps : psf->partial_symbols (&objfile))
            {
-             struct gdbarch *gdbarch = objfile->arch ();
+             struct gdbarch *gdbarch = objfile.arch ();
 
              /* We don't call psymtab_to_symtab here because that may cause symtab
                 expansion.  When debugging a problem it helps if checkers leave
                 things unchanged.  */
-             cust = ps->get_compunit_symtab (objfile);
+             cust = ps->get_compunit_symtab (&objfile);
 
              /* First do some checks that don't require the associated symtab.  */
-             if (ps->text_high (objfile) < ps->text_low (objfile))
+             if (ps->text_high (&objfile) < ps->text_low (&objfile))
                {
                  gdb_printf ("Psymtab ");
                  gdb_puts (ps->filename);
                  gdb_printf (" covers bad range ");
-                 gdb_puts (paddress (gdbarch, ps->text_low (objfile)));
+                 gdb_puts (paddress (gdbarch, ps->text_low (&objfile)));
                  gdb_printf (" - ");
-                 gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
+                 gdb_puts (paddress (gdbarch, ps->text_high (&objfile)));
                  gdb_printf ("\n");
                  continue;
                }
@@ -1529,15 +1529,15 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
                    }
                }
              if (ps->unrelocated_text_high () != unrelocated_addr (0)
-                 && (ps->text_low (objfile) < b->start ()
-                     || ps->text_high (objfile) > b->end ()))
+                 && (ps->text_low (&objfile) < b->start ()
+                     || ps->text_high (&objfile) > b->end ()))
                {
                  gdb_printf ("Psymtab ");
                  gdb_puts (ps->filename);
                  gdb_printf (" covers ");
-                 gdb_puts (paddress (gdbarch, ps->text_low (objfile)));
+                 gdb_puts (paddress (gdbarch, ps->text_low (&objfile)));
                  gdb_printf (" - ");
-                 gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
+                 gdb_puts (paddress (gdbarch, ps->text_high (&objfile)));
                  gdb_printf (" but symtab covers only ");
                  gdb_puts (paddress (gdbarch, b->start ()));
                  gdb_printf (" - ");
index 1e72e908f08abff128468fb7a92f0f9f30eab8e3..e2bfd6b7be3c430ae366faf21f555b2e91fabf63 100644 (file)
@@ -98,9 +98,9 @@ search_pp_list (PyObject *list, PyObject *value)
 static PyObject *
 find_pretty_printer_from_objfiles (PyObject *value)
 {
-  for (objfile *obj : current_program_space->objfiles ())
+  for (objfile &obj : current_program_space->objfiles ())
     {
-      gdbpy_ref<> objf = objfile_to_objfile_object (obj);
+      gdbpy_ref<> objf = objfile_to_objfile_object (&obj);
       if (objf == NULL)
        {
          /* Ignore the error and continue.  */
index 61f9b4b5020232a60b553d69a4e5a37545b35834..9f3e45c0cc65fadd80aa1eeac5cfb270d9b1c86e 100644 (file)
@@ -431,9 +431,9 @@ pspy_get_objfiles (PyObject *self_, PyObject *args)
 
   if (self->pspace != NULL)
     {
-      for (objfile *objf : self->pspace->objfiles ())
+      for (objfile &objf : self->pspace->objfiles ())
        {
-         gdbpy_ref<> item = objfile_to_objfile_object (objf);
+         gdbpy_ref<> item = objfile_to_objfile_object (&objf);
 
          if (item == nullptr
              || PyList_Append (list.get (), item.get ()) == -1)
index 284e385d281b376417006950631acc5c27a0c82a..b95071f0b46170030f008b4721300fc95ae6deb4 100644 (file)
@@ -603,7 +603,7 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
       /* Expand any symtabs that contain potentially matching symbols.  */
       lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
          auto callback = [&] (compunit_symtab *cust)
            {
@@ -632,8 +632,8 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
              return true;
            };
 
-         if (!objfile->search (nullptr, &lookup_name, nullptr, callback,
-                               SEARCH_STATIC_BLOCK, flags))
+         if (!objfile.search (nullptr, &lookup_name, nullptr, callback,
+                              SEARCH_STATIC_BLOCK, flags))
            return nullptr;
        }
     }
index deac98f7615b0bcd9b2d4c864f4875eee1abd950..c10ac5dcd90a7fef32d07843bdafb04a905f7e59 100644 (file)
@@ -141,9 +141,9 @@ gdbpy_get_matching_xmethod_workers
   /* Gather debug method matchers registered with the object files.
      This could be done differently by iterating over each objfile's matcher
      list individually, but there's no data yet to show it's needed.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
+      gdbpy_ref<> py_objfile = objfile_to_objfile_object (&objfile);
 
       if (py_objfile == NULL)
        {
index 27e034306d59634fc02b02bb94c0ec179755f4a2..c91e0b2c37b46633feec1f36e0b6c0d6b7fc8d97 100644 (file)
@@ -3687,9 +3687,9 @@ svr4_solib_ops::iterate_over_objfiles_in_search_order
   if (debug_base == 0)
     debug_base = default_debug_base;
 
-  for (objfile *objfile : m_pspace->objfiles ())
+  for (objfile &objfile : m_pspace->objfiles ())
     {
-      if (checked_current_objfile && objfile == current_objfile)
+      if (checked_current_objfile && &objfile == current_objfile)
        continue;
 
       /* Try to determine the namespace into which objfile was loaded.
@@ -3697,7 +3697,7 @@ svr4_solib_ops::iterate_over_objfiles_in_search_order
         If we fail, e.g. for manually added symbol files or for the main
         executable, we assume that they were added to the initial
         namespace.  */
-      const solib *solib = find_solib_for_objfile (objfile);
+      const solib *solib = find_solib_for_objfile (&objfile);
       CORE_ADDR solib_base = find_debug_base_for_solib (solib);
       if (solib_base == 0)
        solib_base = default_debug_base;
@@ -3706,7 +3706,7 @@ svr4_solib_ops::iterate_over_objfiles_in_search_order
       if (solib_base != debug_base)
        continue;
 
-      if (cb (objfile))
+      if (cb (&objfile))
        return;
     }
 }
index 9a2ef123ed9c54eae0820213c127ef1dd386f41c..e790ef0d53093a1fc4bdab8ccba5b25d5d2d4d8b 100644 (file)
@@ -480,8 +480,8 @@ solib_ops::iterate_over_objfiles_in_search_order
   (iterate_over_objfiles_in_search_order_cb_ftype cb,
    objfile *current_objfile) const
 {
-  for (objfile *objfile : m_pspace->objfiles ())
-    if (cb (objfile))
+  for (objfile &objfile : m_pspace->objfiles ())
+    if (cb (&objfile))
       return;
 }
 
@@ -644,10 +644,10 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
        {
          /* Have we already loaded this shared object?  */
          so.objfile = nullptr;
-         for (objfile *objfile : current_program_space->objfiles ())
-           if (objfile->addr_low == so.addr_low)
+         for (objfile &objfile : current_program_space->objfiles ())
+           if (objfile.addr_low == so.addr_low)
              {
-               so.objfile = objfile;
+               so.objfile = &objfile;
                break;
              }
 
index 99dffa8c0e2589794c83c99807d9b67cf0bb05d6..aaafa1cf78819280620d323215c2d8e3aafb2746 100644 (file)
@@ -354,9 +354,9 @@ select_source_symtab ()
 
   struct symtab *new_symtab = nullptr;
 
-  for (objfile *ofp : current_program_space->objfiles ())
+  for (objfile &ofp : current_program_space->objfiles ())
     {
-      for (compunit_symtab *cu : ofp->compunits ())
+      for (compunit_symtab *cu : ofp.compunits ())
        {
          for (symtab *symtab : cu->filetabs ())
            {
@@ -374,9 +374,9 @@ select_source_symtab ()
   if (new_symtab != nullptr)
     return;
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      symtab *s = objfile->find_last_source_symtab ();
+      symtab *s = objfile.find_last_source_symtab ();
       if (s)
        new_symtab = s;
     }
@@ -437,8 +437,8 @@ void
 forget_cached_source_info (void)
 {
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
-      objfile->forget_cached_source_info ();
+    for (objfile &objfile : pspace->objfiles ())
+      objfile.forget_cached_source_info ();
 
   g_source_cache.clear ();
   last_source_visited = NULL;
index 705d8f74c80dfd5e12b7e4aa77b7dd6bc81429fe..7e7851ab72cc5f63952c014f22f8b69cb5aff8ea 100644 (file)
@@ -835,17 +835,17 @@ static void
 set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c)
 {
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
        if (debug_symfile)
          {
-           if (!symfile_debug_installed (objfile))
-             install_symfile_debug_logging (objfile);
+           if (!symfile_debug_installed (&objfile))
+             install_symfile_debug_logging (&objfile);
          }
        else
          {
-           if (symfile_debug_installed (objfile))
-             uninstall_symfile_debug_logging (objfile);
+           if (symfile_debug_installed (&objfile))
+             uninstall_symfile_debug_logging (&objfile);
          }
       }
 }
index 98cb63788c06df2733d404e05d8743a91d7c1c88..2a687c01ab406dd9b0087c364b91a7bb46c42936 100644 (file)
@@ -2416,14 +2416,14 @@ remove_symbol_file_command (const char *args, int from_tty)
 
       CORE_ADDR addr = parse_and_eval_address (args);
 
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         if ((objfile->flags & OBJF_USERLOADED) != 0
-             && (objfile->flags & OBJF_SHARED) != 0
-             && objfile->pspace () == current_program_space
-             && is_addr_in_objfile (addr, objfile))
+         if ((objfile.flags & OBJF_USERLOADED) != 0
+             && (objfile.flags & OBJF_SHARED) != 0
+             && objfile.pspace () == current_program_space
+             && is_addr_in_objfile (addr, &objfile))
            {
-             objf = objfile;
+             objf = &objfile;
              break;
            }
        }
@@ -2434,14 +2434,14 @@ remove_symbol_file_command (const char *args, int from_tty)
       if (filename.empty ())
        error (_("remove-symbol-file: no symbol file provided"));
 
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         if ((objfile->flags & OBJF_USERLOADED) != 0
-             && (objfile->flags & OBJF_SHARED) != 0
-             && objfile->pspace () == current_program_space
-             && filename_cmp (filename.c_str (), objfile_name (objfile)) == 0)
+         if ((objfile.flags & OBJF_USERLOADED) != 0
+             && (objfile.flags & OBJF_SHARED) != 0
+             && objfile.pspace () == current_program_space
+             && filename_cmp (filename.c_str (), objfile_name (&objfile)) == 0)
            {
-             objf = objfile;
+             objf = &objfile;
              break;
            }
        }
@@ -2473,13 +2473,13 @@ reread_symbols (int from_tty)
      indicate when the executable was last reloaded.  */
   reopen_exec_file ();
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      if (objfile->obfd.get () == NULL)
+      if (objfile.obfd.get () == NULL)
        continue;
 
       /* Separate debug objfiles are handled in the main objfile.  */
-      if (objfile->separate_debug_objfile_backlink)
+      if (objfile.separate_debug_objfile_backlink)
        continue;
 
       /* When a in-memory BFD is initially created, it's mtime (as
@@ -2491,11 +2491,11 @@ reread_symbols (int from_tty)
         about reloading BFDs that changed on disk.
 
         Just skip any in-memory BFD.  */
-      if (objfile->obfd.get ()->flags & BFD_IN_MEMORY)
+      if (objfile.obfd.get ()->flags & BFD_IN_MEMORY)
        continue;
 
       struct stat new_statbuf;
-      int res = gdb_bfd_stat (objfile->obfd.get (), &new_statbuf);
+      int res = gdb_bfd_stat (objfile.obfd.get (), &new_statbuf);
       if (res != 0)
        {
          /* If this object is from an archive (what you usually create
@@ -2503,21 +2503,21 @@ reread_symbols (int from_tty)
             though a `shared library' on AIX is also an archive), then you
             should stat on the archive name, not member name.  */
          const char *filename;
-         if (objfile->obfd->my_archive)
-           filename = bfd_get_filename (objfile->obfd->my_archive);
+         if (objfile.obfd->my_archive)
+           filename = bfd_get_filename (objfile.obfd->my_archive);
          else
-           filename = objfile_name (objfile);
+           filename = objfile_name (&objfile);
 
          warning (_("`%ps' has disappeared; keeping its symbols."),
                   styled_string (file_name_style.style (), filename));
          continue;
        }
       time_t new_modtime = new_statbuf.st_mtime;
-      if (new_modtime != objfile->mtime)
+      if (new_modtime != objfile.mtime)
        {
          gdb_printf (_("`%ps' has changed; re-reading symbols.\n"),
                      styled_string (file_name_style.style (),
-                                    objfile_name (objfile)));
+                                    objfile_name (&objfile)));
 
          /* There are various functions like symbol_file_add,
             symfile_bfd_open, syms_from_objfile, etc., which might
@@ -2529,7 +2529,7 @@ reread_symbols (int from_tty)
          /* If we get an error, blow away this objfile (not sure if
             that is the correct response for things like shared
             libraries).  */
-         scoped_objfile_unlinker objfile_holder (objfile);
+         scoped_objfile_unlinker objfile_holder (&objfile);
 
          /* We need to do this whenever any symbols go away.  */
          clear_symtab_users_cleanup defer_clear_users (0);
@@ -2538,14 +2538,14 @@ reread_symbols (int from_tty)
 
          /* Free the separate debug objfiles.  It will be
             automatically recreated by sym_read.  */
-         free_objfile_separate_debug (objfile);
+         free_objfile_separate_debug (&objfile);
 
          /* Clear the stale source cache.  */
          forget_cached_source_info ();
 
          /* Remove any references to this objfile in the global
             value lists.  */
-         preserve_values (objfile);
+         preserve_values (&objfile);
 
          /* Nuke all the state that we will re-read.  Much of the following
             code which sets things to NULL really is necessary to tell
@@ -2553,78 +2553,78 @@ reread_symbols (int from_tty)
 
             Try to keep the freeing order compatible with free_objfile.  */
 
-         if (objfile->sf != NULL)
+         if (objfile.sf != NULL)
            {
-             (*objfile->sf->sym_finish) (objfile);
+             (*objfile.sf->sym_finish) (&objfile);
            }
 
-         objfile->registry_fields.clear_registry ();
+         objfile.registry_fields.clear_registry ();
 
          /* Clean up any state BFD has sitting around.  */
          {
-           gdb_bfd_ref_ptr obfd = objfile->obfd;
+           gdb_bfd_ref_ptr obfd = objfile.obfd;
            const char *obfd_filename;
 
-           obfd_filename = bfd_get_filename (objfile->obfd.get ());
+           obfd_filename = bfd_get_filename (objfile.obfd.get ());
            /* Open the new BFD before freeing the old one, so that
               the filename remains live.  */
            gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget));
-           objfile->obfd = std::move (temp);
-           if (objfile->obfd == NULL)
+           objfile.obfd = std::move (temp);
+           if (objfile.obfd == NULL)
              error (_("Can't open %s to read symbols."), obfd_filename);
          }
 
-         std::string original_name = objfile->original_name;
+         std::string original_name = objfile.original_name;
 
          /* bfd_openr sets cacheable to true, which is what we want.  */
-         if (!bfd_check_format (objfile->obfd.get (), bfd_object))
-           error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
+         if (!bfd_check_format (objfile.obfd.get (), bfd_object))
+           error (_("Can't read symbols from %s: %s."), objfile_name (&objfile),
                   bfd_errmsg (bfd_get_error ()));
 
          /* NB: after this call to obstack_free, objfiles_changed
             will need to be called (see discussion below).  */
-         obstack_free (&objfile->objfile_obstack, 0);
-         objfile->sections_start = NULL;
-         objfile->section_offsets.clear ();
-         objfile->sect_index_bss = -1;
-         objfile->sect_index_data = -1;
-         objfile->sect_index_rodata = -1;
-         objfile->sect_index_text = -1;
-         objfile->compunit_symtabs = NULL;
-         objfile->template_symbols = NULL;
-         objfile->static_links.clear ();
+         obstack_free (&objfile.objfile_obstack, 0);
+         objfile.sections_start = NULL;
+         objfile.section_offsets.clear ();
+         objfile.sect_index_bss = -1;
+         objfile.sect_index_data = -1;
+         objfile.sect_index_rodata = -1;
+         objfile.sect_index_text = -1;
+         objfile.compunit_symtabs = NULL;
+         objfile.template_symbols = NULL;
+         objfile.static_links.clear ();
 
          /* obstack_init also initializes the obstack so it is
             empty.  We could use obstack_specify_allocation but
             gdb_obstack.h specifies the alloc/dealloc functions.  */
-         obstack_init (&objfile->objfile_obstack);
+         obstack_init (&objfile.objfile_obstack);
 
          /* set_objfile_per_bfd potentially allocates the per-bfd
             data on the objfile's obstack (if sharing data across
             multiple users is not possible), so it's important to
             do it *after* the obstack has been initialized.  */
-         set_objfile_per_bfd (objfile);
+         set_objfile_per_bfd (&objfile);
 
-         objfile->original_name
-           = obstack_strdup (&objfile->objfile_obstack, original_name);
+         objfile.original_name
+           = obstack_strdup (&objfile.objfile_obstack, original_name);
 
          /* Reset the sym_fns pointer.  The ELF reader can change it
             based on whether .gdb_index is present, and we need it to
             start over.  PR symtab/15885  */
-         objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd.get ()));
-         objfile->qf.clear ();
+         objfile_set_sym_fns (&objfile, find_sym_fns (objfile.obfd.get ()));
+         objfile.qf.clear ();
 
-         build_objfile_section_table (objfile);
+         build_objfile_section_table (&objfile);
 
          /* What the hell is sym_new_init for, anyway?  The concept of
             distinguishing between the main file and additional files
             in this way seems rather dubious.  */
-         if (objfile == current_program_space->symfile_object_file)
+         if (&objfile == current_program_space->symfile_object_file)
            {
-             (*objfile->sf->sym_new_init) (objfile);
+             (*objfile.sf->sym_new_init) (&objfile);
            }
 
-         (*objfile->sf->sym_init) (objfile);
+         (*objfile.sf->sym_init) (&objfile);
          clear_complaints ();
 
          /* We are about to read new symbols and potentially also
@@ -2644,24 +2644,24 @@ reread_symbols (int from_tty)
          objfiles_changed (current_program_space);
 
          /* Recompute section offsets and section indices.  */
-         objfile->sf->sym_offsets (objfile, {});
+         objfile.sf->sym_offsets (&objfile, {});
 
-         read_symbols (objfile, 0);
+         read_symbols (&objfile, 0);
 
-         if ((objfile->flags & OBJF_READNOW))
+         if ((objfile.flags & OBJF_READNOW))
            {
-             const int mainline = objfile->flags & OBJF_MAINLINE;
+             const int mainline = objfile.flags & OBJF_MAINLINE;
              const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
                                        && readnow_symbol_files);
              if (should_print)
                gdb_printf (_("Expanding full symbols from %ps...\n"),
                            styled_string (file_name_style.style (),
-                                          objfile_name (objfile)));
+                                          objfile_name (&objfile)));
 
-             objfile->expand_all_symtabs ();
+             objfile.expand_all_symtabs ();
            }
 
-         if (!objfile->has_symbols ())
+         if (!objfile.has_symbols ())
            {
              gdb_stdout->wrap_here (0);
              gdb_printf (_("(no debugging symbols found)\n"));
@@ -2683,10 +2683,10 @@ reread_symbols (int from_tty)
          /* If the mtime has changed between the time we set new_modtime
             and now, we *want* this to be out of date, so don't call stat
             again now.  */
-         objfile->mtime = new_modtime;
-         init_entry_point_info (objfile);
+         objfile.mtime = new_modtime;
+         init_entry_point_info (&objfile);
 
-         new_objfiles.push_back (objfile);
+         new_objfiles.push_back (&objfile);
        }
     }
 
@@ -3005,8 +3005,8 @@ section_is_overlay (struct obj_section *section)
 static void
 overlay_invalidate_all (program_space *pspace)
 {
-  for (objfile *objfile : pspace->objfiles ())
-    for (obj_section &sect : objfile->sections ())
+  for (objfile &objfile : pspace->objfiles ())
+    for (obj_section &sect : objfile.sections ())
       if (section_is_overlay (&sect))
        sect.ovly_mapped = -1;
 }
@@ -3181,8 +3181,8 @@ find_pc_overlay (CORE_ADDR pc)
 
   if (overlay_debugging)
     {
-      for (objfile *objfile : current_program_space->objfiles ())
-       for (obj_section &osect : objfile->sections ())
+      for (objfile &objfile : current_program_space->objfiles ())
+       for (obj_section &osect : objfile.sections ())
          if (section_is_overlay (&osect))
            {
              if (pc_in_mapped_range (pc, &osect))
@@ -3208,8 +3208,8 @@ find_pc_mapped_section (CORE_ADDR pc)
 {
   if (overlay_debugging)
     {
-      for (objfile *objfile : current_program_space->objfiles ())
-       for (obj_section &osect : objfile->sections ())
+      for (objfile &objfile : current_program_space->objfiles ())
+       for (obj_section &osect : objfile.sections ())
          if (pc_in_mapped_range (pc, &osect) && section_is_mapped (&osect))
            return &osect;
     }
@@ -3227,11 +3227,11 @@ list_overlays_command (const char *args, int from_tty)
 
   if (overlay_debugging)
     {
-      for (objfile *objfile : current_program_space->objfiles ())
-       for (obj_section &osect : objfile->sections ())
+      for (objfile &objfile : current_program_space->objfiles ())
+       for (obj_section &osect : objfile.sections ())
          if (section_is_mapped (&osect))
            {
-             struct gdbarch *gdbarch = objfile->arch ();
+             struct gdbarch *gdbarch = objfile.arch ();
              const char *name;
              bfd_vma lma, vma;
              int size;
@@ -3273,8 +3273,8 @@ map_overlay_command (const char *args, int from_tty)
     error (_("Argument required: name of an overlay section"));
 
   /* First, find a section matching the user supplied argument.  */
-  for (objfile *obj_file : current_program_space->objfiles ())
-    for (obj_section &sec : obj_file->sections ())
+  for (objfile &obj_file : current_program_space->objfiles ())
+    for (obj_section &sec : obj_file.sections ())
       if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
        {
          /* Now, check to see if the section is an overlay.  */
@@ -3286,8 +3286,8 @@ map_overlay_command (const char *args, int from_tty)
 
          /* Next, make a pass and unmap any sections that are
             overlapped by this new section: */
-         for (objfile *objfile2 : current_program_space->objfiles ())
-           for (obj_section &sec2 : objfile2->sections ())
+         for (objfile &objfile2 : current_program_space->objfiles ())
+           for (obj_section &sec2 : objfile2.sections ())
              if (sec2.ovly_mapped && &sec != &sec2 && sections_overlap (&sec,
                                                                         &sec2))
                {
@@ -3317,8 +3317,8 @@ unmap_overlay_command (const char *args, int from_tty)
     error (_("Argument required: name of an overlay section"));
 
   /* First, find a section matching the user supplied argument.  */
-  for (objfile *objfile : current_program_space->objfiles ())
-    for (obj_section &sec : objfile->sections ())
+  for (objfile &objfile : current_program_space->objfiles ())
+    for (obj_section &sec : objfile.sections ())
       if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
        {
          if (!sec.ovly_mapped)
@@ -3576,8 +3576,8 @@ simple_overlay_update (struct obj_section *osect)
     return;
 
   /* Now may as well update all sections, even if only one was requested.  */
-  for (objfile *objfile : current_program_space->objfiles ())
-    for (obj_section &sect : objfile->sections ())
+  for (objfile &objfile : current_program_space->objfiles ())
+    for (obj_section &sect : objfile.sections ())
       if (section_is_overlay (&sect))
        {
          int i;
@@ -3762,8 +3762,8 @@ symfile_free_objfile (struct objfile *objfile)
 void
 map_symbol_filenames (symbol_filename_listener fun, bool need_fullname)
 {
-  for (objfile *objfile : current_program_space->objfiles ())
-    objfile->map_symbol_filenames (fun, need_fullname);
+  for (objfile &objfile : current_program_space->objfiles ())
+    objfile.map_symbol_filenames (fun, need_fullname);
 }
 
 #if GDB_SELF_TEST
index e43fafa7d9c78bb8515fa18cada252e7595c67df..a74891bcb3e8e76251afb36a7cbc36ddf3c131e4 100644 (file)
@@ -55,25 +55,25 @@ print_objfile_statistics (void)
   int i, linetables, blockvectors;
 
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
        QUIT;
-       gdb_printf (_("Statistics for '%s':\n"), objfile_name (objfile));
-       if (OBJSTAT (objfile, n_stabs) > 0)
+       gdb_printf (_("Statistics for '%s':\n"), objfile_name (&objfile));
+       if (OBJSTAT ((&objfile), n_stabs) > 0)
          gdb_printf (_("  Number of \"stab\" symbols read: %d\n"),
-                     OBJSTAT (objfile, n_stabs));
-       if (objfile->per_bfd->n_minsyms > 0)
+                     OBJSTAT ((&objfile), n_stabs));
+       if (objfile.per_bfd->n_minsyms > 0)
          gdb_printf (_("  Number of \"minimal\" symbols read: %d\n"),
-                     objfile->per_bfd->n_minsyms);
-       if (OBJSTAT (objfile, n_syms) > 0)
+                     objfile.per_bfd->n_minsyms);
+       if (OBJSTAT ((&objfile), n_syms) > 0)
          gdb_printf (_("  Number of \"full\" symbols read: %d\n"),
-                     OBJSTAT (objfile, n_syms));
-       if (OBJSTAT (objfile, n_types) > 0)
+                     OBJSTAT ((&objfile), n_syms));
+       if (OBJSTAT ((&objfile), n_types) > 0)
          gdb_printf (_("  Number of \"types\" defined: %d\n"),
-                     OBJSTAT (objfile, n_types));
+                     OBJSTAT ((&objfile), n_types));
 
        i = linetables = 0;
-       for (compunit_symtab *cu : objfile->compunits ())
+       for (compunit_symtab *cu : objfile.compunits ())
          {
            for (symtab *s : cu->filetabs ())
              {
@@ -82,32 +82,32 @@ print_objfile_statistics (void)
                  linetables++;
              }
          }
-       blockvectors = std::distance (objfile->compunits ().begin (),
-                                     objfile->compunits ().end ());
+       blockvectors = std::distance (objfile.compunits ().begin (),
+                                     objfile.compunits ().end ());
        gdb_printf (_("  Number of symbol tables: %d\n"), i);
        gdb_printf (_("  Number of symbol tables with line tables: %d\n"),
                    linetables);
        gdb_printf (_("  Number of symbol tables with blockvectors: %d\n"),
                    blockvectors);
 
-       objfile->print_stats (false);
+       objfile.print_stats (false);
 
-       if (OBJSTAT (objfile, sz_strtab) > 0)
+       if (OBJSTAT ((&objfile), sz_strtab) > 0)
          gdb_printf (_("  Space used by string tables: %d\n"),
-                     OBJSTAT (objfile, sz_strtab));
+                     OBJSTAT ((&objfile), sz_strtab));
        gdb_printf (_("  Total memory used for objfile obstack: %s\n"),
                    pulongest (obstack_memory_used (&objfile
-                                                   ->objfile_obstack)));
+                                                   .objfile_obstack)));
        gdb_printf (_("  Total memory used for BFD obstack: %s\n"),
-                   pulongest (obstack_memory_used (&objfile->per_bfd
+                   pulongest (obstack_memory_used (&objfile.per_bfd
                                                    ->storage_obstack)));
 
        gdb_printf (_("  Total memory used for string cache: %d\n"),
-                   objfile->per_bfd->string_cache.memory_used ());
+                   objfile.per_bfd->string_cache.memory_used ());
        gdb_printf (_("Byte cache statistics for '%s':\n"),
-                   objfile_name (objfile));
-       objfile->per_bfd->string_cache.print_statistics ("string cache");
-       objfile->print_stats (true);
+                   objfile_name (&objfile));
+       objfile.per_bfd->string_cache.print_statistics ("string cache");
+       objfile.print_stats (true);
       }
 }
 
@@ -451,18 +451,18 @@ maintenance_print_symbols (const char *args, int from_tty)
     {
       int found = 0;
 
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
          int print_for_objfile = 1;
 
          if (objfile_arg != NULL)
            print_for_objfile
-             = compare_filenames_for_search (objfile_name (objfile),
+             = compare_filenames_for_search (objfile_name (&objfile),
                                              objfile_arg);
          if (!print_for_objfile)
            continue;
 
-         for (compunit_symtab *cu : objfile->compunits ())
+         for (compunit_symtab *cu : objfile.compunits ())
            {
              for (symtab *s : cu->filetabs ())
                {
@@ -701,12 +701,12 @@ maintenance_print_msymbols (const char *args, int from_tty)
       outfile = &arg_outfile;
     }
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       QUIT;
       if (objfile_arg == NULL
-         || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
-       dump_msymbols (objfile, outfile);
+         || compare_filenames_for_search (objfile_name (&objfile), objfile_arg))
+       dump_msymbols (&objfile, outfile);
     }
 }
 
@@ -719,12 +719,12 @@ maintenance_print_objfiles (const char *regexp, int from_tty)
     re_comp (regexp);
 
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
        QUIT;
        if (! regexp
-           || re_exec (objfile_name (objfile)))
-         dump_objfile (objfile);
+           || re_exec (objfile_name (&objfile)))
+         dump_objfile (&objfile);
       }
 }
 
@@ -739,13 +739,13 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
     re_comp (regexp);
 
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
        /* We don't want to print anything for this objfile until we
           actually find a symtab whose name matches.  */
        int printed_objfile_start = 0;
 
-       for (compunit_symtab *cust : objfile->compunits ())
+       for (compunit_symtab *cust : objfile.compunits ())
          {
            int printed_compunit_symtab_start = 0;
 
@@ -758,10 +758,10 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
                  {
                    if (! printed_objfile_start)
                      {
-                       gdb_printf ("{ objfile %s ", objfile_name (objfile));
+                       gdb_printf ("{ objfile %s ", objfile_name (&objfile));
                        gdb_stdout->wrap_here (2);
                        gdb_printf ("((struct objfile *) %s)\n",
-                                   host_address_to_string (objfile));
+                                   host_address_to_string (&objfile));
                        printed_objfile_start = 1;
                      }
                    if (! printed_compunit_symtab_start)
@@ -844,13 +844,13 @@ static void
 maintenance_check_symtabs (const char *ignore, int from_tty)
 {
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
        /* We don't want to print anything for this objfile until we
           actually find something worth printing.  */
        int printed_objfile_start = 0;
 
-       for (compunit_symtab *cust : objfile->compunits ())
+       for (compunit_symtab *cust : objfile.compunits ())
          {
            int found_something = 0;
            struct symtab *symtab = cust->primary_filetab ();
@@ -865,10 +865,10 @@ maintenance_check_symtabs (const char *ignore, int from_tty)
              {
                if (! printed_objfile_start)
                  {
-                   gdb_printf ("{ objfile %s ", objfile_name (objfile));
+                   gdb_printf ("{ objfile %s ", objfile_name (&objfile));
                    gdb_stdout->wrap_here (2);
                    gdb_printf ("((struct objfile *) %s)\n",
-                               host_address_to_string (objfile));
+                               host_address_to_string (&objfile));
                    printed_objfile_start = 1;
                  }
                gdb_printf ("  { symtab %s\n",
@@ -908,8 +908,8 @@ maintenance_expand_symtabs (const char *args, int from_tty)
   if (regexp == nullptr)
     {
       for (struct program_space *pspace : program_spaces)
-       for (objfile *objfile : pspace->objfiles ())
-         objfile->expand_all_symtabs ();
+       for (objfile &objfile : pspace->objfiles ())
+         objfile.expand_all_symtabs ();
 
       return;
     }
@@ -917,8 +917,8 @@ maintenance_expand_symtabs (const char *args, int from_tty)
   re_comp (regexp);
 
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
-      objfile->search
+    for (objfile &objfile : pspace->objfiles ())
+      objfile.search
        ([&] (const char *filename, bool basenames)
           {
             /* KISS: Only apply the regexp to the complete file name.  */
@@ -1028,9 +1028,9 @@ maintenance_info_line_tables (const char *regexp, int from_tty)
     re_comp (regexp);
 
   for (struct program_space *pspace : program_spaces)
-    for (objfile *objfile : pspace->objfiles ())
+    for (objfile &objfile : pspace->objfiles ())
       {
-       for (compunit_symtab *cust : objfile->compunits ())
+       for (compunit_symtab *cust : objfile.compunits ())
          {
            for (symtab *symtab : cust->filetabs ())
              {
index 896b81d15cf0b0314e2f0f081bae0088d44d5d47..aef4842a7af38b2d3c3dea618efd3317a600af77 100644 (file)
@@ -678,16 +678,16 @@ iterate_over_symtabs (program_space *pspace, const char *name,
       gdb_assert (IS_ABSOLUTE_PATH (real_path.get ()));
     }
 
-  for (objfile *objfile : pspace->objfiles ())
+  for (objfile &objfile : pspace->objfiles ())
     if (iterate_over_some_symtabs (name, real_path.get (),
-                                  objfile->compunit_symtabs, nullptr,
+                                  objfile.compunit_symtabs, nullptr,
                                   callback))
        return;
 
   /* Same search rules as above apply here, but now we look through the
      psymtabs.  */
-  for (objfile *objfile : pspace->objfiles ())
-    if (objfile->map_symtabs_matching_filename (name, real_path.get (),
+  for (objfile &objfile : pspace->objfiles ())
+    if (objfile.map_symtabs_matching_filename (name, real_path.get (),
                                                callback))
       return;
 }
@@ -1204,10 +1204,10 @@ matching_obj_sections (struct obj_section *obj_first,
   /* Otherwise check that they are in corresponding objfiles.  */
 
   struct objfile *obj = NULL;
-  for (objfile *objfile : current_program_space->objfiles ())
-    if (objfile->obfd == first->owner)
+  for (objfile &objfile : current_program_space->objfiles ())
+    if (objfile.obfd == first->owner)
       {
-       obj = objfile;
+       obj = &objfile;
        break;
       }
   gdb_assert (obj != NULL);
@@ -2713,9 +2713,9 @@ basic_lookup_transparent_type (const char *name, domain_search_flags flags)
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
   /* Search all the global symbols.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK,
+      t = basic_lookup_transparent_type_quick (&objfile, GLOBAL_BLOCK,
                                               flags, lookup_name);
       if (t)
        return t;
@@ -2723,9 +2723,9 @@ basic_lookup_transparent_type (const char *name, domain_search_flags flags)
 
   /* Now search the static file-level symbols.  Not strictly correct,
      but more useful than an error.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK,
+      t = basic_lookup_transparent_type_quick (&objfile, STATIC_BLOCK,
                                               flags, lookup_name);
       if (t)
        return t;
@@ -2804,9 +2804,9 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
      It also happens for objfiles that have their functions reordered.
      For these, the symtab we are looking for is not necessarily read in.  */
 
-  for (objfile *obj_file : current_program_space->objfiles ())
+  for (objfile &obj_file : current_program_space->objfiles ())
     {
-      for (compunit_symtab *cust : obj_file->compunits ())
+      for (compunit_symtab *cust : obj_file.compunits ())
        {
          const struct blockvector *bv = cust->blockvector ();
          const struct block *global_block = bv->global_block ();
@@ -2837,8 +2837,8 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
             stabs and coff debugging info, we continue on if a psymtab
             can't be found.  */
          struct compunit_symtab *result
-           = obj_file->find_pc_sect_compunit_symtab (msymbol, pc,
-                                                     section, 0);
+           = obj_file.find_pc_sect_compunit_symtab (msymbol, pc,
+                                                    section, 0);
          if (result != nullptr)
            return result;
 
@@ -2853,7 +2853,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
                  const struct block *b = bv->block (b_index);
                  for (struct symbol *sym : block_iterator_range (b))
                    {
-                     if (matching_obj_sections (sym->obj_section (obj_file),
+                     if (matching_obj_sections (sym->obj_section (&obj_file),
                                                 section))
                        {
                          found_sym = sym;
@@ -2877,10 +2877,10 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
 
   /* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs).  */
 
-  for (objfile *objf : current_program_space->objfiles ())
+  for (objfile &objf : current_program_space->objfiles ())
     {
       struct compunit_symtab *result
-       = objf->find_pc_sect_compunit_symtab (msymbol, pc, section, 1);
+       = objf.find_pc_sect_compunit_symtab (msymbol, pc, section, 1);
       if (result != NULL)
        return result;
     }
@@ -2923,13 +2923,13 @@ find_symbol_at_address (CORE_ADDR address)
       return nullptr;
     };
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       /* If this objfile was read with -readnow, then we need to
         search the symtabs directly.  */
-      if ((objfile->flags & OBJF_READNOW) != 0)
+      if ((objfile.flags & OBJF_READNOW) != 0)
        {
-         for (compunit_symtab *symtab : objfile->compunits ())
+         for (compunit_symtab *symtab : objfile.compunits ())
            {
              struct symbol *sym = search_symtab (symtab, address);
              if (sym != nullptr)
@@ -2939,7 +2939,7 @@ find_symbol_at_address (CORE_ADDR address)
       else
        {
          struct compunit_symtab *symtab
-           = objfile->find_compunit_symtab_by_address (address);
+           = objfile.find_compunit_symtab_by_address (address);
          if (symtab != NULL)
            {
              struct symbol *sym = search_symtab (symtab, address);
@@ -3366,12 +3366,12 @@ find_line_symtab (symtab *sym_tab, int line, int *index)
       else
        best = 0;
 
-      for (objfile *objfile : current_program_space->objfiles ())
-       objfile->expand_symtabs_with_fullname (symtab_to_fullname (sym_tab));
+      for (objfile &objfile : current_program_space->objfiles ())
+       objfile.expand_symtabs_with_fullname (symtab_to_fullname (sym_tab));
 
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         for (compunit_symtab *cu : objfile->compunits ())
+         for (compunit_symtab *cu : objfile.compunits ())
            {
              for (symtab *s : cu->filetabs ())
                {
@@ -4571,19 +4571,19 @@ info_sources_worker (struct ui_out *uiout,
 
   gdb_assert (group_by_objfile || uiout->is_mi_like_p ());
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       if (group_by_objfile)
        {
          output_tuple.emplace (uiout, nullptr);
-         uiout->field_string ("filename", objfile_name (objfile),
+         uiout->field_string ("filename", objfile_name (&objfile),
                               file_name_style.style ());
          uiout->text (":\n");
-         bool debug_fully_readin = !objfile->has_unexpanded_symtabs ();
+         bool debug_fully_readin = !objfile.has_unexpanded_symtabs ();
          if (uiout->is_mi_like_p ())
            {
              const char *debug_info_state;
-             if (objfile->has_symbols ())
+             if (objfile.has_symbols ())
                {
                  if (debug_fully_readin)
                    debug_info_state = "fully-read";
@@ -4599,14 +4599,14 @@ info_sources_worker (struct ui_out *uiout,
              if (!debug_fully_readin)
                uiout->text ("(Full debug information has not yet been read "
                             "for this file.)\n");
-             if (!objfile->has_symbols ())
+             if (!objfile.has_symbols ())
                uiout->text ("(Objfile has no debug information.)\n");
              uiout->text ("\n");
            }
          sources_list.emplace (uiout, "sources");
        }
 
-      for (compunit_symtab *cu : objfile->compunits ())
+      for (compunit_symtab *cu : objfile.compunits ())
        {
          for (symtab *s : cu->filetabs ())
            {
@@ -4618,7 +4618,7 @@ info_sources_worker (struct ui_out *uiout,
 
       if (group_by_objfile)
        {
-         objfile->map_symbol_filenames (data, true /* need_fullname */);
+         objfile.map_symbol_filenames (data, true /* need_fullname */);
          if (data.printed_filename_p ())
            uiout->text ("\n\n");
          data.reset_output ();
@@ -5034,17 +5034,17 @@ global_symbol_searcher::search () const
 
   bool found_msymbol = false;
   std::set<symbol_search> result_set;
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       /* Expand symtabs within objfile that possibly contain matching
         symbols.  */
-      found_msymbol |= expand_symtabs (objfile, preg);
+      found_msymbol |= expand_symtabs (&objfile, preg);
 
       /* Find matching symbols within OBJFILE and add them in to the
         RESULT_SET set.  Use a set here so that we can easily detect
         duplicates as we go, and can therefore track how many unique
         matches we have found so far.  */
-      if (!add_matching_symbols (objfile, preg, treg, &result_set))
+      if (!add_matching_symbols (&objfile, preg, treg, &result_set))
        break;
     }
 
@@ -5063,8 +5063,8 @@ global_symbol_searcher::search () const
     {
       gdb_assert ((m_kind & (SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN))
                  != 0);
-      for (objfile *objfile : current_program_space->objfiles ())
-       if (!add_matching_msymbols (objfile, preg, &result))
+      for (objfile &objfile : current_program_space->objfiles ())
+       if (!add_matching_msymbols (&objfile, preg, &result))
          break;
     }
 
@@ -5978,9 +5978,9 @@ default_collect_symbol_completion_matches_break_on
 
   if (code == TYPE_CODE_UNDEF)
     {
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile &objfile : current_program_space->objfiles ())
        {
-         for (minimal_symbol *msymbol : objfile->msymbols ())
+         for (minimal_symbol *msymbol : objfile.msymbols ())
            {
              QUIT;
 
@@ -5997,11 +5997,11 @@ default_collect_symbol_completion_matches_break_on
     }
 
   /* Add completions for all currently loaded symbol tables.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
       /* Look through the partial symtabs for all symbols which begin by
         matching SYM_TEXT.  Expand all CUs that you find to the list.  */
-      objfile->search
+      objfile.search
        (nullptr, &lookup_name, nullptr,
         [&] (compunit_symtab *symtab)
           {
@@ -6287,9 +6287,9 @@ make_source_files_completion_list (const char *text)
 
   filename_seen_cache filenames_seen;
 
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      for (compunit_symtab *cu : objfile->compunits ())
+      for (compunit_symtab *cu : objfile.compunits ())
        {
          for (symtab *s : cu->filetabs ())
            {
@@ -6385,15 +6385,15 @@ find_main_name (void)
      relies on the order of objfile creation -- which still isn't
      guaranteed to get the correct answer, but is just probably more
      accurate.  */
-  for (objfile *objfile : current_program_space->objfiles ())
+  for (objfile &objfile : current_program_space->objfiles ())
     {
-      objfile->compute_main_name ();
+      objfile.compute_main_name ();
 
-      if (objfile->per_bfd->name_of_main != NULL)
+      if (objfile.per_bfd->name_of_main != NULL)
        {
          set_main_name (pspace,
-                        objfile->per_bfd->name_of_main,
-                        objfile->per_bfd->language_of_main);
+                        objfile.per_bfd->name_of_main,
+                        objfile.per_bfd->language_of_main);
          return;
        }
     }
index c6f5803f37a224d8d2f2cdb425b33652fcfac25e..e6571c71976fcba78b13eec989324d22f94e8cdc 100644 (file)
@@ -922,10 +922,10 @@ windows_solib_ops::iterate_over_objfiles_in_search_order
        return;
     }
 
-  for (objfile *objfile : m_pspace->objfiles ())
-    if (objfile != current_objfile)
+  for (objfile &objfile : m_pspace->objfiles ())
+    if (&objfile != current_objfile)
       {
-       if (cb (objfile))
+       if (cb (&objfile))
          return;
       }
 }
index c8f0038e31d3d6f4b5a872a3ce7f7b243e1b20af..9ae8b7a5857d87646a7d09452c0c83a3a964cb45 100644 (file)
@@ -961,8 +961,8 @@ z80_overlay_update_1 (struct obj_section *osect)
   i = 0;
 
   /* we have interest for sections with same VMA */
-  for (objfile *objfile : current_program_space->objfiles ())
-    for (obj_section &sect : objfile->sections ())
+  for (objfile &objfile : current_program_space->objfiles ())
+    for (obj_section &sect : objfile.sections ())
       if (section_is_overlay (&sect))
        {
          sect.ovly_mapped = (lma == bfd_section_lma (sect.the_bfd_section));
@@ -984,8 +984,8 @@ z80_overlay_update (struct obj_section *osect)
     return;
 
   /* Update all sections, even if only one was requested.  */
-  for (objfile *objfile : current_program_space->objfiles ())
-    for (obj_section &sect : objfile->sections ())
+  for (objfile &objfile : current_program_space->objfiles ())
+    for (obj_section &sect : objfile.sections ())
       {
        if (!section_is_overlay (&sect))
          continue;