From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7252 invoked by alias); 16 Jul 2012 17:49:57 -0000 Received: (qmail 7241 invoked by uid 22791); 16 Jul 2012 17:49:56 -0000 X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jul 2012 17:49:33 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6GHnLpU017877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Jul 2012 13:49:31 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6GHNnVw004124; Mon, 16 Jul 2012 13:23:50 -0400 Message-ID: <50044E25.70301@redhat.com> Date: Mon, 16 Jul 2012 17:49:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Marc Khouzam CC: "'gdb-patches@sourceware.org'" Subject: Re: [Patch] Broken multi-process detach References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-07/txt/msg00216.txt.bz2 On 07/16/2012 02:54 PM, Marc Khouzam wrote: > Hi, > > Detaching from an inferior in multi-process is broken. > The problem seems to be that in linux_nat.c:linux_nat_detach() > GDB first unregisters from the event loop by calling > linux_nat_async (NULL, 0). In multi-process, further > events received from running inferiors are missed; breakpoint > hits are not reported, interrupting a thread is not reported, > and so on. See below for a broken session example. > > We could remove the call to linux_nat_async (NULL, 0) but I didn't > know if that would have bad side-effects. Here is the patch that > does that, if it is felt that is the correct solution. I'm not thinking of any. Looks like I added it in the first async mode version of linux-nat.c (which was much rewritten later on). Let's remove it. Remove also the target_async call below: if (forks_exist_p ()) { /* Multi-fork case. The current inferior_ptid is being detached from, but there are other viable forks to debug. Detach from the current fork, and context-switch to the first available. */ linux_fork_detach (args, from_tty); if (non_stop && target_can_async_p ()) target_async (inferior_event_handler, 0); as this was re-installing the target on the event loop if there were other checkpoints (checkpoint/info checkpoint) to debug. It is now unnecessary if we don't unregister from the event loop in the first place. > > The testsuite hangs on HEAD so I wasn't able to run it yet. > But I'll do so once it works again. It doesn't hang for me. I've tested the patch on x86_64 Fedora 17, both sync and async modes. No regressions. Thanks! -- Pedro Alves