From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id AF2273858423 for ; Tue, 10 Oct 2023 20:46:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF2273858423 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A6F621E1A9; Tue, 10 Oct 2023 16:46:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 23/24] gdb: remove free_so function Date: Tue, 10 Oct 2023 16:40:18 -0400 Message-ID: <20231010204213.111285-24-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231010204213.111285-1-simon.marchi@efficios.com> References: <20231010204213.111285-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3496.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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_up; +using so_list_up = std::unique_ptr; /* Find main executable binary file. */ extern gdb::unique_xmalloc_ptr exec_file_find (const char *in_pathname, -- 2.42.0