Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] PR threads/20743: Don't attempt to suspend or resume exited threads.
@ 2016-12-23 21:30 John Baldwin
  2016-12-23 21:43 ` Luis Machado
  0 siblings, 1 reply; 13+ messages in thread
From: John Baldwin @ 2016-12-23 21:30 UTC (permalink / raw)
  To: gdb-patches

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): Ignore exited threads.
	(resume_all_threads_cb): Likewise.
	(fbsd_resume): Assert resuming thread has not exited.
---
 gdb/ChangeLog  | 7 +++++++
 gdb/fbsd-nat.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index db6e913..4fb3732 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2016-12-23  John Baldwin  <jhb@FreeBSD.org>
+
+	PR threads/20743
+	* fbsd-nat.c (resume_one_thread_cb): Ignore exited threads.
+	(resume_all_threads_cb): Likewise.
+	(fbsd_resume): Assert resuming thread has not exited.
+
 2016-12-22  Doug Evans  <xdje42@gmail.com>
 
 	* infrun.c (set_step_over_info): Add comment.
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index ade62f1..7cd08c6 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -662,6 +662,9 @@ resume_one_thread_cb (struct thread_info *tp, void *data)
   if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid))
     return 0;
 
+  if (is_exited (tp->ptid))
+    return 0;
+		  
   if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid))
     request = PT_RESUME;
   else
@@ -680,6 +683,9 @@ resume_all_threads_cb (struct thread_info *tp, void *data)
   if (!ptid_match (tp->ptid, *filter))
     return 0;
 
+  if (is_exited (tp->ptid))
+    return 0;
+		  
   if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
     perror_with_name (("ptrace"));
   return 0;
@@ -711,6 +717,7 @@ fbsd_resume (struct target_ops *ops,
   if (ptid_lwp_p (ptid))
     {
       /* If ptid is a specific LWP, suspend all other LWPs in the process.  */
+      gdb_assert (!is_exited (ptid));
       iterate_over_threads (resume_one_thread_cb, &ptid);
     }
   else
-- 
2.9.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-01-19 11:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-23 21:30 [PATCH] PR threads/20743: Don't attempt to suspend or resume exited threads John Baldwin
2016-12-23 21:43 ` Luis Machado
2016-12-27 16:43   ` Vasil Dimov
2016-12-27 21:03     ` John Baldwin
2016-12-28  8:07       ` Vasil Dimov
2016-12-28 17:37         ` John Baldwin
2017-01-12 16:29           ` Luis Machado
2017-01-12 19:17             ` John Baldwin
2017-01-13  1:27               ` Luis Machado
2017-01-13  1:53                 ` John Baldwin
2017-01-19 11:54                   ` Pedro Alves
2017-01-06 19:35       ` John Baldwin
2017-01-19 11:56       ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox