This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 08/19] Remove usage of find_inferior in linux_mourn
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at polymtl dot ca>
- Date: Mon, 20 Nov 2017 11:34:32 -0500
- Subject: [PATCH 08/19] Remove usage of find_inferior in linux_mourn
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <1511195683-2055-1-git-send-email-simon.marchi@ericsson.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
From: Simon Marchi <simon.marchi@polymtl.ca>
Replace with for_each_thread with pid filtering. The callback becomes
trivial enough that it's better to inline it.
gdb/gdbserver/ChangeLog:
* linux-low.c (delete_lwp_callback): Remove.
(linux_mourn): Use for_each_thread.
---
gdb/gdbserver/linux-low.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index a4e19ba..6ec9a16 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1642,18 +1642,6 @@ linux_detach (int pid)
/* Remove all LWPs that belong to process PROC from the lwp list. */
-static int
-delete_lwp_callback (thread_info *thread, void *proc)
-{
- struct lwp_info *lwp = get_thread_lwp (thread);
- struct process_info *process = (struct process_info *) proc;
-
- if (pid_of (thread) == pid_of (process))
- delete_lwp (lwp);
-
- return 0;
-}
-
static void
linux_mourn (struct process_info *process)
{
@@ -1663,7 +1651,10 @@ linux_mourn (struct process_info *process)
thread_db_mourn (process);
#endif
- find_inferior (&all_threads, delete_lwp_callback, process);
+ for_each_thread (process->pid, [] (thread_info *thread)
+ {
+ delete_lwp (get_thread_lwp (thread));
+ });
/* Freeing all private data. */
priv = process->priv;
--
2.7.4