From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41727 invoked by alias); 29 Jul 2015 13:38:51 -0000 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 Received: (qmail 41718 invoked by uid 89); 29 Jul 2015 13:38:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 29 Jul 2015 13:38:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 4C51D8EA5D; Wed, 29 Jul 2015 13:38:48 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6TDckWb008105; Wed, 29 Jul 2015 09:38:46 -0400 Message-ID: <55B8D765.9010003@redhat.com> Date: Wed, 29 Jul 2015 13:38:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Don Breazeal , "Breazeal, Don" , Simon Marchi CC: GDB Patches Subject: Re: [PATCH 3/N] remote follow fork and spurious child stops in non-stop mode References: <1437672294-29351-1-git-send-email-palves@redhat.com> <55B1308E.4020700@redhat.com> <55B2875E.1070504@codesourcery.com> <55B8D34F.5060002@redhat.com> In-Reply-To: <55B8D34F.5060002@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-07/txt/msg00869.txt.bz2 On 07/29/2015 02:21 PM, Pedro Alves wrote: > > I tried writing a test for this, by making a multithreaded program > have all its threads but the main continuously fork (see attached), while > the main thread continuously steps over a breakpoint (a conditional > breakpoint with condition "0" should do it, as gdbserver handles > that breakpoint itself), but that stumbles on yet more problems... :-/ > > $ ./gdb ./testsuite/gdb.threads/fork-plus-threads-2 -ex "set non-stop on" -ex "set detach-on-fork off" -ex "tar extended-rem :9999" > ... > Remote debugging using :9999 > (gdb) > [Thread 24971.24971] #1 stopped. > 0x0000003615a011f0 in ?? () > c& > Continuing. > (gdb) [New Thread 24971.24981] > [New Thread 24983.24983] > [New Thread 24971.24982] > > [Thread 24983.24983] #3 stopped. > 0x0000003615ebc7cc in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:130 > 130 pid = ARCH_FORK (); > [New Thread 24984.24984] > Error in re-setting breakpoint -16: PC register is not available > Error in re-setting breakpoint -17: PC register is not available > Error in re-setting breakpoint -18: PC register is not available > Error in re-setting breakpoint -19: PC register is not available > Error in re-setting breakpoint -24: PC register is not available > Error in re-setting breakpoint -25: PC register is not available > Error in re-setting breakpoint -26: PC register is not available > Error in re-setting breakpoint -27: PC register is not available > Error in re-setting breakpoint -28: PC register is not available > Error in re-setting breakpoint -29: PC register is not available > Error in re-setting breakpoint -30: PC register is not available > PC register is not available > (gdb) > Hmm, gdbserver's logs (for a different run) show: ... HEW: Got clone event from LWP 25962, new child is LWP 25989 my_waitpid (-1, 0x40000001) my_waitpid (-1, 0x1): status(137f), 25990 LWFE: waitpid(-1, ...) returned 25990, ERRNO-OK LLW: waitpid 25990 received Stopped (signal) (stopped) my_waitpid (-1, 0x40000001) my_waitpid (-1, 0x1): status(0), 25988 LWFE: waitpid(-1, ...) returned 25988, ERRNO-OK LLW: waitpid 25988 received 0 (exited) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LLFE: 25988 exited. ^^^^^^^^^^^^^^^^^^^ my_waitpid (-1, 0x40000001) my_waitpid (-1, 0x80000001): status(1057f), 25973 LWFE: waitpid(-1, ...) returned 25973, ERRNO-OK LLW: waitpid 25973 received Trace/breakpoint trap (stopped) pc is 0x3615ebc7cc HEW: Got fork event from LWP 25973, new child is 25990 pc is 0x3615ebc7cc pc is 0x3615ebc7cc my_waitpid (-1, 0x40000001) my_waitpid (-1, 0x80000001): status(117f), 25972 LWFE: waitpid(-1, ...) returned 25972, ERRNO-OK LLW: waitpid 25972 received Child exited (stopped) pc is 0x3616a0f279 my_waitpid (-1, 0x40000001) my_waitpid (-1, 0x80000001): status(117f), 0 LWFE: waitpid(-1, ...) returned 0, ERRNO-OK RSRL: resuming stopped-resumed LWP LWP 25962.25962 at 3615ef4ce1: step=0 pc is 0x3615ef4ce1 Resuming lwp 25962 (continue, signal 0, stop not expected) continue from pc 0x3615ef4ce1 RSRL: resuming stopped-resumed LWP LWP 25962.25989 at 0: step=0 pc is 0x3615ef4ce1 Resuming lwp 25989 (continue, signal 0, stop not expected) continue from pc 0x3615ef4ce1 sigchld_handler Ignored signal 17 for LWP 25972. pc is 0x3616a0f279 Resuming lwp 25972 (continue, signal 17, stop not expected) continue from pc 0x3616a0f279 handling possible target event >>>> entering linux_wait_1 linux_wait_1: [] Got a pending child 25973 Got an event from pending child 25973 (1057f) Hit a non-gdbserver trap event. SEL: Found 2 SIGTRAP events, selecting #1 linux_wait_1 ret = LWP 25988.25988, 1, 0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ("1" is TARGET_WAITKIND_STOPPED) <<<< exiting linux_wait_1 Writing resume reply for LWP 25988.25988:1 ptrace(regsets_fetch_inferior_registers) PID=25988: No such process ptrace(regsets_fetch_inferior_registers) PID=25988: No such process ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Ignore the "SIGTRAP" mention in "SEL: Found 2 SIGTRAP events", it's "two events". And the one that was picked was a process exit. But the tail end of linux_wait_1 isn't expecting that can happen. Thanks, Pedro Alves