public inbox for rda@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: rda@sources.redhat.com
Subject: [commit] Fix some thread_db event model bugs
Date: Fri, 02 Dec 2005 00:55:00 -0000	[thread overview]
Message-ID: <20051201175528.1ebc8246@ironwood.lan> (raw)

I found these bugs recently while debugging against an am33 target.  One
is a fairly old bug and was likely not noticed 'til now due to the fact
that a software singlestep target is required to see it.

The other bug is one that I introduced recently when I revised thread-db.c
to not always update the thread list.

	* thread-db.c (handle_thread_db_event): Allow underlying target a
	chance to look at the wait status too.
	(thread_db_check_child_state): Ensure that there's a thread list
	to work with when using the thread_db event model.

Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/rda/unix/thread-db.c,v
retrieving revision 1.16
diff -u -p -r1.16 thread-db.c
--- thread-db.c	8 Nov 2005 21:58:36 -0000	1.16
+++ thread-db.c	2 Dec 2005 00:48:28 -0000
@@ -1853,6 +1853,9 @@ handle_thread_db_event (struct child_pro
       /* We don't have any new status to report...  */
       return 1;
     }
+  /* Give underlying target a chance to look at the wait status.  This
+     is necessary for software singlestep to work correctly.  */
+  handle_waitstatus (process, w);
 
   /* Re-insert the event breakpoints.  */
   insert_thread_db_event_breakpoints (serv);
@@ -2146,11 +2149,19 @@ thread_db_check_child_state (struct chil
 		     process->stop_signal,
 		     (unsigned long) debug_get_pc (process->serv, process->pid));
 
-#if ALWAYS_UPDATE_THREAD_LIST
-	  /* Update the thread list, and attach to (and thereby stop)
-             any new threads we find.  */
-	  update_thread_list (process);
+#if !ALWAYS_UPDATE_THREAD_LIST
+	  /* The thread_db event model requires that `event_thread' (see
+	     below) gets set correctly, but this won't happen unless there's
+	     a thread list to search.  So, if the thread_list is empty and
+	     we're using the thread_db event model, we need to update the
+	     thread list.  */
+	  if (thread_list == NULL && using_thread_db_events)
 #endif
+	    {
+	      /* Update the thread list, and attach to (and thereby stop)
+		 any new threads we find.  */
+	      update_thread_list (process);
+	    }
 
 	  process->event_thread = thread_list_lookup_by_lid (process->pid);
 

                 reply	other threads:[~2005-12-02  0:55 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=20051201175528.1ebc8246@ironwood.lan \
    --to=kevinb@redhat.com \
    --cc=rda@sources.redhat.com \
    /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).