Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH v2 10/16] Change clear_program_space_solib_cache to method on program_space
Date: Mon, 19 Oct 2020 15:44:23 -0600	[thread overview]
Message-ID: <20201019214429.13815-11-tom@tromey.com> (raw)
In-Reply-To: <20201019214429.13815-1-tom@tromey.com>

This changes clear_program_space_solib_cache to be a method on
program_space.  Also, it removes a call to this function from the
program_space destructor, as that is not necessary.

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

	* progspace.c (program_space::~program_space): Don't call
	clear_program_space_solib_cache.
	(program_space::clear_solib_cache): Rename from
	clear_solib_cache.
	* solib.c (handle_solib_event): Update.
	* progspace.h (struct program_space) <clear_solib_cache>: New
	method.
	(clear_program_space_solib_cache): Don't declare.
---
 gdb/ChangeLog   | 11 +++++++++++
 gdb/progspace.c |  7 +++----
 gdb/progspace.h | 10 +++++-----
 gdb/solib.c     |  2 +-
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/gdb/progspace.c b/gdb/progspace.c
index 52482ca8f64..84baaeab292 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_program_space_solib_cache (this);
     /* Discard any data modules have associated with the PSPACE.  */
   program_space_free_data (this);
 }
@@ -448,10 +447,10 @@ update_address_spaces (void)
 /* See progspace.h.  */
 
 void
-clear_program_space_solib_cache (struct program_space *pspace)
+program_space::clear_solib_cache ()
 {
-  pspace->added_solibs.clear ();
-  pspace->deleted_solibs.clear ();
+  added_solibs.clear ();
+  deleted_solibs.clear ();
 }
 
 \f
diff --git a/gdb/progspace.h b/gdb/progspace.h
index e719cee57d0..22805d74f37 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -288,6 +288,11 @@ struct program_space
     ebfd = std::move (abfd);
   }
 
+  /* Reset saved solib data at the start of an solib event.  This lets
+     us properly collect the data when calling solib_add, so it can then
+     later be printed.  */
+  void clear_solib_cache ();
+
   /* Unique ID number.  */
   int num = 0;
 
@@ -435,11 +440,6 @@ extern int address_space_num (struct address_space *aspace);
    mappings.  */
 extern void update_address_spaces (void);
 
-/* Reset saved solib data at the start of an solib event.  This lets
-   us properly collect the data when calling solib_add, so it can then
-   later be printed.  */
-extern void clear_program_space_solib_cache (struct program_space *);
-
 /* Keep a registry of per-pspace data-pointers required by other GDB
    modules.  */
 
diff --git a/gdb/solib.c b/gdb/solib.c
index 9df4eca888a..baa1801635b 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1252,7 +1252,7 @@ handle_solib_event (void)
   if (ops->handle_event != NULL)
     ops->handle_event ();
 
-  clear_program_space_solib_cache (current_inferior ()->pspace);
+  current_inferior ()->pspace->clear_solib_cache ();
 
   /* Check for any newly added shared libraries if we're supposed to
      be adding them automatically.  Switch terminal for any messages
-- 
2.17.2


  parent reply	other threads:[~2020-10-19 21:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 21:44 [PATCH v2 00/16] Remove some macros from exec.h and progspace.h Tom Tromey
2020-10-19 21:44 ` [PATCH v2 01/16] Add target_section constructor Tom Tromey
2020-10-19 21:44 ` [PATCH v2 02/16] Remove exec_filename macro Tom Tromey
2020-10-19 21:44 ` [PATCH v2 03/16] Change exec_close to be a method on program_space Tom Tromey
2020-10-19 21:44 ` [PATCH v2 04/16] Remove commented-out code from gcore.c Tom Tromey
2020-10-20 14:01   ` [PP?] " Simon Marchi
2020-10-29  1:19     ` Tom Tromey
2020-10-19 21:44 ` [PATCH v2 05/16] Remove exec_bfd_mtime define Tom Tromey
2020-10-19 21:44 ` [PATCH v2 06/16] Remove current_target_sections macro Tom Tromey
2020-10-19 21:44 ` [PATCH v2 07/16] Remove the exec_bfd macro Tom Tromey
2020-10-20 14:24   ` Simon Marchi
2020-10-20 21:20     ` Tom Tromey
2020-10-20 21:34       ` Simon Marchi
2020-10-19 21:44 ` [PATCH v2 08/16] Change program_space::ebfd to a gdb_bfd_ref_ptr Tom Tromey
2020-10-19 21:44 ` [PATCH v2 09/16] Remove symfile_objfile macro Tom Tromey
2020-10-19 21:44 ` Tom Tromey [this message]
2020-10-19 21:44 ` [PATCH v2 11/16] Change program_space_empty_p to method on program_space Tom Tromey
2020-10-19 21:44 ` [PATCH v2 12/16] Change remove_target_sections " Tom Tromey
2020-10-20 14:40   ` [PP?] " Simon Marchi
2020-10-29  1:24     ` Tom Tromey
2020-10-19 21:44 ` [PATCH v2 13/16] Change add_target_sections " Tom Tromey
2020-10-19 21:44 ` [PATCH v2 14/16] Change add_target_sections_of_objfile " Tom Tromey
2020-10-19 21:44 ` [PATCH v2 15/16] Don't change current program space in exec_target::close Tom Tromey
2020-10-19 21:44 ` [PATCH v2 16/16] Remove call to exec_close Tom Tromey
2020-10-20 14:46 ` [PP?] [PATCH v2 00/16] Remove some macros from exec.h and progspace.h Simon Marchi
2020-10-29 21:06   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201019214429.13815-11-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox