+2016-09-01  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * target.c (target_wait): Mention that the function's prototype
+       can be found at target/target.h.
+       * target.h (target_wait): Move prototype from here...
+       * target/target.h (target_wait): ... to here.
+
 2016-09-01  Sergio Durigan Junior  <sergiodj@redhat.com>
 
        * fork-child.c (startup_inferior): Replace calls to target_resume
 
+2016-09-01  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * target.c (mywait): Call target_wait instead of
+       the_target->wait.
+       (target_wait): New function.
+
 2016-09-01  Sergio Durigan Junior  <sergiodj@redhat.com>
 
        * server.c (start_inferior): New variable 'ptid'.  Replace calls
 
   if (connected_wait)
     server_waiting = 1;
 
-  ret = (*the_target->wait) (ptid, ourstatus, options);
+  ret = target_wait (ptid, ourstatus, options);
 
   /* We don't expose _LOADED events to gdbserver core.  See the
      `dlls_changed' global.  */
 
 /* See target/target.h.  */
 
+ptid_t
+target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
+{
+  return (*the_target->wait) (ptid, status, options);
+}
+
+/* See target/target.h.  */
+
 void
 target_continue_no_signal (ptid_t ptid)
 {
 
   current_target.to_disconnect (¤t_target, args, from_tty);
 }
 
+/* See target/target.h.  */
+
 ptid_t
 target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 {
 
 
 extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal);
 
-/* Wait for process pid to do something.  PTID = -1 to wait for any
-   pid to do something.  Return pid of child, or -1 in case of error;
-   store status through argument pointer STATUS.  Note that it is
-   _NOT_ OK to throw_exception() out of target_wait() without popping
-   the debugging target from the stack; GDB isn't prepared to get back
-   to the prompt with a debugging target but without the frame cache,
-   stop_pc, etc., set up.  OPTIONS is a bitwise OR of TARGET_W*
-   options.  */
-
-extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
-                          int options);
+/* For target_read_memory see target/target.h.  */
 
 /* The default target_ops::to_wait implementation.  */
 
 
 
 extern void target_continue (ptid_t ptid, enum gdb_signal signal);
 
+/* Wait for process pid to do something.  PTID = -1 to wait for any
+   pid to do something.  Return pid of child, or -1 in case of error;
+   store status through argument pointer STATUS.  Note that it is
+   _NOT_ OK to throw_exception() out of target_wait() without popping
+   the debugging target from the stack; GDB isn't prepared to get back
+   to the prompt with a debugging target but without the frame cache,
+   stop_pc, etc., set up.  OPTIONS is a bitwise OR of TARGET_W*
+   options.  */
+
+extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
+                          int options);
+
 #endif /* TARGET_COMMON_H */