From: Pedro Alves <pedro@codesourcery.com>
To: Michael Snyder <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Fix foll-fork.exp foll-vfork.exp fork-child-threads.exp
Date: Mon, 01 Dec 2008 21:06:00 -0000 [thread overview]
Message-ID: <200812012106.43909.pedro@codesourcery.com> (raw)
In-Reply-To: <493433D7.7080803@vmware.com>
On Monday 01 December 2008 18:58:31, Michael Snyder wrote:
> I'm not sure if this change goes far enough.
This patch restored the same behaviour to what happened
when GDB still used context-switching. No more, no less.
When you had context-switching, no matter which side of
the fork you followed, the current infrun context would have
been left to the thread that ended up being set as current.
Without it, you have to refetch a new pointer to the current
thread, as it may be a different thread that it was on entry.
> If a multi-threaded program forks, only the currently
> executing thread survives in the child.
> All others are
> left behind (and its not unlikely that the thread library
> is left in an inconsistant state, possibly leading to
> deadlocks).
You mean 'not unlikely' in thread library implementations
in several targets, or 'not unlikely' in current glibc/ntpl
implementations? glibc is supposed to handle that gracefully.
>
> We can't do anything about that, but we could, eg.,
> invalidate all known debugger state having to do with
> other threads. Clear the gdb thread list and preserve
> only the current thread.
The new fork *is* considered a new inferior, and starts
with only one thread listed. In mainline,
linux_nat_switch_fork always clears the thread list
and adds a new thread. In a true multi-process linux
native implementation (which can leave GDB attached to
both parent and child, and have them running
simultaneously (*)), we'd still want to consider the child
fork a new single-threaded inferior, and defer to
thread_db to find the thread's thread_db id (and eventually, any
other thread, in the child in case that changes in the future).
Other targets may behave differently, so this is target
side concern.
(*) - I'm working some on that.
--
Pedro Alves
next prev parent reply other threads:[~2008-12-01 21:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 19:15 Pedro Alves
2008-11-20 23:52 ` Ulrich Weigand
2008-11-21 1:35 ` Pedro Alves
2008-11-21 1:49 ` Ulrich Weigand
2008-11-21 2:09 ` Pedro Alves
2008-11-21 11:40 ` Ulrich Weigand
2008-11-21 12:58 ` Pedro Alves
2008-12-01 19:01 ` Michael Snyder
2008-12-01 20:56 ` Daniel Jacobowitz
2008-12-01 22:36 ` Michael Snyder
2008-12-01 21:06 ` Pedro Alves [this message]
2008-12-01 22:38 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200812012106.43909.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox