[PATCH 5/6] Remove clear_section_table

Tom Tromey tom@tromey.com
Sat Oct 3 19:37:34 GMT 2020


The call to clear_section_table in ~program_space is now clearly not
needed -- the section table will clear itself.  This patch removes
this call and then inlines the one remaining call to
clear_section_table.

2020-10-03  Tom Tromey  <tom@tromey.com>

	* progspace.c (program_space::~program_space): Don't call
	clear_section_table.
	* exec.h (clear_section_table): Don't declare.
	* exec.c (exec_target::close): Update.
	(clear_section_table): Remove.
---
 gdb/ChangeLog   |  8 ++++++++
 gdb/exec.c      | 10 +---------
 gdb/exec.h      |  4 ----
 gdb/progspace.c |  1 -
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/gdb/exec.c b/gdb/exec.c
index 43385fe978f..ab47757c2b4 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -183,7 +183,7 @@ exec_target::close ()
   for (struct program_space *ss : program_spaces)
     {
       set_current_program_space (ss);
-      clear_section_table (current_target_sections);
+      current_target_sections->sections.clear ();
       exec_close ();
     }
 }
@@ -577,14 +577,6 @@ file_command (const char *arg, int from_tty)
 }
 
 
-/* See exec.h.  */
-
-void
-clear_section_table (struct target_section_table *table)
-{
-  table->sections.clear ();
-}
-
 /* Builds a section table, given args BFD, TABLE.  */
 
 target_section_table
diff --git a/gdb/exec.h b/gdb/exec.h
index 75177dda96a..f28a033428d 100644
--- a/gdb/exec.h
+++ b/gdb/exec.h
@@ -38,10 +38,6 @@ struct objfile;
 
 extern target_section_table build_section_table (struct bfd *);
 
-/* Remove all entries from TABLE.  */
-
-extern void clear_section_table (struct target_section_table *table);
-
 /* The current inferior is a child vforked and its program space is
    shared with its parent.  This pushes the exec target on the
    current/child inferior's target stack if there are sections in the
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 3f512161215..67ea8bdb9e9 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -154,7 +154,6 @@ program_space::~program_space ()
   clear_symtab_users (SYMFILE_DEFER_BP_RESET);
   if (!gdbarch_has_shared_address_space (target_gdbarch ()))
     free_address_space (this->aspace);
-  clear_section_table (&this->target_sections);
   clear_program_space_solib_cache (this);
     /* Discard any data modules have associated with the PSPACE.  */
   program_space_free_data (this);
-- 
2.17.2



More information about the Gdb-patches mailing list