From: Simon Marchi Date: Thu, 16 Apr 2026 20:16:14 +0000 (-0400) Subject: gdb, gdbserver: make iterate_over_lwps_ftype a function_view X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e71ab8393e4b25296adeea32f65bd612197aea09;p=thirdparty%2Fbinutils-gdb.git gdb, gdbserver: make iterate_over_lwps_ftype a function_view All users of iterate_over_lwps_ftype use it within a function_view template. Integrate function_view to the type alias. Change-Id: I3eb23aa3dbc1889072a5d4654e861b00942d6c3f Approved-By: Andrew Burgess --- diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index f141ba19ea4..362ef5f1cb7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -928,9 +928,8 @@ find_lwp_pid (ptid_t ptid) /* See nat/linux-nat.h. */ -struct lwp_info * -iterate_over_lwps (ptid_t filter, - gdb::function_view callback) +lwp_info * +iterate_over_lwps (ptid_t filter, iterate_over_lwps_ftype callback) { for (lwp_info &lp : all_lwps_safe ()) { diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h index 708990acc4d..42c0467191f 100644 --- a/gdb/nat/linux-nat.h +++ b/gdb/nat/linux-nat.h @@ -47,7 +47,7 @@ extern tribool have_ptrace_getregset; extern ptid_t current_lwp_ptid (void); /* Function type for the CALLBACK argument of iterate_over_lwps. */ -typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp); +using iterate_over_lwps_ftype = gdb::function_view; /* Iterate over all LWPs. Calls CALLBACK with its second argument set to DATA for every LWP in the list. If CALLBACK returns nonzero for @@ -55,9 +55,8 @@ typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp); LWP immediately. Otherwise return NULL. This function must be provided by the client. */ -extern struct lwp_info *iterate_over_lwps - (ptid_t filter, - gdb::function_view callback); +extern lwp_info *iterate_over_lwps (ptid_t filter, + iterate_over_lwps_ftype callback); /* Return the ptid of LWP. */ diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 0246217db86..022e8415fda 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -1768,9 +1768,8 @@ num_lwps (process_info *process) /* See nat/linux-nat.h. */ -struct lwp_info * -iterate_over_lwps (ptid_t filter, - gdb::function_view callback) +lwp_info * +iterate_over_lwps (ptid_t filter, iterate_over_lwps_ftype callback) { thread_info *thread = find_thread (filter, [&] (thread_info *thr_arg) {