aboutsummaryrefslogtreecommitdiff
path: root/gdb/sol-thread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-02-25 07:56:55 -0700
committerTom Tromey <tom@tromey.com>2025-03-11 08:39:58 -0600
commit58984e4ad22ac8bb8774b338625595ad9f6f55e9 (patch)
tree7136dbef89ee0cb08a72ab01adae76d410467980 /gdb/sol-thread.c
parentd8a30dd2a692053165ff3dfad1e93164180fc974 (diff)
downloadbinutils-58984e4ad22ac8bb8774b338625595ad9f6f55e9.zip
binutils-58984e4ad22ac8bb8774b338625595ad9f6f55e9.tar.gz
binutils-58984e4ad22ac8bb8774b338625595ad9f6f55e9.tar.bz2
Use gdb::function_view in iterate_over_threads
This C++-ifies iterate_over_threads, changing it to accept a gdb::function_view and to return bool. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/sol-thread.c')
-rw-r--r--gdb/sol-thread.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index db86079..d07377f 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1108,25 +1108,14 @@ info_solthreads (const char *args, int from_tty)
TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
}
-/* Callback routine used to find a thread based on the TID part of
- its PTID. */
-
-static int
-thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
-{
- ULONGEST *tid = (ULONGEST *) data;
-
- if (thread->ptid.tid () == *tid)
- return 1;
-
- return 0;
-}
-
ptid_t
sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
{
- struct thread_info *thread_info =
- iterate_over_threads (thread_db_find_thread_from_tid, &thread);
+ struct thread_info *thread_info
+ = iterate_over_threads ([&] (struct thread_info *thread)
+ {
+ return thread->ptid.tid () == thread;
+ });
if (thread_info == NULL)
{