This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add overloads of for_each_thread/find_thread that filter on pid
- From: Simon Marchi <simark at simark dot ca>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Sat, 21 Oct 2017 12:21:12 -0400
- Subject: Re: [PATCH] Add overloads of for_each_thread/find_thread that filter on pid
- Authentication-results: sourceware.org; auth=none
- References: <1507987316-23584-1-git-send-email-simon.marchi@ericsson.com>
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