[PATCH v2 02/16] prefork_hook: Remove 'args' parameter

Pedro Alves pedro@palves.net
Mon Jun 14 21:23:56 GMT 2021


prefork_hook's 'args' parameter is only used in debug output in
gdbserver.  Remove it.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

	* fork-child.c (prefork_hook): Remove 'args' parameter.  All
	callers adjusted.
	* nat/fork-inferior.h (prefork_hook): Remove 'args' parameter.
	All callers adjusted.
	* nat/fork-inferior.c (fork_inferior): Adjust.

gdbserver/fork-child.cc
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

	* fork-child.cc (prefork_hook): Remove 'args' parameter, and
	references.

Change-Id: Iaf8977af7dd6915c123b0d50ded93395bdafd920
---
 gdb/fork-child.c        | 2 +-
 gdb/nat/fork-inferior.c | 2 +-
 gdb/nat/fork-inferior.h | 7 +++----
 gdbserver/fork-child.cc | 7 +------
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 3ce7d64b855..41135b53f9b 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -59,7 +59,7 @@ static struct ui *saved_ui = NULL;
 /* See nat/fork-inferior.h.  */
 
 void
-prefork_hook (const char *args)
+prefork_hook ()
 {
   gdb_assert (saved_ui == NULL);
   /* Retain a copy of our UI, since the child will replace this value
diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
index d280e1120cc..7d56250c979 100644
--- a/gdb/nat/fork-inferior.c
+++ b/gdb/nat/fork-inferior.c
@@ -317,7 +317,7 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs,
 
   /* Perform any necessary actions regarding to TTY before the
      fork/vfork call.  */
-  prefork_hook (allargs.c_str ());
+  prefork_hook ();
 
   /* It is generally good practice to flush any possible pending stdio
      output prior to doing a fork, to avoid the possibility of both
diff --git a/gdb/nat/fork-inferior.h b/gdb/nat/fork-inferior.h
index aae2aa6a854..f45ec9047c8 100644
--- a/gdb/nat/fork-inferior.h
+++ b/gdb/nat/fork-inferior.h
@@ -58,10 +58,9 @@ extern ptid_t startup_inferior (process_stratum_target *proc_target,
 				struct target_waitstatus *mystatus,
 				ptid_t *myptid);
 
-/* Perform any necessary tasks before a fork/vfork takes place.  ARGS
-   is a string containing all the arguments received by the inferior.
-   This function is mainly used by fork_inferior.  */
-extern void prefork_hook (const char *args);
+/* Perform any necessary tasks before a fork/vfork takes place.  This
+   function is mainly used by fork_inferior.  */
+extern void prefork_hook ();
 
 /* Perform any necessary tasks after a fork/vfork takes place.  This
    function is mainly used by fork_inferior.  */
diff --git a/gdbserver/fork-child.cc b/gdbserver/fork-child.cc
index a431e7ef889..9678133243d 100644
--- a/gdbserver/fork-child.cc
+++ b/gdbserver/fork-child.cc
@@ -42,14 +42,9 @@ restore_old_foreground_pgrp (void)
 /* See nat/fork-inferior.h.  */
 
 void
-prefork_hook (const char *args)
+prefork_hook ()
 {
   client_state &cs = get_client_state ();
-  if (debug_threads)
-    {
-      debug_printf ("args: %s\n", args);
-      debug_flush ();
-    }
 
 #ifdef SIGTTOU
   signal (SIGTTOU, SIG_DFL);
-- 
2.26.2



More information about the Gdb-patches mailing list