[binutils-gdb] gdb, gdbserver: make iterate_over_lwps_ftype a function_view
Simon Marchi via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e71ab8393e4b25296adeea32f65bd612197aea09 commit e71ab8393e4b25296adeea32f65bd612197aea09 Author: Simon Marchi <[email protected]> Date: Thu Apr 16 16:16:14 2026 -0400 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 <[email protected]> Diff: --- gdb/linux-nat.c | 5 ++--- gdb/nat/linux-nat.h | 7 +++---- gdbserver/linux-low.cc | 5 ++--- 3 files changed, 7 insertions(+), 10 deletions(-) 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<iterate_over_lwps_ftype> 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<int (lwp_info *lwp)>; /* 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<iterate_over_lwps_ftype> 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<iterate_over_lwps_ftype> callback) +lwp_info * +iterate_over_lwps (ptid_t filter, iterate_over_lwps_ftype callback) { thread_info *thread = find_thread (filter, [&] (thread_info *thr_arg) {