From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121859 invoked by alias); 1 Oct 2018 16:33:07 -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 121849 invoked by uid 89); 1 Oct 2018 16:33:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=presents, stub, represent, processes X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Oct 2018 16:33:05 +0000 Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 18DAF10B4CE; Mon, 1 Oct 2018 12:33:02 -0400 (EDT) Subject: Re: [PATCH 3/3] Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc. To: Pedro Alves , gdb-patches@sourceware.org References: <20181001103252.5150-1-palves@redhat.com> <20181001103252.5150-4-palves@redhat.com> From: John Baldwin Message-ID: Date: Mon, 01 Oct 2018 16:33:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181001103252.5150-4-palves@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00021.txt.bz2 On 10/1/18 3:32 AM, Pedro Alves wrote: > As preparation for multi-target, this patch makes each inferior have > its own thread list. The BSD-related bits all look fine to me. Do you have an existing branch for this on github that I can pull down to do some simple run-time testing? > As for the init_thread_list calls sprinkled around, they're all > eliminated by this patch, and a new, central call is added to > inferior_appeared. Note how also related to that, there's a call to > init_wait_for_inferior in remote.c that is eliminated. > init_wait_for_inferior is currently responsible for discarding skipped > inline frames, which had to be moved elsewhere. Given that nowadays > we always have a thread even for single-threaded processes, the > natural place is to delete a frame's inline frame info when we delete > the thread. I.e., from clear_thread_inferior_resources. This brings up another question I have. I have out-of-tree patches to add FreeBSD kernel-awareness (there's a mixture of authors and many of the kernel-specific bits are BSD licensed, so I can't upstream it as is, though at some point I might be able to upstream portions of it). One of the changes in this branch is that I have a kernel target similar to bsd-kvm.c but with awareness of threads (so it creates a GDB thread for each kernel thread in the kernel image being examined). Right now this uses init_thread_list (ugh). What is the right thing to do? Should it instead be creating a new inferior to represent the kernel and its set of threads? A somewhat related question is one thing I haven't yet solved which is how to "stack" kernel threads on top of a remote target that presents each CPU as a thread to GDB (e.g. the GDB stub in qemu, or the one I'm working on in FreeBSD's hypervisor). I still don't quite know how to think about solving that, but that is a bit more of an ambitious change I suspect. -- John Baldwin                                                                            Â