public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 23/24] gdb: remove free_so function
Date: Tue, 10 Oct 2023 16:40:18 -0400	[thread overview]
Message-ID: <20231010204213.111285-24-simon.marchi@efficios.com> (raw)
In-Reply-To: <20231010204213.111285-1-simon.marchi@efficios.com>

Remove this function, replace it with deleting the so_list in callers.

Change-Id: Idbd0cb84674ade1d8e17af471550dbd388264f60
---
 gdb/solib-svr4.c |  2 +-
 gdb/solib.c      | 24 +++---------------------
 gdb/solist.h     | 14 +-------------
 3 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 6311599ff709..4628c487ff79 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1478,7 +1478,7 @@ svr4_current_sos ()
 	  if (address_in_mem_range (li->l_ld, &vsyscall_range))
 	    {
 	      auto next = sos.erase (so);
-	      free_so (*so);
+	      delete &*so;
 	      so = next;
 	      break;
 	    }
diff --git a/gdb/solib.c b/gdb/solib.c
index 2e4881798339..5272dce6fa4a 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -650,24 +650,6 @@ so_list::clear ()
 
 lm_info::~lm_info () = default;
 
-/* Free the storage associated with the `struct so_list' object SO.
-   If we have opened a BFD for SO, close it.
-
-   The caller is responsible for removing SO from whatever list it is
-   a member of.  If we have placed SO's sections in some target's
-   section table, the caller is responsible for removing them.
-
-   This function doesn't mess with objfiles at all.  If there is an
-   objfile associated with SO that needs to be removed, the caller is
-   responsible for taking care of that.  */
-
-void
-free_so (so_list &so)
-{
-  delete &so;
-}
-
-
 /* Read in symbols for shared object SO.  If SYMFILE_VERBOSE is set in FLAGS,
    be chatty about it.  Return true if any symbols were actually loaded.  */
 
@@ -845,7 +827,7 @@ update_solib_list (int from_tty)
       if (inferior_iter != inferior.end ())
 	{
 	  inferior.erase (inferior_iter);
-	  free_so (*inferior_iter);
+	  delete &*inferior_iter;
 	  ++gdb_iter;
 	}
 
@@ -871,7 +853,7 @@ update_solib_list (int from_tty)
 	     sections from so.abfd; remove them.  */
 	  current_program_space->remove_target_sections (&*gdb_iter);
 
-	  free_so (*gdb_iter);
+	  delete &*gdb_iter;
 	  gdb_iter = gdb_iter_next;
 	}
     }
@@ -1214,7 +1196,7 @@ clear_solib (void)
     {
       notify_solib_unloaded (current_program_space, so);
       current_program_space->remove_target_sections (&so);
-      free_so (so);
+      delete &so;
     });
 
 
diff --git a/gdb/solist.h b/gdb/solist.h
index 31b823a3a482..4232156c17a7 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -171,20 +171,8 @@ struct target_so_ops
   void (*handle_event) (void);
 };
 
-/* Free the memory associated with a (so_list *).  */
-void free_so (so_list &so);
-
-/* A deleter that calls free_so.  */
-struct so_deleter
-{
-  void operator() (struct so_list *so) const
-  {
-    free_so (*so);
-  }
-};
-
 /* A unique pointer to a so_list.  */
-typedef std::unique_ptr<so_list, so_deleter> so_list_up;
+using so_list_up = std::unique_ptr<so_list>;
 
 /* Find main executable binary file.  */
 extern gdb::unique_xmalloc_ptr<char> exec_file_find (const char *in_pathname,
-- 
2.42.0


  parent reply	other threads:[~2023-10-10 20:46 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 20:39 [PATCH 00/24] C++ification of struct so_list Simon Marchi
2023-10-10 20:39 ` [PATCH 01/24] gdb: remove empty clear_solib functions Simon Marchi
2023-10-10 20:39 ` [PATCH 02/24] gdb: add program_space parameter to target_so_ops::clear_solib Simon Marchi
2023-10-17 14:57   ` Pedro Alves
2023-10-17 15:19     ` Simon Marchi
2023-10-10 20:39 ` [PATCH 03/24] gdb: make interps_notify work with references Simon Marchi
2023-10-11  8:48   ` Lancelot SIX
2023-10-11 14:18     ` Simon Marchi
2023-10-10 20:39 ` [PATCH 04/24] gdb: replace some so_list parameters to use references Simon Marchi
2023-10-19 11:07   ` [PATCH 4/24] " Lancelot SIX
2023-10-19 14:49     ` Simon Marchi
2023-10-19 15:20       ` Lancelot SIX
2023-10-19 16:07         ` Simon Marchi
2023-10-10 20:40 ` [PATCH 05/24] gdbsupport: use "reference" and "pointer" type aliases in intrusive_list Simon Marchi
2023-10-10 20:40 ` [PATCH 06/24] gdbsupport: make intrusive_list's disposer accept a reference Simon Marchi
2023-10-12 19:05   ` Pedro Alves
2023-10-14 20:12     ` Simon Marchi
2023-10-10 20:40 ` [PATCH 07/24] gdb: make get_cbfd_soname_build_id static Simon Marchi
2023-10-10 20:40 ` [PATCH 08/24] gdb: allocate so_list with new, deallocate with delete Simon Marchi
2023-10-10 20:40 ` [PATCH 09/24] gdb: rename lm_info_base to lm_info Simon Marchi
2023-10-10 20:40 ` [PATCH 10/24] gdb: remove target_so_ops::free_so Simon Marchi
2023-10-10 20:40 ` [PATCH 11/24] gdb: use gdb::checked_static_cast when casting lm_info Simon Marchi
2023-10-10 20:40 ` [PATCH 12/24] gdb: make solib-svr4 not use so_list internally Simon Marchi
2023-10-13 17:52   ` Lancelot SIX
2023-10-14 19:59     ` Simon Marchi
2023-10-19 11:08   ` Lancelot SIX
2023-10-19 14:50     ` Simon Marchi
2023-10-10 20:40 ` [PATCH 13/24] gdb: make solib-rocm " Simon Marchi
2023-10-13 18:35   ` Lancelot SIX
2023-10-14 20:00     ` Simon Marchi
2023-10-17 15:23   ` Pedro Alves
2023-10-17 15:32     ` Simon Marchi
2023-10-10 20:40 ` [PATCH 14/24] gdb: remove lm_info_vector typedef Simon Marchi
2023-10-10 20:40 ` [PATCH 15/24] gdb: make so_list::lm_info a unique_ptr Simon Marchi
2023-10-10 20:40 ` [PATCH 16/24] gdb: make clear_so a method of struct so_list Simon Marchi
2023-10-19 11:08   ` Lancelot SIX
2023-10-19 14:52     ` Simon Marchi
2023-10-10 20:40 ` [PATCH 17/24] gdb: remove target_section_table typedef Simon Marchi
2023-10-10 20:40 ` [PATCH 18/24] gdb: make so_list::sections not a pointer Simon Marchi
2023-10-10 20:40 ` [PATCH 19/24] gdb: make so_list::abfd a gdb_bfd_ref_ptr Simon Marchi
2023-10-10 20:40 ` [PATCH 20/24] gdb: make so_list::{so_original_name,so_name} std::strings Simon Marchi
2023-10-13 22:28   ` [PATCH 20/24] gdb: make so_list::{so_original_name, so_name} std::strings Lancelot SIX
2023-10-14 20:01     ` Simon Marchi
2023-10-19 11:08   ` [PATCH 20/24] gdb: make so_list::{so_original_name,so_name} std::strings Lancelot SIX
2023-10-19 14:55     ` Simon Marchi
2023-10-10 20:40 ` [PATCH 21/24] gdb: link so_list using intrusive_list Simon Marchi
2023-10-17 19:14   ` Pedro Alves
2023-10-17 19:38     ` Simon Marchi
2023-10-10 20:40 ` [PATCH 22/24] gdb: don't call so_list::clear in free_so Simon Marchi
2023-10-10 20:40 ` Simon Marchi [this message]
2023-10-10 20:49 ` [PATCH 24/24] gdb: rename struct so_list to so Simon Marchi
2023-10-17 19:20 ` [PATCH 00/24] C++ification of struct so_list Pedro Alves
2023-10-17 19:53   ` Simon Marchi
2023-10-20 14:40     ` Pedro Alves
2023-10-19 11:09 ` [PATCH 0/24] " Lancelot SIX
2023-10-19 14:57   ` Simon Marchi

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=20231010204213.111285-24-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).