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@ericsson.com>
Subject: [PATCH 07/11] Remove usage of find_inferior in linux_stabilize_threads
Date: Fri, 17 Nov 2017 18:34:00 -0000	[thread overview]
Message-ID: <1510943613-18598-8-git-send-email-simon.marchi@ericsson.com> (raw)
In-Reply-To: <1510943613-18598-1-git-send-email-simon.marchi@ericsson.com>

Simply replace with find_thread.

gdb/gdbserver/ChangeLog:

	* linux-low.c (stuck_in_jump_pad_callback): Change prototype,
	return bool, remove data argument.
	(linux_stabilize_threads): Use find_thread.
---
 gdb/gdbserver/linux-low.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index fce3fd0..b4c716c 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -2985,7 +2985,7 @@ unsuspend_all_lwps (struct lwp_info *except)
 }
 
 static void move_out_of_jump_pad_callback (thread_info *thread);
-static int stuck_in_jump_pad_callback (thread_info *thread, void *data);
+static bool stuck_in_jump_pad_callback (thread_info *thread);
 static int lwp_running (thread_info *thread, void *data);
 static ptid_t linux_wait_1 (ptid_t ptid,
 			    struct target_waitstatus *ourstatus,
@@ -3024,13 +3024,8 @@ static ptid_t linux_wait_1 (ptid_t ptid,
 static void
 linux_stabilize_threads (void)
 {
-  struct thread_info *saved_thread;
-  struct thread_info *thread_stuck;
+  thread_info *thread_stuck = find_thread (stuck_in_jump_pad_callback);
 
-  thread_stuck
-    = (struct thread_info *) find_inferior (&all_threads,
-					    stuck_in_jump_pad_callback,
-					    NULL);
   if (thread_stuck != NULL)
     {
       if (debug_threads)
@@ -3039,7 +3034,7 @@ linux_stabilize_threads (void)
       return;
     }
 
-  saved_thread = current_thread;
+  thread_info *saved_thread = current_thread;
 
   stabilizing_threads = 1;
 
@@ -3082,10 +3077,8 @@ linux_stabilize_threads (void)
 
   if (debug_threads)
     {
-      thread_stuck
-	= (struct thread_info *) find_inferior (&all_threads,
-						stuck_in_jump_pad_callback,
-						NULL);
+      thread_stuck = find_thread (stuck_in_jump_pad_callback);
+
       if (thread_stuck != NULL)
 	debug_printf ("couldn't stabilize, LWP %ld got stuck in jump pad\n",
 		      lwpid_of (thread_stuck));
@@ -4111,13 +4104,13 @@ wait_for_sigstop (void)
     }
 }
 
-/* Returns true if LWP ENTRY is stopped in a jump pad, and we can't
+/* Returns true if THREAD is stopped in a jump pad, and we can't
    move it out, because we need to report the stop event to GDB.  For
    example, if the user puts a breakpoint in the jump pad, it's
    because she wants to debug it.  */
 
-static int
-stuck_in_jump_pad_callback (thread_info *thread, void *data)
+static bool
+stuck_in_jump_pad_callback (thread_info *thread)
 {
   struct lwp_info *lwp = get_thread_lwp (thread);
 
-- 
2.7.4

  parent reply	other threads:[~2017-11-17 18:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 18:33 [PATCH 00/11] Remove some usages of find_inferior Simon Marchi
2017-11-17 18:34 ` [PATCH 04/11] Remove usage of find_inferior in reset_lwp_ptrace_options_callback Simon Marchi
2017-11-17 18:34 ` [PATCH 08/11] Remove usage of find_inferior when calling linux_set_resume_request Simon Marchi
2017-11-17 18:34 ` [PATCH 06/11] Remove usage of find_inferior in unsuspend_all_lwps Simon Marchi
2017-11-17 18:34 ` Simon Marchi [this message]
2017-11-17 18:34 ` [PATCH 11/11] Remove usage of find_inferior when calling kill_one_lwp_callback Simon Marchi
2017-11-17 18:34 ` [PATCH 09/11] Remove usage of find_thread when calling resume_status_pending_p Simon Marchi
2017-11-17 18:34 ` [PATCH 01/11] Remove usage of find_inferior in win32-i386-low.c Simon Marchi
2017-11-17 18:34 ` [PATCH 10/11] Remove usages of find_thread when calling need_step_over_p Simon Marchi
2017-11-17 18:34 ` [PATCH 02/11] Remove usage of find_inferior in win32-low.c Simon Marchi
2017-11-17 18:34 ` [PATCH 05/11] Remove usage of find_inferior in iterate_over_lwps Simon Marchi
2017-11-17 18:34 ` [PATCH 03/11] Remove usages of find_inferior in linux-arm-low.c Simon Marchi
2017-11-19 19:21 ` [PATCH 00/11] Remove some usages of find_inferior Sergio Durigan Junior
2017-11-20  3:24   ` 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=1510943613-18598-8-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /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).