diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-11-19 22:23:23 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2017-11-19 22:23:23 -0500 |
commit | 6d1e5673fec830f0f1c86632a5d9333e34582bb3 (patch) | |
tree | 5b97ec9b3961721e101c4d4aca812c01617054fb /gdb/gdbserver/gdbthread.h | |
parent | bbf550d50e4c85666877456f014421089503e83b (diff) | |
download | binutils-6d1e5673fec830f0f1c86632a5d9333e34582bb3.zip binutils-6d1e5673fec830f0f1c86632a5d9333e34582bb3.tar.gz binutils-6d1e5673fec830f0f1c86632a5d9333e34582bb3.tar.bz2 |
Remove usage of find_inferior in iterate_over_lwps
Replace find_inferior with find_thread. Since it may be useful in the
future, I added another overload to find_thread which filters based on a
ptid (using ptid_t::matches), so now iterate_over_lwps doesn't have to
do the filtering itself. iterate_over_lwps_filter is removed and
inlined into iterate_over_lwps.
gdb/gdbserver/ChangeLog:
* gdbthread.h (find_thread): Add overload with ptid_t filter.
* linux-low.c (struct iterate_over_lwps_args): Remove.
(iterate_over_lwps_filter): Remove.
(iterate_over_lwps): Use find_thread.
Diffstat (limited to 'gdb/gdbserver/gdbthread.h')
-rw-r--r-- | gdb/gdbserver/gdbthread.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h index b82d5b0..df1e477 100644 --- a/gdb/gdbserver/gdbthread.h +++ b/gdb/gdbserver/gdbthread.h @@ -123,6 +123,18 @@ find_thread (int pid, Func func) }); } +/* Find the first thread that matches FILTER for which FUNC returns true. + Return NULL if no thread satisfying these conditions is found. */ + +template <typename Func> +static thread_info * +find_thread (ptid_t filter, Func func) +{ + return find_thread ([&] (thread_info *thread) { + return thread->id.matches (filter) && func (thread); + }); +} + /* Invoke FUNC for each thread. */ template <typename Func> |