This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add overloads of for_each_thread/find_thread that filter on pid


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]