[PATCH 3/3] Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.
John Baldwin
jhb@FreeBSD.org
Mon Oct 1 16:33:00 GMT 2018
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
                                                                           Â
More information about the Gdb-patches
mailing list