]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove some uses of "object_files"
authorTom Tromey <tom@tromey.com>
Sun, 20 Jan 2019 04:30:36 +0000 (21:30 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 10 Apr 2019 14:05:17 +0000 (08:05 -0600)
The "object_files" macro is sometimes used when iterating over
objfiles.  This patch removes a few such uses in favor of the new
range adapter.

gdb/ChangeLog
2019-04-10  Tom Tromey  <tom@tromey.com>

* ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
* minsyms.c (lookup_minimal_symbol): Use foreach.
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline): Likewise.
* symfile.c (reread_symbols): Use foreach.

gdb/ChangeLog
gdb/ia64-tdep.c
gdb/minsyms.c
gdb/symfile.c

index f9b9e88b517dd44b52c068557406b4957311250c..8b43298be2396dd4126095de1c64f2c5e24f6a6b 100644 (file)
@@ -1,3 +1,11 @@
+2019-04-10  Tom Tromey  <tom@tromey.com>
+
+       * ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
+       * minsyms.c (lookup_minimal_symbol): Use foreach.
+       (lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
+       (lookup_minimal_symbol_solib_trampoline): Likewise.
+       * symfile.c (reread_symbols): Use foreach.
+
 2019-04-09  Ivan Begert  <ivanbegert@gmail.com>
            Tom Tromey  <tromey@adacore.com>
 
index 7b4d0a0bfa16d52c4b9200b1ff2b9f6c5fafe81d..f46673986ba781da4bd5a2617e8669006aa5b3f2 100644 (file)
@@ -2845,7 +2845,6 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
                        unw_word_t *dilap, void *arg)
 {
   struct obj_section *text_sec;
-  struct objfile *objfile;
   unw_word_t ip, addr;
   unw_dyn_info_t di;
   int ret;
@@ -2853,7 +2852,7 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
   if (!libunwind_is_initialized ())
     return -UNW_ENOINFO;
 
-  for (objfile = object_files; objfile; objfile = objfile->next)
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       void *buf = NULL;
 
index 51b65f51421f734d6264f382d1652b82800457c1..34198d122dc9b875e6383c4fb616bbf98deef750 100644 (file)
@@ -308,7 +308,6 @@ struct bound_minimal_symbol
 lookup_minimal_symbol (const char *name, const char *sfile,
                       struct objfile *objf)
 {
-  struct objfile *objfile;
   found_minimal_symbols found;
 
   unsigned int mangled_hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
@@ -323,10 +322,11 @@ lookup_minimal_symbol (const char *name, const char *sfile,
 
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
-  for (objfile = object_files;
-       objfile != NULL && found.external_symbol.minsym == NULL;
-       objfile = objfile->next)
+  for (objfile *objfile : current_program_space->objfiles ())
     {
+      if (found.external_symbol.minsym != NULL)
+       break;
+
       if (objf == NULL || objf == objfile
          || objf == objfile->separate_debug_objfile_backlink)
        {
@@ -522,17 +522,17 @@ iterate_over_minimal_symbols
 struct bound_minimal_symbol
 lookup_minimal_symbol_text (const char *name, struct objfile *objf)
 {
-  struct objfile *objfile;
   struct minimal_symbol *msymbol;
   struct bound_minimal_symbol found_symbol = { NULL, NULL };
   struct bound_minimal_symbol found_file_symbol = { NULL, NULL };
 
   unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
 
-  for (objfile = object_files;
-       objfile != NULL && found_symbol.minsym == NULL;
-       objfile = objfile->next)
+  for (objfile *objfile : current_program_space->objfiles ())
     {
+      if (found_symbol.minsym != NULL)
+       break;
+
       if (objf == NULL || objf == objfile
          || objf == objfile->separate_debug_objfile_backlink)
        {
@@ -574,14 +574,11 @@ struct minimal_symbol *
 lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
                                  struct objfile *objf)
 {
-  struct objfile *objfile;
   struct minimal_symbol *msymbol;
 
   unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
 
-  for (objfile = object_files;
-       objfile != NULL;
-       objfile = objfile->next)
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       if (objf == NULL || objf == objfile
          || objf == objfile->separate_debug_objfile_backlink)
@@ -606,15 +603,12 @@ struct bound_minimal_symbol
 lookup_minimal_symbol_solib_trampoline (const char *name,
                                        struct objfile *objf)
 {
-  struct objfile *objfile;
   struct minimal_symbol *msymbol;
   struct bound_minimal_symbol found_symbol = { NULL, NULL };
 
   unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
 
-  for (objfile = object_files;
-       objfile != NULL;
-       objfile = objfile->next)
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       if (objf == NULL || objf == objfile
          || objf == objfile->separate_debug_objfile_backlink)
index dbfc306c5215408518e751e0bcefbc6e1f0abff6..ba82f1b83ca13e1c5b71777dbbc3149cf7fa290a 100644 (file)
@@ -2427,7 +2427,6 @@ remove_symbol_file_command (const char *args, int from_tty)
 void
 reread_symbols (void)
 {
-  struct objfile *objfile;
   long new_modtime;
   struct stat new_statbuf;
   int res;
@@ -2439,7 +2438,7 @@ reread_symbols (void)
      This routine should then walk down each partial symbol table
      and see if the symbol table that it originates from has been changed.  */
 
-  for (objfile = object_files; objfile; objfile = objfile->next)
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       if (objfile->obfd == NULL)
        continue;