From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72996 invoked by alias); 23 Aug 2016 15:21:03 -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 72986 invoked by uid 89); 23 Aug 2016 15:21:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Tue, 23 Aug 2016 15:21:01 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 621E743A3C; Tue, 23 Aug 2016 15:21:00 +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 u7NFKxur025077; Tue, 23 Aug 2016 11:20:59 -0400 Subject: Re: Run process-dies-while-detaching.exp with SW watchpoint To: Yao Qi , gdb-patches@sourceware.org References: <86zio3bkzb.fsf@gmail.com> From: Pedro Alves Message-ID: <2a6bb905-26ad-a496-7fbf-74f99f62a48f@redhat.com> Date: Tue, 23 Aug 2016 15:21:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <86zio3bkzb.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-08/txt/msg00231.txt.bz2 On 08/23/2016 03:47 PM, Yao Qi wrote: > > Hi, > I see the following fail when I run tests on some ARM board without > HW watchpoint support, > > (gdb) watch globalvar^M > Watchpoint 2: globalvar^M > (gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: detach: watchpoint: watch globalvar > > I think we should run test_detach_watch with both HW watchpoint and SW > watchpoint. I modified it, as the patch shown below, but the > test_detach_watch with SW watchpoint causes some test fails even on > x86_64, > > Thread 12 "process-dies-wh" hit Temporary breakpoint 3, 0x00002aaaaafaf2d0 in _exit () from /lib/x86_64-linux-gnu/libc.so.6^M > (gdb) PASS: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint hw=0: continue to breakpoint: _exit > continue^M > Continuing.^M > Cannot find user-level thread for LWP 2363: generic error^M > (gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint hw=0: continue > > When the error is thrown, the stack backtrace is > > (gdb) bt 10 > #0 thread_from_lwp (ptid=...) at /home/yao/SourceCode/gnu/gdb/git/gdb/linux-thread-db.c:356 > #1 0x0000000000460fb4 in thread_db_wait (ops=, ptid=..., ourstatus=0x7fff702c0510, options=1) > at /home/yao/SourceCode/gnu/gdb/git/gdb/linux-thread-db.c:1146 > #2 0x00000000005b69cd in delegate_wait (self=, arg1=..., arg2=, arg3=) > at /home/yao/SourceCode/gnu/gdb/git/gdb/target-delegates.c:116 > #3 0x00000000005c5bb4 in target_wait (ptid=..., status=status@entry=0x7fff702c0510, options=options@entry=1) > at /home/yao/SourceCode/gnu/gdb/git/gdb/target.c:2289 > #4 0x0000000000578269 in do_target_wait (ptid=..., status=status@entry=0x7fff702c0510, options=1) at /home/yao/SourceCode/gnu/gdb/git/gdb/infrun.c:3641 > #5 0x0000000000583a1b in fetch_inferior_event (client_data=) at /home/yao/SourceCode/gnu/gdb/git/gdb/infrun.c:3952 > #6 0x0000000000598cd5 in gdb_wait_for_event (block=block@entry=0) at /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:859 > #7 0x0000000000598ee5 in gdb_do_one_event () at /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:322 > #8 0x0000000000598f55 in start_event_loop () at /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:371 > #9 0x0000000000592d18 in captured_command_loop (data=data@entry=0x0) at /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:324 > > and the "ourstatus" got from beneath->to_wait is > > (gdb) p *ourstatus > $1 = {kind = TARGET_WAITKIND_STOPPED, value = {integer = 5, sig = GDB_SIGNAL_TRAP, related_pid = {pid = 5, lwp = 0, tid = 0}, > execd_pathname = 0x5 , syscall_number = 5}} > > looks linux-nat target thinks the thread is stopped, but thread-db can't > find the thread. Is it a known problem (in gdb or glibc)? > Doesn't this just mean that the process died meanwhile? That's the point of the test. /proc/TID/status probably shows that the thread is now zombie. BTW, software watchpoints aren't defined very well with threads, but, it sounds like you'd get the same problem if you single-step all the way to exit instead of "continue", which in effect is what a software watchpoint does. Thanks, Pedro Alves