Long story short: After following a child, detaching from the parent, ('set follow-fork-mode child' + 'set detach-on-fork on') here in this bit, infrun.c:resume(): { .... follow_fork (); ... tp->stop_signal = TARGET_SIGNAL_0; } ... `tp' is no longer in the thread list (it was pointing at a thread of the parent process, which we've detached from, hence no longer in the thread list), so if the assignment above doesn't crash, it ends up writing to who-knows-where. With some local changes I was making, sometimes, `tp' happened to be left pointing at linux_nat.c:lwp_list, and so that assignment above ended up clearing lp->waitstatus.kind (of the first lwp in the list), which resulted in GDB considering that the child process had exited (because TARGET_SIGNAL_0 == TARGET_WAITKIND_EXITED). This should fix intermittent foll-fork.exp foll-vfork.exp fork-child-threads.exp failures. Checked in. -- Pedro Alves