freebsd-ports/devel/gdb/files/patch-gdb-fbsd-nat.c
Olivier Cochard 1ebde38a55 Add MIPS support and other fixes
PR:		215938
- Main PR that merge all
Submitted by:   luca.pizzamiglio@gmail.com (maintainer)

PR:		215783
- Add MIPS support
Submitted by:   jhb
Sponsored by:   DARPA / AFRL

PR:		215868
- Fix build on powerpc architecture
Reported by:    Mark Millard

PR:		212607
- Add a workaround to mitigate gdb hangs under some circumstances
with multi-threaded applications
(thanks to misc-freebsd-bugzilla@talk2dom.com)
Reported by:    tijl

PR:		215578
- Fix build by removing option to use system readline
Reported by:    rozhuk.im@gmail.com
2017-01-12 21:40:06 +00:00

27 lines
968 B
C

--- 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);
}