[PATCH 1/3] gdbserver: Remove duplicate functions to find any thread of process

Simon Marchi simon.marchi@polymtl.ca
Fri Sep 15 12:53:00 GMT 2017


On 2017-09-15 06:09, Sergio Durigan Junior wrote:
> On Sunday, September 10 2017, Simon Marchi wrote:
> 
>> We have about 6 functions/callbacks to find_inferior meant to find a
>> thread that belongs to a given pid.  Remove all but
>> find_any_thread_of_pid and replace their uses with
>> find_any_thread_of_pid.
> 
> Thanks for doing.  gdbserver is really confusing when dealing with
> threads and their data structures, so this patch is a nice step towards
> a better interface.

One thing I'm working one is getting rid of 
inferior_list/inferior_list_entry.  The patch is pretty much complete, 
but I keep hesitating about meaningless details... I should just kick 
myself and submit what I have.

> I think this can go in as is, because it is a self contained cleanup,
> but I would like us to move yet another step ahead: recently I've
> implemente gdbserver's version of "switch_to_thread", and I couldn't
> help but think that a "switch_to_any_thread_of_pid" would be good to
> have, because that's what's happening most of the time in this patch.

Ok, sounds like implementing that would just be find_any_thread_of_pid + 
switch_to_thread.

> I know I have to bite the bullet and convert places where
> "current_thread = find_thread_ptid (ptid)" is still being used so that
> "switch_to_thread" is used globally.  I intend to submit a patch for
> that.

Seems like you already did!

> Anyway, this looks good to me.

Thanks for the review, I'll push it in.

Simon



More information about the Gdb-patches mailing list