[PATCH] Add overloads of for_each_thread/find_thread that filter on pid
Simon Marchi
simark@simark.ca
Sat Oct 21 16:21:00 GMT 2017
On 2017-10-14 09:21 AM, Simon Marchi wrote:
> It happens often that we want to iterate or find threads restricted to a
> given pid. I think it's worth having an overload to help with this.
> Right now there is a single user of each of the find_thread and
> for_each_thread overload, but as we replace the usages of find_inferior
> with for_each_thread/find_thread, more usages will pop up.
>
> Here's an example of a future change that could use it:
> https://github.com/simark/binutils-gdb/commit/9ae5b90d8e6a6836f26ef6685e1f343112e1182a
>
> gdb/gdbserver/ChangeLog:
>
> * gdbthread.h (find_thread, for_each_thread): New functions.
> * inferiors.c (thread_of_pid): Remove.
> (find_any_thread_of_pid): Use find_thread.
> * linux-low.c (num_lwps): Use for_each_thread.
I pushed this patch in.
Simon
More information about the Gdb-patches
mailing list