From patchwork Fri Dec 9 06:37:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 18312 Received: (qmail 69475 invoked by alias); 9 Dec 2016 06:38:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 69457 invoked by uid 89); 9 Dec 2016 06:38:20 -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, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=sk:startup, restores, 2016-12-09, H*r:PST X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 06:38:09 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1cFEoo-0005vS-3X from Thomas_Schwinge@mentor.com ; Thu, 08 Dec 2016 22:38:06 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.224.2; Thu, 8 Dec 2016 22:38:05 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 3484EC22F1; Thu, 8 Dec 2016 22:38:05 -0800 (PST) From: Thomas Schwinge To: Pedro Alves , CC: Subject: Re: [PATCH 2/4] Push pruning old threads down to the target In-Reply-To: <1412266896-28210-3-git-send-email-palves@redhat.com> References: <1412266896-28210-1-git-send-email-palves@redhat.com> <1412266896-28210-3-git-send-email-palves@redhat.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 9 Dec 2016 07:37:58 +0100 Message-ID: <87k2b9ip4p.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Thu, 2 Oct 2014 17:21:34 +0100, Pedro Alves wrote: > When GDB wants to sync the thread list with the target's [...] > --- a/gdb/thread.c > +++ b/gdb/thread.c > void > update_thread_list (void) > { > - prune_threads (); > - target_find_new_threads (); > + target_update_thread_list (); > update_threads_executing (); > } Pushed to master: commit c752a4cccb99ba73f51eff74b394dcdcd26d4c59 Author: Thomas Schwinge Date: Wed May 25 18:54:40 2016 +0200 Hurd: Adjust to changes to "push pruning old threads down to the target" For "info threads", we currently run into: $ gdb/gdb -q -nw -nx --batch -ex start -ex info\ threads bfd/doc/chew Temporary breakpoint 1 at 0x80486e0: file ../../../W._C._Handy/bfd/doc/chew.c, line 1535. [New Thread 10656.5] Thread 4 hit Temporary breakpoint 1, main (ac=1, av=0x102cd84) at ../../../W._C._Handy/bfd/doc/chew.c:1535 1535 { Id Target Id Frame 1 bogus thread id 1 Can't fetch registers from thread bogus thread id 1: No such thread Before commit e8032dde10b743253125d7defb5f5503b21c1d26, gdb/thread.c:update_thread_list used to call prune_threads, after that change it doesn't anymore, and we don't implement the to_update_thread_list target method where the prune_threads call got moved. For now, apply a fix, related to commit c82f56d9d760a9b4034eeaac44f2f0fa5779ff69 "Hurd: Adjust to startup-with-shell changes", which restores the previous behavior: Id Target Id Frame * 4 Thread 10688.4 main (ac=1, av=0x102cd84) at ../../../W._C._Handy/bfd/doc/chew.c:1535 5 Thread 10688.5 0x0106096c in ?? () from /lib/i386-gnu/libc.so.0.3 Not perfect, but at least better. gdb/ * gnu-nat.c (gnu_create_inferior): After startup_inferior, call prune_threads. --- gdb/ChangeLog | 3 +++ gdb/gnu-nat.c | 2 ++ 2 files changed, 5 insertions(+) Grüße Thomas diff --git gdb/ChangeLog gdb/ChangeLog index 302eb6e..7fd5d32 100644 --- gdb/ChangeLog +++ gdb/ChangeLog @@ -1,5 +1,8 @@ 2016-12-09 Thomas Schwinge + * gnu-nat.c (gnu_create_inferior): After startup_inferior, call + prune_threads. + * inferior.c (print_selected_inferior): Avoid PATH_MAX usage. 2016-12-08 Simon Marchi diff --git gdb/gnu-nat.c gdb/gnu-nat.c index 124574e..85a53b8 100644 --- gdb/gnu-nat.c +++ gdb/gnu-nat.c @@ -2163,6 +2163,8 @@ gnu_create_inferior (struct target_ops *ops, startup_inferior (START_INFERIOR_TRAPS_EXPECTED); inf->pending_execs = 0; + /* Get rid of the old shell threads. */ + prune_threads (); inf_validate_procinfo (inf); inf_update_signal_thread (inf);