Remove for_each_inferior_with_data
authorSimon Marchi <simon.marchi@polymtl.ca>
Sun, 3 Dec 2017 01:36:46 +0000 (20:36 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 3 Dec 2017 01:38:37 +0000 (20:38 -0500)
Remove for_each_inferior_with_data, replacing its sole usage with
for_each_thread.

gdb/gdbserver/ChangeLog:

* inferiors.c (for_each_inferior_with_data): Remove.
* inferiors.h (for_each_inferior_with_data): Remove.
* server.c (handle_qxfer_threads_worker): Change parameter type.
(handle_qxfer_threads_proper): Use for_each_thread.

gdb/gdbserver/ChangeLog
gdb/gdbserver/inferiors.c
gdb/gdbserver/inferiors.h
gdb/gdbserver/server.c

index e852020395586c14dd07714664a094c4a32f3d8e..ccab17e350bf8f1baf8c4dbf24f956f3759811a0 100644 (file)
@@ -1,3 +1,10 @@
+2017-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * inferiors.c (for_each_inferior_with_data): Remove.
+       * inferiors.h (for_each_inferior_with_data): Remove.
+       * server.c (handle_qxfer_threads_worker): Change parameter type.
+       (handle_qxfer_threads_proper): Use for_each_thread.
+
 2017-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * inferiors.c (for_each_inferior): Remove.
index 093080dc5549f306c207dbfac175bee4f09b35f9..6f4427c2c7208ba36532d0f26d2ae9d99c7ae88f 100644 (file)
@@ -30,18 +30,6 @@ struct thread_info *current_thread;
 /* The current working directory used to start the inferior.  */
 static const char *current_inferior_cwd = NULL;
 
-void
-for_each_inferior_with_data (std::list<thread_info *> *thread_list,
-                            void (*action) (thread_info *, void *),
-                            void *data)
-{
-  gdb_assert (thread_list == &all_threads);
-
-  for_each_thread ([&] (thread_info *thread) {
-    action (thread, data);
-  });
-}
-
 struct thread_info *
 add_thread (ptid_t thread_id, void *target_data)
 {
index 030d9c368af348096d59e800ce59a61fb4c6523e..947b56e75cb676e5721d549daf09144164c516a3 100644 (file)
@@ -140,10 +140,6 @@ int have_attached_inferiors_p (void);
 
 void clear_inferiors (void);
 
-void for_each_inferior_with_data (std::list<thread_info *> *thread_list,
-                                 void (*action) (thread_info *, void *),
-                                 void *data);
-
 void *thread_target_data (struct thread_info *);
 struct regcache *thread_regcache_data (struct thread_info *);
 void set_thread_regcache_data (struct thread_info *, struct regcache *);
index cfc4a128d7b37492a659c09f418ec165ae34d9ba..e2b75376eec64bd9da20980c8cce818649099ff9 100644 (file)
@@ -1650,9 +1650,8 @@ handle_qxfer_statictrace (const char *annex,
    Emit the XML to describe the thread of INF.  */
 
 static void
-handle_qxfer_threads_worker (thread_info *thread, void *arg)
+handle_qxfer_threads_worker (thread_info *thread, struct buffer *buffer)
 {
-  struct buffer *buffer = (struct buffer *) arg;
   ptid_t ptid = ptid_of (thread);
   char ptid_s[100];
   int core = target_core_of_thread (ptid);
@@ -1692,8 +1691,10 @@ handle_qxfer_threads_proper (struct buffer *buffer)
 {
   buffer_grow_str (buffer, "<threads>\n");
 
-  for_each_inferior_with_data (&all_threads, handle_qxfer_threads_worker,
-                              buffer);
+  for_each_thread ([&] (thread_info *thread)
+    {
+      handle_qxfer_threads_worker (thread, buffer);
+    });
 
   buffer_grow_str0 (buffer, "</threads>\n");
 }