This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove usage of find_inferior in win32-low.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2bee2b6ca4cb1a736f963a168dd2ded2831c540d

commit 2bee2b6ca4cb1a736f963a168dd2ded2831c540d
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Sun Nov 19 22:23:21 2017 -0500

    Remove usage of find_inferior in win32-low.c
    
    Replace with for_each_thread.
    
    gdb/gdbserver/ChangeLog:
    
    	* win32-low.c (continue_one_thread): Return void, take argument
    	directly.
    	(child_continue): Use for_each_thread.

Diff:
---
 gdb/gdbserver/ChangeLog   |  6 ++++++
 gdb/gdbserver/win32-low.c | 12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index e1fed94..ded57cd 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,11 @@
 2017-11-19  Simon Marchi  <simon.marchi@ericsson.com>
 
+	* win32-low.c (continue_one_thread): Return void, take argument
+	directly.
+	(child_continue): Use for_each_thread.
+
+2017-11-19  Simon Marchi  <simon.marchi@ericsson.com>
+
 	* win32-i386-low.c (update_debug_registers_callback): Rename
 	to ...
 	(update_debug_registers): ... this, return void, remove pid_p arg.
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 66fc52c..c7684b7 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -428,10 +428,9 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
 
 /* Resume all artificially suspended threads if we are continuing
    execution.  */
-static int
-continue_one_thread (thread_info *thread, void *id_ptr)
+static void
+continue_one_thread (thread_info *thread, int thread_id)
 {
-  int thread_id = * (int *) id_ptr;
   win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
 
   if (thread_id == -1 || thread_id == th->tid)
@@ -455,8 +454,6 @@ continue_one_thread (thread_info *thread, void *id_ptr)
 	  th->suspended = 0;
 	}
     }
-
-  return 0;
 }
 
 static BOOL
@@ -464,7 +461,10 @@ child_continue (DWORD continue_status, int thread_id)
 {
   /* The inferior will only continue after the ContinueDebugEvent
      call.  */
-  find_inferior (&all_threads, continue_one_thread, &thread_id);
+  for_each_thread ([&] (thread_info *thread)
+    {
+      continue_one_thread (thread, thread_id);
+    });
   faked_breakpoint = 0;
 
   if (!ContinueDebugEvent (current_event.dwProcessId,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]