Change add_target_sections_of_objfile to method on program_space
authorTom Tromey <tom@tromey.com>
Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 29 Oct 2020 21:04:40 +0000 (15:04 -0600)
This changes add_target_sections_of_objfile to be a method on
program_space.  It is renamed to be another overload of
add_target_sections, because they are semantically equivalent in a
sense.

gdb/ChangeLog
2020-10-29  Tom Tromey  <tom@tromey.com>

* symfile.c (add_symbol_file_command): Update.
* exec.c (program_space::add_target_sections): Rename.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* progspace.h (struct program_space) <add_target_sections>:
Declare new overload.
* exec.h (add_target_sections_of_objfile): Don't declare.

gdb/ChangeLog
gdb/exec.c
gdb/exec.h
gdb/progspace.h
gdb/symfile-mem.c
gdb/symfile.c

index 3aeb0d12d1c527ac4121e76e7a7f9dccc058924c..4096a1bff52b75eed1f53068f0fcf6c578717e47 100644 (file)
@@ -1,3 +1,12 @@
+2020-10-29  Tom Tromey  <tom@tromey.com>
+
+       * symfile.c (add_symbol_file_command): Update.
+       * exec.c (program_space::add_target_sections): Rename.
+       * symfile-mem.c (symbol_file_add_from_memory): Update.
+       * progspace.h (struct program_space) <add_target_sections>:
+       Declare new overload.
+       * exec.h (add_target_sections_of_objfile): Don't declare.
+
 2020-10-29  Tom Tromey  <tom@tromey.com>
 
        * solib.c (solib_map_sections): Update.
index a57399b0e34ab2bdc8abeba3f6c636a1cbfc0257..9c4d9bef908afbb070f4bde421d195c0ad39dd25 100644 (file)
@@ -628,9 +628,8 @@ program_space::add_target_sections (void *owner,
 /* Add the sections of OBJFILE to the current set of target sections.  */
 
 void
-add_target_sections_of_objfile (struct objfile *objfile)
+program_space::add_target_sections (struct objfile *objfile)
 {
-  target_section_table *table = &current_program_space->target_sections;
   struct obj_section *osect;
 
   gdb_assert (objfile != nullptr);
@@ -641,9 +640,9 @@ add_target_sections_of_objfile (struct objfile *objfile)
       if (bfd_section_size (osect->the_bfd_section) == 0)
        continue;
 
-      table->emplace_back (obj_section_addr (osect),
-                          obj_section_endaddr (osect),
-                          osect->the_bfd_section, (void *) objfile);
+      target_sections.emplace_back (obj_section_addr (osect),
+                                   obj_section_endaddr (osect),
+                                   osect->the_bfd_section, (void *) objfile);
     }
 }
 
index 3aa248527c9e9a680c0b749315bb3e7ff0c914e2..4ddc6850be1fa4cf2c5fa9cabb06e352df026d64 100644 (file)
@@ -92,11 +92,6 @@ extern enum target_xfer_status
 /* Set the loaded address of a section.  */
 extern void exec_set_section_address (const char *, int, CORE_ADDR);
 
-/* Add the sections of OBJFILE to the current set of target sections.
- * OBJFILE owns the new target sections.  */
-
-extern void add_target_sections_of_objfile (struct objfile *objfile);
-
 /* Prints info about all sections defined in the TABLE.  ABFD is
    special cased --- it's filename is omitted; if it is the executable
    file, its entry point is printed.  */
index 92a7942c560eaa7be9f3739ce7e0ad11402c13d7..c141731fa944450735f3551d2bf966af120d2257 100644 (file)
@@ -305,6 +305,10 @@ struct program_space
   void add_target_sections (void *owner,
                            const target_section_table &sections);
 
+  /* Add the sections of OBJFILE to the current set of target
+     sections.  They are given OBJFILE as the "owner".  */
+  void add_target_sections (struct objfile *objfile);
+
   /* Unique ID number.  */
   int num = 0;
 
index 916c37cb9f8805723e06505d6c979736c08a77ca..914976ce72a9765e18d9f02763957f3c483f2752 100644 (file)
@@ -122,7 +122,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
   objf = symbol_file_add_from_bfd (nbfd, bfd_get_filename (nbfd),
                                   add_flags, &sai, OBJF_SHARED, NULL);
 
-  add_target_sections_of_objfile (objf);
+  current_program_space->add_target_sections (objf);
 
   /* This might change our ideas about frames already looked at.  */
   reinit_frame_cache ();
index 504132754b050d60729c0cc0c5907d5f36eb1160..58ed660e52a5dcdddf4a386d4f39664109910424 100644 (file)
@@ -2323,7 +2323,7 @@ add_symbol_file_command (const char *args, int from_tty)
   if (seen_offset)
     set_objfile_default_section_offset (objf, section_addrs, offset);
 
-  add_target_sections_of_objfile (objf);
+  current_program_space->add_target_sections (objf);
 
   /* Getting new symbols may change our opinion about what is
      frameless.  */
This page took 0.038408 seconds and 4 git commands to generate.