]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Rename objfile::sections
authorTom Tromey <tom@tromey.com>
Mon, 10 Apr 2023 16:50:09 +0000 (10:50 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 7 May 2023 18:44:17 +0000 (12:44 -0600)
I think objfile::sections makes sense as the name of the method to
iterate over an objfile's sections, so this patch renames the existing
field to objfile::sections_start in preparation for that.

gdb/machoread.c
gdb/maint.c
gdb/objfiles.c
gdb/objfiles.h
gdb/solib-aix.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/xcoffread.c

index 9735de80d57232a7ce9ae4bdf7bd849051393536..dc841c30af2d79fe6bb11a16bae9c6199f08424f 100644 (file)
@@ -926,7 +926,7 @@ macho_symfile_offsets (struct objfile *objfile,
   ALL_OBJFILE_OSECTIONS (objfile, osect)
     {
       const char *bfd_sect_name = osect->the_bfd_section->name;
-      int sect_index = osect - objfile->sections;;
+      int sect_index = osect - objfile->sections_start;
 
       if (startswith (bfd_sect_name, "LC_SEGMENT."))
        bfd_sect_name += 11;
index a8afef0e16bcab18a1c98d3c336d00adc9626a58..3cd2c5e899a96d808f8c319ca315a4aef831ec9f 100644 (file)
@@ -331,11 +331,11 @@ maint_obj_section_from_bfd_section (bfd *abfd,
                                    asection *asection,
                                    objfile *ofile)
 {
-  if (ofile->sections == nullptr)
+  if (ofile->sections_start == nullptr)
     return nullptr;
 
   obj_section *osect
-    = &ofile->sections[gdb_bfd_section_index (abfd, asection)];
+    = &ofile->sections_start[gdb_bfd_section_index (abfd, asection)];
 
   if (osect >= ofile->sections_end)
     return nullptr;
@@ -375,7 +375,7 @@ maint_print_all_sections (const char *header, bfd *abfd, objfile *objfile,
 
       if (objfile != nullptr)
        {
-         gdb_assert (objfile->sections != nullptr);
+         gdb_assert (objfile->sections_start != nullptr);
          osect
            = maint_obj_section_from_bfd_section (abfd, sect, objfile);
          if (osect->the_bfd_section == nullptr)
index 9caebfefd59e82ba23a04174f93f16c151ded8f5..e3fa691dd53fea8509891cbc30bc7eb4f64a4fa8 100644 (file)
@@ -264,7 +264,7 @@ add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
        return;
     }
 
-  section = &objfile->sections[gdb_bfd_section_index (abfd, asect)];
+  section = &objfile->sections_start[gdb_bfd_section_index (abfd, asect)];
   section->objfile = objfile;
   section->the_bfd_section = asect;
   section->ovly_mapped = 0;
@@ -280,10 +280,10 @@ build_objfile_section_table (struct objfile *objfile)
 {
   int count = gdb_bfd_count_sections (objfile->obfd.get ());
 
-  objfile->sections = OBSTACK_CALLOC (&objfile->objfile_obstack,
-                                     count,
-                                     struct obj_section);
-  objfile->sections_end = (objfile->sections + count);
+  objfile->sections_start = OBSTACK_CALLOC (&objfile->objfile_obstack,
+                                           count,
+                                           struct obj_section);
+  objfile->sections_end = (objfile->sections_start + count);
   for (asection *sect : gdb_bfd_sections (objfile->obfd))
     add_to_objfile_sections (objfile->obfd.get (), sect, objfile, 0);
 
@@ -660,7 +660,7 @@ objfile_relocate1 (struct objfile *objfile,
   struct obj_section *s;
   ALL_OBJFILE_OSECTIONS (objfile, s)
     {
-      int idx = s - objfile->sections;
+      int idx = s - objfile->sections_start;
 
       exec_set_section_address (bfd_get_filename (objfile->obfd.get ()), idx,
                                s->addr ());
index 342aa09ac6afe23bc82181f2a1b6ee449a814ecc..1b059dddf5de704c3c591b8610424b6383aaaab8 100644 (file)
@@ -128,7 +128,7 @@ struct entry_info
 };
 
 #define ALL_OBJFILE_OSECTIONS(objfile, osect)  \
-  for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
+  for (osect = objfile->sections_start; osect < objfile->sections_end; osect++) \
     if (osect->the_bfd_section == NULL)                                        \
       {                                                                        \
        /* Nothing.  */                                                 \
@@ -713,16 +713,16 @@ public:
   int sect_index_bss = -1;
   int sect_index_rodata = -1;
 
-  /* These pointers are used to locate the section table, which
-     among other things, is used to map pc addresses into sections.
-     SECTIONS points to the first entry in the table, and
-     SECTIONS_END points to the first location past the last entry
-     in the table.  The table is stored on the objfile_obstack.  The
-     sections are indexed by the BFD section index; but the
-     structure data is only valid for certain sections
-     (e.g. non-empty, SEC_ALLOC).  */
+  /* These pointers are used to locate the section table, which among
+     other things, is used to map pc addresses into sections.
+     SECTIONS_START points to the first entry in the table, and
+     SECTIONS_END points to the first location past the last entry in
+     the table.  The table is stored on the objfile_obstack.  The
+     sections are indexed by the BFD section index; but the structure
+     data is only valid for certain sections (e.g. non-empty,
+     SEC_ALLOC).  */
 
-  struct obj_section *sections = nullptr;
+  struct obj_section *sections_start = nullptr;
   struct obj_section *sections_end = nullptr;
 
   /* GDB allows to have debug symbols in separate object files.  This is
index d7062b4ee17d8b137a456e4acf26b416774cbb0c..d3119db25bba04e86ada1c74f34a4c788d5167cf 100644 (file)
@@ -400,7 +400,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
   if (objfile->sect_index_text != -1)
     {
       struct bfd_section *sect
-       = objfile->sections[objfile->sect_index_text].the_bfd_section;
+       = objfile->sections_start[objfile->sect_index_text].the_bfd_section;
 
       offsets[objfile->sect_index_text]
        = info->text_addr + sect->filepos - bfd_section_vma (sect);
@@ -411,7 +411,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
   if (objfile->sect_index_data != -1)
     {
       struct bfd_section *sect
-       = objfile->sections[objfile->sect_index_data].the_bfd_section;
+       = objfile->sections_start[objfile->sect_index_data].the_bfd_section;
 
       offsets[objfile->sect_index_data]
        = info->data_addr - bfd_section_vma (sect);
index 866087ef3a5a524d0143ff8810d7bf35feeb6ccd..8106c342b1517e88513fcf76dcd9be7ff7a8c685 100644 (file)
@@ -822,7 +822,7 @@ dsbt_relocate_main_executable (void)
       int osect_idx;
       int seg;
 
-      osect_idx = osect - objf->sections;
+      osect_idx = osect - objf->sections_start;
 
       /* Current address of section.  */
       addr = osect->addr ();
index 240b4da5d9da67caba19a26d8cc319f09ed66fd8..7cce11d52daa4865b3aa0830e915c13f189cc552 100644 (file)
@@ -757,7 +757,7 @@ frv_relocate_main_executable (void)
       int osect_idx;
       int seg;
       
-      osect_idx = osect - objf->sections;
+      osect_idx = osect - objf->sections_start;
 
       /* Current address of section.  */
       addr = osect->addr ();
index d0cb5cb6534621d5d4ae9cefec58f1b1a0c657c5..d1ab3cc76b30601274efd9d8615330b1cd7e7b4d 100644 (file)
@@ -2571,7 +2571,7 @@ reread_symbols (int from_tty)
          /* 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 = NULL;
+         objfile->sections_start = NULL;
          objfile->section_offsets.clear ();
          objfile->sect_index_bss = -1;
          objfile->sect_index_data = -1;
index 4b68f2b1f6fbd6f461f3d0f6809d98bea18d9545..ee764a5f356e208093f43228b04eb11742d099d8 100644 (file)
@@ -212,7 +212,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
                        bfd_section_name (section->the_bfd_section));
          else
            gdb_printf (outfile, " spurious section %ld",
-                       (long) (section - objfile->sections));
+                       (long) (section - objfile->sections_start));
        }
       if (msymbol->demangled_name () != NULL)
        {
index 27611a34ec40a646e41d0457a8cc5d4804f64b8f..594b13fc42640172a5f50da5ba9ad9e1854dc8a7 100644 (file)
@@ -1099,7 +1099,7 @@ struct obj_section *
 general_symbol_info::obj_section (const struct objfile *objfile) const
 {
   if (section_index () >= 0)
-    return &objfile->sections[section_index ()];
+    return &objfile->sections_start[section_index ()];
   return nullptr;
 }
 
@@ -1777,7 +1777,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
          if ((bfd_section_flags (s->the_bfd_section) & SEC_ALLOC) == 0)
            continue;
 
-         int idx = s - objfile->sections;
+         int idx = s - objfile->sections_start;
          CORE_ADDR offset = objfile->section_offsets[idx];
 
          if (fallback == -1)
index e5b8e8a69fcc82affc436fed008918d5e731cfe2..a660e1c0265188664cbf640e26273935968a4be0 100644 (file)
@@ -2890,7 +2890,8 @@ xcoff_symfile_offsets (struct objfile *objfile,
   if (objfile->section_offsets.empty ())
     return; /* Is that even possible?  Better safe than sorry.  */
 
-  first_section_name = bfd_section_name (objfile->sections[0].the_bfd_section);
+  first_section_name
+    = bfd_section_name (objfile->sections_start[0].the_bfd_section);
 
   if (objfile->sect_index_text == 0
       && strcmp (first_section_name, ".text") != 0)