This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 02/19] Remove usage of find_inferior in lynx_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:26 -0500
- Subject: [PATCH 02/19] Remove usage of find_inferior in lynx_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 it with for_each_thread with pid filtering. We can remove
lynx_delete_thread_callback and pass remove_thread directly.
I can't build/test this change, but it should be obvious enough.
gdb/gdbserver/ChangeLog:
* lynx.low (lynx_delete_thread_callback): Remove.
(lynx_mourn): Use for_each_thread.
---
gdb/gdbserver/lynx-low.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index ca9adc4..6039364 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -555,26 +555,12 @@ lynx_detach (int pid)
return 0;
}
-/* A callback for find_inferior which removes from the thread list
- all threads belonging to process PROC. */
-
-static int
-lynx_delete_thread_callback (thread_info *thread, void *proc)
-{
- struct process_info *process = (struct process_info *) proc;
-
- if (thread->id.pid () == pid_of (process))
- remove_thread (thread);
-
- return 0;
-}
-
/* Implement the mourn target_ops method. */
static void
lynx_mourn (struct process_info *proc)
{
- find_inferior (&all_threads, lynx_delete_thread_callback, proc);
+ for_each_thread (proc->pid, remove_thread);
/* Free our private data. */
free (proc->priv);
--
2.7.4