From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29860 invoked by alias); 23 Jun 2014 15:06:52 -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 29850 invoked by uid 89); 23 Jun 2014 15:06:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD 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; Mon, 23 Jun 2014 15:06:40 +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 (8.14.4/8.14.4) with ESMTP id s5NF6dPI007635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 23 Jun 2014 11:06:39 -0400 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 s5NF6bRL006044; Mon, 23 Jun 2014 11:06:38 -0400 Message-ID: <53A8427D.6070902@redhat.com> Date: Mon, 23 Jun 2014 15:06:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jan Kratochvil , gdb-patches@sourceware.org Subject: Re: [patch] Fix 'gcore' with exited threads References: <20140609203020.GA22447@host2.jankratochvil.net> In-Reply-To: <20140609203020.GA22447@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00819.txt.bz2 On 06/09/2014 09:30 PM, Jan Kratochvil wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1099405 > > Program received signal SIGABRT, Aborted. > [...] > (gdb) gcore foobar > Couldn't get registers: No such process. > (gdb) info threads > [...] > (gdb) gcore foobar > Saved corefile foobar > (gdb) > > gcore tries to access the exited thread: > [Thread 0x7ffff7fce700 (LWP 6895) exited] > ptrace(PTRACE_GETREGS, 6895, 0, 0x7fff18167dd0) = -1 ESRCH (No such process) Note this will still happen if you have the exited thread selected, as in that case the thread can't be deleted: $ ./gdb ~/gdb/tests/threads -ex "set non-stop on" ... (gdb) t 2 [Switching to thread 2 (Thread 0x7ffff7fc6700 (LWP 23009))] #0 thread_function0 (arg=0x0) at threads.c:64 64 usleep (1); /* Loop increment. */ (gdb) p *myp=0 $1 = 0 (gdb) c& Continuing. (gdb) [Thread 0x7ffff7fc6700 (LWP 23009) exited] (gdb) thread [Current thread is 2 (Thread 0x7ffff7fc6700 (LWP 22973)) (exited)] (gdb) info threads Id Target Id Frame 3 Thread 0x7ffff77c5700 (LWP 22974) "threads" (running) 1 Thread 0x7ffff7fc7740 (LWP 22972) "threads" (running) The current thread has terminated. See `help thread'. (gdb) gcore Couldn't get registers: No such process. (gdb) It seems to me linux_corefile_thread_callback should skip exited threads too. > Without the TRY_CATCH protection testsuite FAILs for: > FAIL: gdb.threads/gcore-thread.exp: save a zeroed-threads corefile > FAIL: gdb.threads/gcore-thread.exp: core0file: re-load generated corefile (bad file format) What does the log show ? > Maybe the TRY_CATCH could be more inside update_thread_list(). I'll assume "info threads" is failing at that point too then. Maybe we should downgrade whatever error is triggering to a warning? > Similar update_thread_list() call is IMO missing in procfs_make_note_section() > but I do not have where to verify that change. I wonder whether we should update the thread list in generic code (write_gcore_file). > +gdb_test_multiple "help gcore" "help gcore" { > + -re "Undefined command: .gcore.*\r\n$gdb_prompt $" { Is this coming from copy/paste of existing tests? I believe this is is stale -- gcore.o has been in COMMON_OBS for a while now. I think the actual error will be whatever the default for the target method throws. > + # gcore command not supported -- nothing to test here. > + unsupported "gdb does not support gcore on this target" > + return -1 > + } > + -re "Save a core file .*\r\n$gdb_prompt $" { > + pass "help gcore" > + } > +} -- Pedro Alves