public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <pedro@palves.net>, Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/3] gdb: make inferior::clear_thread_list always silent
Date: Mon, 21 Aug 2023 10:31:25 +0100	[thread overview]
Message-ID: <a95f6e9511e3405875d129eb412956b6c9aed78b.1692609662.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1692609662.git.aburgess@redhat.com>

From: Pedro Alves <pedro@palves.net>

After this commit:

  commit a78ef8757418105c35685c5d82b9fdf79459321b
  Date:   Wed Jun 22 18:10:00 2022 +0100

      Always emit =thread-exited notifications, even if silent

The function mi_interp::on_thread_exited (or mi_thread_exit as the
function was called back then) no longer makes use of the "silent"
parameter.

As a result there is no difference between inferior::clear_thread_list
with silent true or false, because:

  - None of the interpreter ::on_thread_exited functions rely on the
    silent parameter, and

  - None of GDB's thread_exit observers rely on the silent parameter
  either.

This commit removes the silent parameter from
inferior::clear_thread_list, and makes the function always silent.

This commit was originally part of a larger series:

  https://inbox.sourceware.org/gdb-patches/20221212203101.1034916-1-pedro@palves.net/

But didn't really need to be part of that series.  I had an interest
in seeing this patch merged:

  https://inbox.sourceware.org/gdb-patches/20221212203101.1034916-31-pedro@palves.net/

Which also didn't really need to be part of the larger series, but
does depend, at least a little, on this commit.  In order to get the
fix I'm interested in merged quicker, I (Andrew Burgess) have rebased
this commit outside of the original series.  Any bugs introduced while
splitting this patch out and rebasing, are entirely my own.

There should be no user visible changes after this commit.

Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
---
 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 eee4785fbf7..7220b704f20 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -247,13 +247,13 @@ inferior::find_thread (ptid_t ptid)
 /* 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 /* silent */);
       if (thr->deletable ())
 	delete thr;
     });
@@ -272,7 +272,7 @@ notify_inferior_removed (inferior *inf)
 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);
@@ -307,7 +307,7 @@ notify_inferior_disappeared (inferior *inf)
 static void
 exit_inferior_1 (struct inferior *inf, int silent)
 {
-  inf->clear_thread_list (silent);
+  inf->clear_thread_list ();
 
   notify_inferior_disappeared (inf);
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 74578353482..c8429b86268 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -496,9 +496,8 @@ class inferior : public refcounted_object,
   /* Find (non-exited) thread PTID of this inferior.  */
   thread_info *find_thread (ptid_t ptid);
 
-  /* 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 63ed87e9aa6..2cb9e5e36d0 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -246,7 +246,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.25.4


  reply	other threads:[~2023-08-21  9:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21  9:31 [PATCH 0/3] Fix thread exited messages for remote targets Andrew Burgess
2023-08-21  9:31 ` Andrew Burgess [this message]
2023-08-21  9:31 ` [PATCH 2/3] gdb: remove the silent parameter from exit_inferior_1 and cleanup Andrew Burgess
2023-08-21  9:31 ` [PATCH 3/3] gdb: centralize "[Thread ...exited]" notifications Andrew Burgess
2023-08-21 16:10 ` [PATCH 0/3] Fix thread exited messages for remote targets John Baldwin
2023-08-22 13:07   ` Pedro Alves
2023-08-22 16:54     ` John Baldwin
2023-08-22 13:02 ` Pedro Alves
2023-08-23  9:12   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a95f6e9511e3405875d129eb412956b6c9aed78b.1692609662.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).