public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] gdb: extra debug output in thread.c
Date: Thu,  6 Oct 2022 18:23:44 +0100	[thread overview]
Message-ID: <7c6aea7043ed6eabf93015f215edf6636f565934.1665076921.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1665076921.git.aburgess@redhat.com>

Add some extra 'threads' debug in a couple of places in thread.c.
I've also added an additional gdb_assert in one case.
---
 gdb/thread.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/thread.c b/gdb/thread.c
index 378c5ee2d13..349fc01dd48 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -834,6 +834,10 @@ set_running_thread (struct thread_info *tp, bool running)
     started = true;
   tp->state = running ? THREAD_RUNNING : THREAD_STOPPED;
 
+  threads_debug_printf ("thread: %s, running? %d%s",
+			tp->ptid.to_string ().c_str (), running,
+			(started ? " (started" : ""));
+
   if (!running)
     {
       /* If the thread is now marked stopped, remove it from
@@ -1298,6 +1302,9 @@ info_threads_command_completer (struct cmd_list_element *ignore,
 void
 switch_to_thread_no_regs (struct thread_info *thread)
 {
+  gdb_assert (thread != nullptr);
+  threads_debug_printf ("thread = %s", thread->ptid.to_string ().c_str ());
+
   struct inferior *inf = thread->inf;
 
   set_current_program_space (inf->pspace);
@@ -1315,6 +1322,8 @@ switch_to_no_thread ()
   if (current_thread_ == nullptr)
     return;
 
+  threads_debug_printf ("thread = NONE");
+
   current_thread_ = nullptr;
   inferior_ptid = null_ptid;
   reinit_frame_cache ();
-- 
2.25.4


  parent reply	other threads:[~2022-10-06 17:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 17:23 [PATCH 0/3] Another set of debug output patches Andrew Burgess
2022-10-06 17:23 ` [PATCH 1/3] gdb: improve infrun_debug_show_threads output Andrew Burgess
2022-10-06 17:23 ` Andrew Burgess [this message]
2022-10-06 17:23 ` [PATCH 3/3] gdb: add infcall specific debugging Andrew Burgess
2022-10-06 17:32   ` Eli Zaretskii
2022-10-10 12:05     ` Andrew Burgess
2022-10-07 19:11 ` [PATCH 0/3] Another set of debug output patches Tom Tromey

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=7c6aea7043ed6eabf93015f215edf6636f565934.1665076921.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@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).