aboutsummaryrefslogtreecommitdiff
path: root/devel/gdb/files/patch-gdb-fbsd-nat.c
blob: 4b0915a7a11bd2784ede1a94473e3a01057af922 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- gdb/fbsd-nat.c.orig	2016-08-01 17:50:20.000000000 +0200
+++ gdb/fbsd-nat.c	2016-12-14 23:23:39.467449000 +0100
@@ -680,6 +680,9 @@
   if (!ptid_match (tp->ptid, *filter))
     return 0;
 
+  if (tp->state == THREAD_EXITED) {
+    return 0;
+  }
   if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
     perror_with_name (("ptrace"));
   return 0;
@@ -710,6 +713,14 @@
 			ptid_get_tid (ptid));
   if (ptid_lwp_p (ptid))
     {
+#ifndef PT_LWP_EVENTS
+      /* When LWP events are not supported, a new thread might already be
+	 running that has not yet reported an event when GDB wishes to
+         only run a single thread.  Force an update of the thread list
+	 to ensure that any such threads are suspended before the process
+	 is resumed.  */
+      fbsd_add_threads (ptid_get_pid (ptid));
+#endif
       /* If ptid is a specific LWP, suspend all other LWPs in the process.  */
       iterate_over_threads (resume_one_thread_cb, &ptid);
     }