gdb: make target_ops::follow_fork return void

Message ID 20210407185924.528834-1-simon.marchi@polymtl.ca
State New
Headers show
Series
  • gdb: make target_ops::follow_fork return void
Related show

Commit Message

Mike Frysinger via Gdb-patches April 7, 2021, 6:59 p.m.
I noticed that all implementations return false, so
target_ops::follow_fork doesn't really need to return a value.  Change
it to return void.

gdb/ChangeLog:

	* target.h (struct target_ops) <follow_fork>: Return void.
	(target_follow_fork): Likewise.
	* target.c (default_follow_fork): Likewise.
	(target_follow_fork): Likewise.
	* infrun.c (follow_fork_inferior): Adjust.
	* fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Return void.
	* fbsd-nat.c (fbsd_nat_target:::follow_fork): Likewise.
	* linux-nat.h (class linux_nat_target) <follow_fork>: Likewise.
	* linux-nat.c (linux_nat_target::follow_fork): Return void.
	* obsd-nat.h (class obsd_nat_target) <follow_fork>: Return void.
	* obsd-nat.c (obsd_nat_target::follow_fork): Likewise.
	* remote.c (class remote_target) <follow_fork>: Likewise.
	(remote_target::follow_fork): Likewise.
	* target-delegates.c: Re-generate.

Change-Id: If908c2f68b29fa275be2b0b9deb41e4c6a1b7879
---
 gdb/fbsd-nat.c         |  4 +---
 gdb/fbsd-nat.h         |  2 +-
 gdb/infrun.c           |  6 ++++--
 gdb/linux-nat.c        |  4 +---
 gdb/linux-nat.h        |  2 +-
 gdb/obsd-nat.c         |  4 +---
 gdb/obsd-nat.h         |  2 +-
 gdb/remote.c           |  6 ++----
 gdb/target-delegates.c | 22 +++++++++-------------
 gdb/target.c           |  7 +++----
 gdb/target.h           |  8 +++-----
 11 files changed, 27 insertions(+), 40 deletions(-)

-- 
2.30.1

Comments

Andrew Burgess April 7, 2021, 8:27 p.m. | #1
* Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2021-04-07 14:59:24 -0400]:

> I noticed that all implementations return false, so

> target_ops::follow_fork doesn't really need to return a value.  Change

> it to return void.

> 

> gdb/ChangeLog:

> 

> 	* target.h (struct target_ops) <follow_fork>: Return void.

> 	(target_follow_fork): Likewise.

> 	* target.c (default_follow_fork): Likewise.

> 	(target_follow_fork): Likewise.

> 	* infrun.c (follow_fork_inferior): Adjust.

> 	* fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Return void.

> 	* fbsd-nat.c (fbsd_nat_target:::follow_fork): Likewise.

> 	* linux-nat.h (class linux_nat_target) <follow_fork>: Likewise.

> 	* linux-nat.c (linux_nat_target::follow_fork): Return void.

> 	* obsd-nat.h (class obsd_nat_target) <follow_fork>: Return void.

> 	* obsd-nat.c (obsd_nat_target::follow_fork): Likewise.

> 	* remote.c (class remote_target) <follow_fork>: Likewise.

> 	(remote_target::follow_fork): Likewise.

> 	* target-delegates.c: Re-generate.


Seems reasonable to me.

thanks,
Andrew

> 

> Change-Id: If908c2f68b29fa275be2b0b9deb41e4c6a1b7879

> ---

>  gdb/fbsd-nat.c         |  4 +---

>  gdb/fbsd-nat.h         |  2 +-

>  gdb/infrun.c           |  6 ++++--

>  gdb/linux-nat.c        |  4 +---

>  gdb/linux-nat.h        |  2 +-

>  gdb/obsd-nat.c         |  4 +---

>  gdb/obsd-nat.h         |  2 +-

>  gdb/remote.c           |  6 ++----

>  gdb/target-delegates.c | 22 +++++++++-------------

>  gdb/target.c           |  7 +++----

>  gdb/target.h           |  8 +++-----

>  11 files changed, 27 insertions(+), 40 deletions(-)

> 

> diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c

> index 22bdd7862921..0f0822f0d555 100644

> --- a/gdb/fbsd-nat.c

> +++ b/gdb/fbsd-nat.c

> @@ -1417,7 +1417,7 @@ fbsd_nat_target::supports_stopped_by_sw_breakpoint ()

>  /* Target hook for follow_fork.  On entry and at return inferior_ptid is

>     the ptid of the followed inferior.  */

>  

> -bool

> +void

>  fbsd_nat_target::follow_fork (bool follow_child, bool detach_fork)

>  {

>    if (!follow_child && detach_fork)

> @@ -1460,8 +1460,6 @@ fbsd_nat_target::follow_fork (bool follow_child, bool detach_fork)

>  	}

>  #endif

>      }

> -

> -  return false;

>  }

>  

>  int

> diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h

> index edb05f883773..772655d320e6 100644

> --- a/gdb/fbsd-nat.h

> +++ b/gdb/fbsd-nat.h

> @@ -80,7 +80,7 @@ class fbsd_nat_target : public inf_ptrace_target

>  #endif

>  

>  #ifdef TDP_RFPPWAIT

> -  bool follow_fork (bool, bool) override;

> +  void follow_fork (bool, bool) override;

>  

>    int insert_fork_catchpoint (int) override;

>    int remove_fork_catchpoint (int) override;

> diff --git a/gdb/infrun.c b/gdb/infrun.c

> index 6176fa94fe36..2c31cf452b10 100644

> --- a/gdb/infrun.c

> +++ b/gdb/infrun.c

> @@ -426,7 +426,7 @@ follow_fork_inferior (bool follow_child, bool detach_fork)

>  Can not resume the parent process over vfork in the foreground while\n\

>  holding the child stopped.  Try \"set detach-on-fork\" or \

>  \"set schedule-multiple\".\n"));

> -      return 1;

> +      return true;

>      }

>  

>    if (!follow_child)

> @@ -662,7 +662,9 @@ holding the child stopped.  Try \"set detach-on-fork\" or \

>        switch_to_thread (child_thr);

>      }

>  

> -  return target_follow_fork (follow_child, detach_fork);

> +  target_follow_fork (follow_child, detach_fork);

> +

> +  return false;

>  }

>  

>  /* Tell the target to follow the fork we're stopped at.  Returns true

> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c

> index ccfd3c1320c6..c45e335a7621 100644

> --- a/gdb/linux-nat.c

> +++ b/gdb/linux-nat.c

> @@ -446,7 +446,7 @@ typedef std::unique_ptr<struct lwp_info, lwp_deleter> lwp_info_up;

>     ptid of the followed inferior.  At return, inferior_ptid will be

>     unchanged.  */

>  

> -bool

> +void

>  linux_nat_target::follow_fork (bool follow_child, bool detach_fork)

>  {

>    if (!follow_child)

> @@ -611,8 +611,6 @@ linux_nat_target::follow_fork (bool follow_child, bool detach_fork)

>        /* Let the thread_db layer learn about this new process.  */

>        check_for_thread_db ();

>      }

> -

> -  return false;

>  }

>  

>  

> diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h

> index ff4d753422df..5426a5c69001 100644

> --- a/gdb/linux-nat.h

> +++ b/gdb/linux-nat.h

> @@ -133,7 +133,7 @@ class linux_nat_target : public inf_ptrace_target

>  

>    void post_attach (int) override;

>  

> -  bool follow_fork (bool, bool) override;

> +  void follow_fork (bool, bool) override;

>  

>    std::vector<static_tracepoint_marker>

>      static_tracepoint_markers_by_strid (const char *id) override;

> diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c

> index bf1aa8266f69..a8164ddbad15 100644

> --- a/gdb/obsd-nat.c

> +++ b/gdb/obsd-nat.c

> @@ -193,7 +193,7 @@ obsd_nat_target::post_startup_inferior (ptid_t pid)

>  /* Target hook for follow_fork.  On entry and at return inferior_ptid is

>     the ptid of the followed inferior.  */

>  

> -bool

> +void

>  obsd_nat_target::follow_fork (bool follow_child, bool detach_fork)

>  {

>    if (!follow_child)

> @@ -207,8 +207,6 @@ obsd_nat_target::follow_fork (bool follow_child, bool detach_fork)

>        if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)

>  	perror_with_name (("ptrace"));

>      }

> -

> -  return false;

>  }

>  

>  int

> diff --git a/gdb/obsd-nat.h b/gdb/obsd-nat.h

> index f66b8171b713..60b078fd0d30 100644

> --- a/gdb/obsd-nat.h

> +++ b/gdb/obsd-nat.h

> @@ -30,7 +30,7 @@ class obsd_nat_target : public inf_ptrace_target

>    ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;

>  

>  #ifdef PT_GET_PROCESS_STATE

> -  bool follow_fork (bool, bool) override;

> +  void follow_fork (bool, bool) override;

>  

>    int insert_fork_catchpoint (int) override;

>  

> diff --git a/gdb/remote.c b/gdb/remote.c

> index fd0ad9c74cbc..7429e1a86b38 100644

> --- a/gdb/remote.c

> +++ b/gdb/remote.c

> @@ -682,7 +682,7 @@ class remote_target : public process_stratum_target

>  

>    const struct btrace_config *btrace_conf (const struct btrace_target_info *) override;

>    bool augmented_libraries_svr4_read () override;

> -  bool follow_fork (bool, bool) override;

> +  void follow_fork (bool, bool) override;

>    void follow_exec (struct inferior *, const char *) override;

>    int insert_fork_catchpoint (int) override;

>    int remove_fork_catchpoint (int) override;

> @@ -5895,7 +5895,7 @@ extended_remote_target::detach (inferior *inf, int from_tty)

>     it is named remote_follow_fork in anticipation of using it for the

>     remote target as well.  */

>  

> -bool

> +void

>  remote_target::follow_fork (bool follow_child, bool detach_fork)

>  {

>    struct remote_state *rs = get_remote_state ();

> @@ -5922,8 +5922,6 @@ remote_target::follow_fork (bool follow_child, bool detach_fork)

>  	  remote_detach_pid (child_pid);

>  	}

>      }

> -

> -  return false;

>  }

>  

>  /* Target follow-exec function for remote targets.  Save EXECD_PATHNAME

> diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c

> index cc8c64a4f1e6..ef8c94cec8c6 100644

> --- a/gdb/target-delegates.c

> +++ b/gdb/target-delegates.c

> @@ -56,7 +56,7 @@ struct dummy_target : public target_ops

>    int remove_fork_catchpoint (int arg0) override;

>    int insert_vfork_catchpoint (int arg0) override;

>    int remove_vfork_catchpoint (int arg0) override;

> -  bool follow_fork (bool arg0, bool arg1) override;

> +  void follow_fork (bool arg0, bool arg1) override;

>    int insert_exec_catchpoint (int arg0) override;

>    int remove_exec_catchpoint (int arg0) override;

>    void follow_exec (struct inferior *arg0, const char *arg1) override;

> @@ -231,7 +231,7 @@ struct debug_target : public target_ops

>    int remove_fork_catchpoint (int arg0) override;

>    int insert_vfork_catchpoint (int arg0) override;

>    int remove_vfork_catchpoint (int arg0) override;

> -  bool follow_fork (bool arg0, bool arg1) override;

> +  void follow_fork (bool arg0, bool arg1) override;

>    int insert_exec_catchpoint (int arg0) override;

>    int remove_exec_catchpoint (int arg0) override;

>    void follow_exec (struct inferior *arg0, const char *arg1) override;

> @@ -1518,32 +1518,28 @@ debug_target::remove_vfork_catchpoint (int arg0)

>    return result;

>  }

>  

> -bool

> +void

>  target_ops::follow_fork (bool arg0, bool arg1)

>  {

> -  return this->beneath ()->follow_fork (arg0, arg1);

> +  this->beneath ()->follow_fork (arg0, arg1);

>  }

>  

> -bool

> +void

>  dummy_target::follow_fork (bool arg0, bool arg1)

>  {

> -  return default_follow_fork (this, arg0, arg1);

> +  default_follow_fork (this, arg0, arg1);

>  }

>  

> -bool

> +void

>  debug_target::follow_fork (bool arg0, bool arg1)

>  {

> -  bool result;

>    fprintf_unfiltered (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath ()->shortname ());

> -  result = this->beneath ()->follow_fork (arg0, arg1);

> +  this->beneath ()->follow_fork (arg0, arg1);

>    fprintf_unfiltered (gdb_stdlog, "<- %s->follow_fork (", this->beneath ()->shortname ());

>    target_debug_print_bool (arg0);

>    fputs_unfiltered (", ", gdb_stdlog);

>    target_debug_print_bool (arg1);

> -  fputs_unfiltered (") = ", gdb_stdlog);

> -  target_debug_print_bool (result);

> -  fputs_unfiltered ("\n", gdb_stdlog);

> -  return result;

> +  fputs_unfiltered (")\n", gdb_stdlog);

>  }

>  

>  int

> diff --git a/gdb/target.c b/gdb/target.c

> index 995e7ef1dac1..1f0741471d82 100644

> --- a/gdb/target.c

> +++ b/gdb/target.c

> @@ -2699,7 +2699,7 @@ target_program_signals (gdb::array_view<const unsigned char> program_signals)

>    current_inferior ()->top_target ()->program_signals (program_signals);

>  }

>  

> -static bool

> +static void

>  default_follow_fork (struct target_ops *self, bool follow_child,

>  		     bool detach_fork)

>  {

> @@ -2708,10 +2708,9 @@ default_follow_fork (struct target_ops *self, bool follow_child,

>  		  _("could not find a target to follow fork"));

>  }

>  

> -/* Look through the list of possible targets for a target that can

> -   follow forks.  */

> +/* See target.h.  */

>  

> -bool

> +void

>  target_follow_fork (bool follow_child, bool detach_fork)

>  {

>    target_ops *target = current_inferior ()->top_target ();

> diff --git a/gdb/target.h b/gdb/target.h

> index adae49dc3295..48bf734279af 100644

> --- a/gdb/target.h

> +++ b/gdb/target.h

> @@ -636,7 +636,7 @@ struct target_ops

>        TARGET_DEFAULT_RETURN (1);

>      virtual int remove_vfork_catchpoint (int)

>        TARGET_DEFAULT_RETURN (1);

> -    virtual bool follow_fork (bool, bool)

> +    virtual void follow_fork (bool, bool)

>        TARGET_DEFAULT_FUNC (default_follow_fork);

>      virtual int insert_exec_catchpoint (int)

>        TARGET_DEFAULT_RETURN (1);

> @@ -1710,11 +1710,9 @@ extern int target_remove_vfork_catchpoint (int pid);

>     the next resume in order to perform any bookkeeping and fiddling

>     necessary to continue debugging either the parent or child, as

>     requested, and releasing the other.  Information about the fork

> -   or vfork event is available via get_last_target_status ().

> -   This function returns true if the inferior should not be resumed

> -   (i.e. there is another event pending).  */

> +   or vfork event is available via get_last_target_status ().  */

>  

> -bool target_follow_fork (bool follow_child, bool detach_fork);

> +void target_follow_fork (bool follow_child, bool detach_fork);

>  

>  /* Handle the target-specific bookkeeping required when the inferior

>     makes an exec call.  INF is the exec'd inferior.  */

> -- 

> 2.30.1

>
Mike Frysinger via Gdb-patches April 7, 2021, 8:58 p.m. | #2
On 2021-04-07 4:27 p.m., Andrew Burgess wrote:
> * Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2021-04-07 14:59:24 -0400]:

> 

>> I noticed that all implementations return false, so

>> target_ops::follow_fork doesn't really need to return a value.  Change

>> it to return void.

>>

>> gdb/ChangeLog:

>>

>> 	* target.h (struct target_ops) <follow_fork>: Return void.

>> 	(target_follow_fork): Likewise.

>> 	* target.c (default_follow_fork): Likewise.

>> 	(target_follow_fork): Likewise.

>> 	* infrun.c (follow_fork_inferior): Adjust.

>> 	* fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Return void.

>> 	* fbsd-nat.c (fbsd_nat_target:::follow_fork): Likewise.

>> 	* linux-nat.h (class linux_nat_target) <follow_fork>: Likewise.

>> 	* linux-nat.c (linux_nat_target::follow_fork): Return void.

>> 	* obsd-nat.h (class obsd_nat_target) <follow_fork>: Return void.

>> 	* obsd-nat.c (obsd_nat_target::follow_fork): Likewise.

>> 	* remote.c (class remote_target) <follow_fork>: Likewise.

>> 	(remote_target::follow_fork): Likewise.

>> 	* target-delegates.c: Re-generate.

> 

> Seems reasonable to me.

> 

> thanks,

> Andrew


Thanks, pushed.

Simon

Patch

diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 22bdd7862921..0f0822f0d555 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1417,7 +1417,7 @@  fbsd_nat_target::supports_stopped_by_sw_breakpoint ()
 /* Target hook for follow_fork.  On entry and at return inferior_ptid is
    the ptid of the followed inferior.  */
 
-bool
+void
 fbsd_nat_target::follow_fork (bool follow_child, bool detach_fork)
 {
   if (!follow_child && detach_fork)
@@ -1460,8 +1460,6 @@  fbsd_nat_target::follow_fork (bool follow_child, bool detach_fork)
 	}
 #endif
     }
-
-  return false;
 }
 
 int
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index edb05f883773..772655d320e6 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -80,7 +80,7 @@  class fbsd_nat_target : public inf_ptrace_target
 #endif
 
 #ifdef TDP_RFPPWAIT
-  bool follow_fork (bool, bool) override;
+  void follow_fork (bool, bool) override;
 
   int insert_fork_catchpoint (int) override;
   int remove_fork_catchpoint (int) override;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6176fa94fe36..2c31cf452b10 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -426,7 +426,7 @@  follow_fork_inferior (bool follow_child, bool detach_fork)
 Can not resume the parent process over vfork in the foreground while\n\
 holding the child stopped.  Try \"set detach-on-fork\" or \
 \"set schedule-multiple\".\n"));
-      return 1;
+      return true;
     }
 
   if (!follow_child)
@@ -662,7 +662,9 @@  holding the child stopped.  Try \"set detach-on-fork\" or \
       switch_to_thread (child_thr);
     }
 
-  return target_follow_fork (follow_child, detach_fork);
+  target_follow_fork (follow_child, detach_fork);
+
+  return false;
 }
 
 /* Tell the target to follow the fork we're stopped at.  Returns true
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index ccfd3c1320c6..c45e335a7621 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -446,7 +446,7 @@  typedef std::unique_ptr<struct lwp_info, lwp_deleter> lwp_info_up;
    ptid of the followed inferior.  At return, inferior_ptid will be
    unchanged.  */
 
-bool
+void
 linux_nat_target::follow_fork (bool follow_child, bool detach_fork)
 {
   if (!follow_child)
@@ -611,8 +611,6 @@  linux_nat_target::follow_fork (bool follow_child, bool detach_fork)
       /* Let the thread_db layer learn about this new process.  */
       check_for_thread_db ();
     }
-
-  return false;
 }
 
 
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index ff4d753422df..5426a5c69001 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -133,7 +133,7 @@  class linux_nat_target : public inf_ptrace_target
 
   void post_attach (int) override;
 
-  bool follow_fork (bool, bool) override;
+  void follow_fork (bool, bool) override;
 
   std::vector<static_tracepoint_marker>
     static_tracepoint_markers_by_strid (const char *id) override;
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index bf1aa8266f69..a8164ddbad15 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -193,7 +193,7 @@  obsd_nat_target::post_startup_inferior (ptid_t pid)
 /* Target hook for follow_fork.  On entry and at return inferior_ptid is
    the ptid of the followed inferior.  */
 
-bool
+void
 obsd_nat_target::follow_fork (bool follow_child, bool detach_fork)
 {
   if (!follow_child)
@@ -207,8 +207,6 @@  obsd_nat_target::follow_fork (bool follow_child, bool detach_fork)
       if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
 	perror_with_name (("ptrace"));
     }
-
-  return false;
 }
 
 int
diff --git a/gdb/obsd-nat.h b/gdb/obsd-nat.h
index f66b8171b713..60b078fd0d30 100644
--- a/gdb/obsd-nat.h
+++ b/gdb/obsd-nat.h
@@ -30,7 +30,7 @@  class obsd_nat_target : public inf_ptrace_target
   ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
 
 #ifdef PT_GET_PROCESS_STATE
-  bool follow_fork (bool, bool) override;
+  void follow_fork (bool, bool) override;
 
   int insert_fork_catchpoint (int) override;
 
diff --git a/gdb/remote.c b/gdb/remote.c
index fd0ad9c74cbc..7429e1a86b38 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -682,7 +682,7 @@  class remote_target : public process_stratum_target
 
   const struct btrace_config *btrace_conf (const struct btrace_target_info *) override;
   bool augmented_libraries_svr4_read () override;
-  bool follow_fork (bool, bool) override;
+  void follow_fork (bool, bool) override;
   void follow_exec (struct inferior *, const char *) override;
   int insert_fork_catchpoint (int) override;
   int remove_fork_catchpoint (int) override;
@@ -5895,7 +5895,7 @@  extended_remote_target::detach (inferior *inf, int from_tty)
    it is named remote_follow_fork in anticipation of using it for the
    remote target as well.  */
 
-bool
+void
 remote_target::follow_fork (bool follow_child, bool detach_fork)
 {
   struct remote_state *rs = get_remote_state ();
@@ -5922,8 +5922,6 @@  remote_target::follow_fork (bool follow_child, bool detach_fork)
 	  remote_detach_pid (child_pid);
 	}
     }
-
-  return false;
 }
 
 /* Target follow-exec function for remote targets.  Save EXECD_PATHNAME
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index cc8c64a4f1e6..ef8c94cec8c6 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -56,7 +56,7 @@  struct dummy_target : public target_ops
   int remove_fork_catchpoint (int arg0) override;
   int insert_vfork_catchpoint (int arg0) override;
   int remove_vfork_catchpoint (int arg0) override;
-  bool follow_fork (bool arg0, bool arg1) override;
+  void follow_fork (bool arg0, bool arg1) override;
   int insert_exec_catchpoint (int arg0) override;
   int remove_exec_catchpoint (int arg0) override;
   void follow_exec (struct inferior *arg0, const char *arg1) override;
@@ -231,7 +231,7 @@  struct debug_target : public target_ops
   int remove_fork_catchpoint (int arg0) override;
   int insert_vfork_catchpoint (int arg0) override;
   int remove_vfork_catchpoint (int arg0) override;
-  bool follow_fork (bool arg0, bool arg1) override;
+  void follow_fork (bool arg0, bool arg1) override;
   int insert_exec_catchpoint (int arg0) override;
   int remove_exec_catchpoint (int arg0) override;
   void follow_exec (struct inferior *arg0, const char *arg1) override;
@@ -1518,32 +1518,28 @@  debug_target::remove_vfork_catchpoint (int arg0)
   return result;
 }
 
-bool
+void
 target_ops::follow_fork (bool arg0, bool arg1)
 {
-  return this->beneath ()->follow_fork (arg0, arg1);
+  this->beneath ()->follow_fork (arg0, arg1);
 }
 
-bool
+void
 dummy_target::follow_fork (bool arg0, bool arg1)
 {
-  return default_follow_fork (this, arg0, arg1);
+  default_follow_fork (this, arg0, arg1);
 }
 
-bool
+void
 debug_target::follow_fork (bool arg0, bool arg1)
 {
-  bool result;
   fprintf_unfiltered (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath ()->shortname ());
-  result = this->beneath ()->follow_fork (arg0, arg1);
+  this->beneath ()->follow_fork (arg0, arg1);
   fprintf_unfiltered (gdb_stdlog, "<- %s->follow_fork (", this->beneath ()->shortname ());
   target_debug_print_bool (arg0);
   fputs_unfiltered (", ", gdb_stdlog);
   target_debug_print_bool (arg1);
-  fputs_unfiltered (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  fputs_unfiltered ("\n", gdb_stdlog);
-  return result;
+  fputs_unfiltered (")\n", gdb_stdlog);
 }
 
 int
diff --git a/gdb/target.c b/gdb/target.c
index 995e7ef1dac1..1f0741471d82 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2699,7 +2699,7 @@  target_program_signals (gdb::array_view<const unsigned char> program_signals)
   current_inferior ()->top_target ()->program_signals (program_signals);
 }
 
-static bool
+static void
 default_follow_fork (struct target_ops *self, bool follow_child,
 		     bool detach_fork)
 {
@@ -2708,10 +2708,9 @@  default_follow_fork (struct target_ops *self, bool follow_child,
 		  _("could not find a target to follow fork"));
 }
 
-/* Look through the list of possible targets for a target that can
-   follow forks.  */
+/* See target.h.  */
 
-bool
+void
 target_follow_fork (bool follow_child, bool detach_fork)
 {
   target_ops *target = current_inferior ()->top_target ();
diff --git a/gdb/target.h b/gdb/target.h
index adae49dc3295..48bf734279af 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -636,7 +636,7 @@  struct target_ops
       TARGET_DEFAULT_RETURN (1);
     virtual int remove_vfork_catchpoint (int)
       TARGET_DEFAULT_RETURN (1);
-    virtual bool follow_fork (bool, bool)
+    virtual void follow_fork (bool, bool)
       TARGET_DEFAULT_FUNC (default_follow_fork);
     virtual int insert_exec_catchpoint (int)
       TARGET_DEFAULT_RETURN (1);
@@ -1710,11 +1710,9 @@  extern int target_remove_vfork_catchpoint (int pid);
    the next resume in order to perform any bookkeeping and fiddling
    necessary to continue debugging either the parent or child, as
    requested, and releasing the other.  Information about the fork
-   or vfork event is available via get_last_target_status ().
-   This function returns true if the inferior should not be resumed
-   (i.e. there is another event pending).  */
+   or vfork event is available via get_last_target_status ().  */
 
-bool target_follow_fork (bool follow_child, bool detach_fork);
+void target_follow_fork (bool follow_child, bool detach_fork);
 
 /* Handle the target-specific bookkeeping required when the inferior
    makes an exec call.  INF is the exec'd inferior.  */