aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-12-02 20:36:37 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2017-12-02 20:36:37 -0500
commit6b2a85daf5a5c20c6d4832de1f19109d9e1cf17a (patch)
tree3c61b743aef0d1f35aef8d98ddfd9b8a8e40ee6a /gdb/gdbserver
parent798a38e8de5f0fb5f7b17ae757b2bf4c5139c023 (diff)
downloadgdb-6b2a85daf5a5c20c6d4832de1f19109d9e1cf17a.zip
gdb-6b2a85daf5a5c20c6d4832de1f19109d9e1cf17a.tar.gz
gdb-6b2a85daf5a5c20c6d4832de1f19109d9e1cf17a.tar.bz2
Remove usage of find_inferior in linux_mourn
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.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/linux-low.c17
2 files changed, 9 insertions, 13 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index ce3cfc9..faee0c6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
+ * linux-low.c (delete_lwp_callback): Remove.
+ (linux_mourn): Use for_each_thread.
+
+2017-12-02 Simon Marchi <simon.marchi@polymtl.ca>
+
* linux-low.c (linux_detach_lwp_callback): Return void, remove
args parameter, don't check for pid.
(linux_detach): Use for_each_thread.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c495c24..498af11 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1643,18 +1643,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)
{
@@ -1664,7 +1652,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;