]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, gdbserver: make iterate_over_lwps_ftype a function_view
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 16 Apr 2026 20:16:14 +0000 (16:16 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 17 Apr 2026 19:30:29 +0000 (15:30 -0400)
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 <aburgess@redhat.com>
gdb/linux-nat.c
gdb/nat/linux-nat.h
gdbserver/linux-low.cc

index f141ba19ea448533146e0e414c436f5731b6fe98..362ef5f1cb7551458da68c11efbf129283a95c82 100644 (file)
@@ -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 ())
     {
index 708990acc4d9ae3f2da5b44d2862a4715f1f7cb1..42c0467191fe0d6c3e5441437231d45e85c5fbf5 100644 (file)
@@ -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.  */
 
index 0246217db86c9ffc16d3bcd2ca32db486cfcf282..022e8415fda802080260bbde951b6dc940d25cd0 100644 (file)
@@ -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)
     {