From: Simon Marchi Date: Sat, 28 Oct 2017 03:41:49 +0000 (-0400) Subject: Remove usages of find_inferior in handle_status X-Git-Tag: users/ARM/embedded-binutils-master-2017q4~429 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99078d344db25efc376877e0e4c95157f0c36c60;p=platform%2Fupstream%2Fbinutils.git Remove usages of find_inferior in handle_status Replace one with find_thread, the other with for_each_thread. gdb/gdbserver/ChangeLog: * server.c (queue_stop_reply_callback): Change prototype, return void. (find_status_pending_thread_callback): Remove. (handle_status): Replace find_inferior with find_thread and for_each_thread. --- diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index b314076..87d870e 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2017-10-27 Simon Marchi + + * server.c (queue_stop_reply_callback): Change prototype, return + void. + (find_status_pending_thread_callback): Remove. + (handle_status): Replace find_inferior with find_thread and + for_each_thread. + 2017-10-25 Alan Hayward * linux-aarch64-low.c (aarch64_fill_gregset): Replace defines diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 892d765..650cf1c 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -3230,8 +3230,8 @@ myresume (char *own_buf, int step, int sig) /* Callback for for_each_inferior. Make a new stop reply for each stopped thread. */ -static int -queue_stop_reply_callback (thread_info *thread, void *arg) +static void +queue_stop_reply_callback (thread_info *thread) { /* For now, assume targets that don't have this callback also don't manage the thread's last_status field. */ @@ -3267,8 +3267,6 @@ queue_stop_reply_callback (thread_info *thread, void *arg) queue_stop_reply (thread->id, &thread->last_status); } } - - return 0; } /* Set this inferior threads's state as "want-stopped". We won't @@ -3324,15 +3322,6 @@ set_pending_status_callback (thread_info *thread) thread->status_pending_p = 1; } -/* Callback for find_inferior. Return true if ENTRY (a thread) has a - pending status to report to GDB. */ - -static int -find_status_pending_thread_callback (thread_info *thread, void *data) -{ - return thread->status_pending_p; -} - /* Status handler for the '?' packet. */ static void @@ -3349,7 +3338,7 @@ handle_status (char *own_buf) if (non_stop) { - find_inferior (&all_threads, queue_stop_reply_callback, NULL); + for_each_thread (queue_stop_reply_callback); /* The first is sent immediatly. OK is sent if there is no stopped thread, which is the same handling of the vStopped @@ -3382,8 +3371,10 @@ handle_status (char *own_buf) /* If the last event thread is not found for some reason, look for some other thread that might have an event to report. */ if (thread == NULL) - thread = find_inferior (&all_threads, - find_status_pending_thread_callback, NULL); + thread = find_thread ([] (thread_info *thread) + { + return thread->status_pending_p; + }); /* If we're still out of luck, simply pick the first thread in the thread list. */