public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 19/19] Remove for_each_inferior_with_data
Date: Mon, 20 Nov 2017 16:35:00 -0000	[thread overview]
Message-ID: <1511195683-2055-20-git-send-email-simon.marchi@ericsson.com> (raw)
In-Reply-To: <1511195683-2055-1-git-send-email-simon.marchi@ericsson.com>

From: Simon Marchi <simon.marchi@polymtl.ca>

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/inferiors.c | 12 ------------
 gdb/gdbserver/inferiors.h |  4 ----
 gdb/gdbserver/server.c    |  9 +++++----
 3 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 093080d..6f4427c 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -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)
 {
diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h
index 030d9c3..947b56e 100644
--- a/gdb/gdbserver/inferiors.h
+++ b/gdb/gdbserver/inferiors.h
@@ -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 *);
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index cfc4a12..e2b7537 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -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");
 }
-- 
2.7.4

  parent reply	other threads:[~2017-11-20 16:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 16:35 [PATCH 00/19] Remove find_inferior* and for_each_inferior* Simon Marchi
2017-11-20 16:35 ` [PATCH 03/19] Remove usages of find_inferior in linux-mips-low.c Simon Marchi
2017-11-20 16:35 ` [PATCH 08/19] Remove usage of find_inferior in linux_mourn Simon Marchi
2017-11-20 16:35 ` [PATCH 07/19] Remove usage of find_inferior in linux_detach Simon Marchi
2017-11-20 16:35 ` [PATCH 15/19] Remove usages of find_inferior that call proceed_one_lwp Simon Marchi
2017-11-20 16:35 ` [PATCH 06/19] Remove usage of find_inferior in last_thread_of_process_p Simon Marchi
2017-11-20 16:35 ` [PATCH 18/19] Remove for_each_inferior Simon Marchi
2017-11-20 16:35 ` [PATCH 02/19] Remove usage of find_inferior in lynx_mourn Simon Marchi
2017-11-20 16:35 ` [PATCH 12/19] Remove usage of find_inferior in linux_stabilize_threads Simon Marchi
2017-11-20 16:35 ` Simon Marchi [this message]
2017-11-20 16:35 ` [PATCH 04/19] Remove find_inferior_id Simon Marchi
2017-11-20 16:35 ` [PATCH 10/19] Remove usages of find_inferior calling not_stopped_callback Simon Marchi
2017-11-20 16:35 ` [PATCH 16/19] Update comments Simon Marchi
2017-11-20 16:35 ` [PATCH 01/19] Remove usage of find_inferior in regcache_invalidate_pid Simon Marchi
2017-11-20 16:35 ` [PATCH 05/19] Remove find_inferior_in_random Simon Marchi
2017-11-20 16:35 ` [PATCH 13/19] Remove usages of find_inferior in stop_all_lwps Simon Marchi
2017-11-20 16:35 ` [PATCH 09/19] Remove usage of find_inferior in find_lwp_pid Simon Marchi
2017-11-20 16:35 ` [PATCH 14/19] Remove usage of find_inferior in linux_resume Simon Marchi
2017-11-20 16:35 ` [PATCH 11/19] Remove usages of find_inferior in select_event_lwp Simon Marchi
2017-11-20 16:35 ` [PATCH 17/19] Remove find_inferior Simon Marchi
2017-12-03  1:48 ` [PATCH 00/19] Remove find_inferior* and for_each_inferior* Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1511195683-2055-20-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).