public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pedro Alves <palves@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Revert "Delete delete_thread_silent"
Date: Fri, 24 Jun 2022 16:23:50 +0000 (GMT)	[thread overview]
Message-ID: <20220624162350.61212383DBB0@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=86be3050a64c7317754b5682e1a2b6a91f4e3f03

commit 86be3050a64c7317754b5682e1a2b6a91f4e3f03
Author: Pedro Alves <pedro@palves.net>
Date:   Fri Jun 24 17:20:16 2022 +0100

    Revert "Delete delete_thread_silent"
    
    Turns out we'll be gaining a new use of this function very soon, the
    incoming AMDGPU port needs it.  Let's add it back, as it isn't really
    hurting anything.
    
    This reverts commit 39b8a8090ed7e8967ceca3655aa5f3a2ae91219d.

Diff:
---
 gdb/gdbthread.h |  4 ++++
 gdb/thread.c    | 28 +++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 1f17ad7d9e7..1a33eb61221 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -623,6 +623,10 @@ extern struct thread_info *add_thread_with_info (process_stratum_target *targ,
    as exited and do the notification.  */
 extern void delete_thread (struct thread_info *thread);
 
+/* Like delete_thread, but be quiet about it.  Used when the process
+   this thread belonged to has already exited, for example.  */
+extern void delete_thread_silent (struct thread_info *thread);
+
 /* Mark the thread exited, but don't delete it or remove it from the
    inferior thread list.  */
 extern void set_thread_exited (thread_info *tp, bool silent);
diff --git a/gdb/thread.c b/gdb/thread.c
index f0ad82e76d7..378c5ee2d13 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -450,16 +450,20 @@ global_thread_step_over_chain_remove (struct thread_info *tp)
   global_thread_step_over_list.erase (it);
 }
 
-/* See gdbthread.h.  */
+/* Delete the thread referenced by THR.  If SILENT, don't notify
+   the observer of this exit.
+   
+   THR must not be NULL or a failed assertion will be raised.  */
 
-void
-delete_thread (thread_info *thr)
+static void
+delete_thread_1 (thread_info *thr, bool silent)
 {
   gdb_assert (thr != nullptr);
 
-  threads_debug_printf ("deleting thread %s", thr->ptid.to_string ().c_str ());
+  threads_debug_printf ("deleting thread %s, silent = %d",
+			thr->ptid.to_string ().c_str (), silent);
 
-  set_thread_exited (thr, false);
+  set_thread_exited (thr, silent);
 
   if (!thr->deletable ())
     {
@@ -473,6 +477,20 @@ delete_thread (thread_info *thr)
   delete thr;
 }
 
+/* See gdbthread.h.  */
+
+void
+delete_thread (thread_info *thread)
+{
+  delete_thread_1 (thread, false /* not silent */);
+}
+
+void
+delete_thread_silent (thread_info *thread)
+{
+  delete_thread_1 (thread, true /* silent */);
+}
+
 struct thread_info *
 find_thread_global_id (int global_id)
 {


                 reply	other threads:[~2022-06-24 16:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220624162350.61212383DBB0@sourceware.org \
    --to=palves@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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).