This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/gdb-8.0-branch] PR threads/20743: Don't attempt to suspend or resume exited threads.


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

commit 24b03ea864424cf8482ba07fb074389aa759e592
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Tue Apr 18 09:44:32 2017 -0700

    PR threads/20743: Don't attempt to suspend or resume exited threads.
    
    When resuming a native FreeBSD process, ignore exited threads when
    suspending/resuming individual threads prior to continuing the process.
    
    gdb/ChangeLog:
    
    	PR threads/20743
    	* fbsd-nat.c (resume_one_thread_cb): Remove.
    	(resume_all_threads_cb): Remove.
    	(fbsd_resume): Use ALL_NON_EXITED_THREADS instead of
    	iterate_over_threads.

Diff:
---
 gdb/ChangeLog  |  8 ++++++++
 gdb/fbsd-nat.c | 60 +++++++++++++++++++++++++---------------------------------
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c6402e7..0589f18 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2017-04-18  John Baldwin  <jhb@FreeBSD.org>
+
+	PR threads/20743
+	* fbsd-nat.c (resume_one_thread_cb): Remove.
+	(resume_all_threads_cb): Remove.
+	(fbsd_resume): Use ALL_NON_EXITED_THREADS instead of
+	iterate_over_threads.
+
 2017-04-17  Joel Brobecker  <brobecker@adacore.com>
 
 	GDB 8.0 branch created (725bf5cf125783c2a7ca4ab63d3768e220bab2db):
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 5c4408b..ef5ad1e 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -653,38 +653,6 @@ fbsd_next_vfork_done (void)
 #endif
 #endif
 
-static int
-resume_one_thread_cb (struct thread_info *tp, void *data)
-{
-  ptid_t *ptid = (ptid_t *) data;
-  int request;
-
-  if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid))
-    return 0;
-
-  if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid))
-    request = PT_RESUME;
-  else
-    request = PT_SUSPEND;
-
-  if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
-    perror_with_name (("ptrace"));
-  return 0;
-}
-
-static int
-resume_all_threads_cb (struct thread_info *tp, void *data)
-{
-  ptid_t *filter = (ptid_t *) data;
-
-  if (!ptid_match (tp->ptid, *filter))
-    return 0;
-
-  if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
-    perror_with_name (("ptrace"));
-  return 0;
-}
-
 /* Implement the "to_resume" target_ops method.  */
 
 static void
@@ -711,13 +679,37 @@ fbsd_resume (struct target_ops *ops,
   if (ptid_lwp_p (ptid))
     {
       /* If ptid is a specific LWP, suspend all other LWPs in the process.  */
-      iterate_over_threads (resume_one_thread_cb, &ptid);
+      struct thread_info *tp;
+      int request;
+
+      ALL_NON_EXITED_THREADS (tp)
+        {
+	  if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid))
+	    continue;
+
+	  if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid))
+	    request = PT_RESUME;
+	  else
+	    request = PT_SUSPEND;
+
+	  if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
+	    perror_with_name (("ptrace"));
+	}
     }
   else
     {
       /* If ptid is a wildcard, resume all matching threads (they won't run
 	 until the process is continued however).  */
-      iterate_over_threads (resume_all_threads_cb, &ptid);
+      struct thread_info *tp;
+
+      ALL_NON_EXITED_THREADS (tp)
+        {
+	  if (!ptid_match (tp->ptid, ptid))
+	    continue;
+
+	  if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
+	    perror_with_name (("ptrace"));
+	}
       ptid = inferior_ptid;
     }
   super_resume (ops, ptid, step, signo);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]