From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1479 invoked by alias); 30 Apr 2008 14:36:51 -0000 Received: (qmail 1454 invoked by uid 22791); 30 Apr 2008 14:36:50 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Apr 2008 14:36:32 +0000 Received: (qmail 19490 invoked from network); 30 Apr 2008 14:36:30 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Apr 2008 14:36:30 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: linux native, switch forks, always have a thread Date: Wed, 30 Apr 2008 16:42:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_uPIGI6IOZo1dRgq" Message-Id: <200804301536.30066.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00704.txt.bz2 --Boundary-00=_uPIGI6IOZo1dRgq Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 364 I'd missed this case when I made linux native always have a thread. It's not perfect in the sense that switching forks ("restart"/"fork", not follow-fork-mode) in multi-threaded apps doesn't handle multi-threading correctly yet, but that is an already existing problem. We shall be getting back to that in a few weeks for multi-process support. -- Pedro Alves --Boundary-00=_uPIGI6IOZo1dRgq Content-Type: text/x-diff; charset="utf-8"; name="fork_have_a_thread.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fork_have_a_thread.diff" Content-length: 666 2008-04-30 Pedro Alves * linux-nat.c (linux_nat_switch_fork): Reinit GDB's thread list and register the fork's PTID as a thread. --- gdb/linux-nat.c | 2 ++ 1 file changed, 2 insertions(+) Index: src/gdb/linux-nat.c =================================================================== --- src.orig/gdb/linux-nat.c 2008-04-28 11:54:27.000000000 +0100 +++ src/gdb/linux-nat.c 2008-04-28 11:53:38.000000000 +0100 @@ -948,8 +948,10 @@ linux_nat_switch_fork (ptid_t new_ptid) { struct lwp_info *lp; + init_thread_list (); init_lwp_list (); lp = add_lwp (new_ptid); + add_thread_silent (new_ptid); lp->stopped = 1; } --Boundary-00=_uPIGI6IOZo1dRgq--