[PATCH v2 27/29] inferior::clear_thread_list always silent

Pedro Alves pedro@palves.net
Wed Jul 13 22:24:31 GMT 2022


Now that the MI mi_thread_exit observer ignores "silent", there's no
difference between inferior::clean_thread_list with silent true or
false.  And for the CLI, clean_thread_list() never printed anything
either.  So we can eliminate the 'silent' parameter.

Change-Id: I90ff9f07537d22ea70986fbcfe8819cac7e06613
---
 gdb/inferior.c | 12 ++++++------
 gdb/inferior.h |  5 ++---
 gdb/thread.c   |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 606b4189181..c1d2be6e3a2 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -177,13 +177,13 @@ add_inferior (int pid)
 /* See inferior.h.  */
 
 void
-inferior::clear_thread_list (bool silent)
+inferior::clear_thread_list ()
 {
   thread_list.clear_and_dispose ([=] (thread_info *thr)
     {
-      threads_debug_printf ("deleting thread %s, silent = %d",
-			    thr->ptid.to_string ().c_str (), silent);
-      set_thread_exited (thr, silent);
+      threads_debug_printf ("deleting thread %s",
+			    thr->ptid.to_string ().c_str ());
+      set_thread_exited (thr, true);
       if (thr->deletable ())
 	delete thr;
     });
@@ -193,7 +193,7 @@ inferior::clear_thread_list (bool silent)
 void
 delete_inferior (struct inferior *inf)
 {
-  inf->clear_thread_list (true);
+  inf->clear_thread_list ();
 
   auto it = inferior_list.iterator_to (*inf);
   inferior_list.erase (it);
@@ -213,7 +213,7 @@ delete_inferior (struct inferior *inf)
 static void
 exit_inferior_1 (struct inferior *inf, int silent)
 {
-  inf->clear_thread_list (silent);
+  inf->clear_thread_list ();
 
   gdb::observers::inferior_exit.notify (inf);
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index c376d780de0..9c1dcec0cea 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -428,9 +428,8 @@ class inferior : public refcounted_object,
   inline safe_inf_threads_range threads_safe ()
   { return safe_inf_threads_range (this->thread_list.begin ()); }
 
-  /* Delete all threads in the thread list.  If SILENT, exit threads
-     silently.  */
-  void clear_thread_list (bool silent);
+  /* Delete all threads in the thread list, silently.  */
+  void clear_thread_list ();
 
   /* Continuations-related methods.  A continuation is an std::function
      to be called to finish the execution of a command when running
diff --git a/gdb/thread.c b/gdb/thread.c
index a83db6b07fd..9aa2189160e 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -235,7 +235,7 @@ init_thread_list (void)
   highest_thread_num = 0;
 
   for (inferior *inf : all_inferiors ())
-    inf->clear_thread_list (true);
+    inf->clear_thread_list ();
 }
 
 /* Allocate a new thread of inferior INF with target id PTID and add
-- 
2.36.0



More information about the Gdb-patches mailing list