This is the mail archive of the archer@sourceware.org mailing list for the Archer 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: ptrace improvement: PTRACE_O_INHERIT


On 02/16, Roland McGrath wrote:
>
> > Or, attach can use a mutex in engine->data and synchronize with its
> > own report_clone/report_death callbacks. This makes attach O(n).
> > ugdb does this.
>
> Sure, you'd do that too.  But for attaching to live threads, you still have
> to chase the new clones just done by the unattached threads before you
> attached them.

Actually no, or I misunderstood.

To simplify, lets ignore the problems with the dead group_leader.
Now suppose (again, to simplify) that report_clone/report_death
take global_mutex before anything else, and attach-to-all takes
this mutex too.

This means we can always use next_thread(last_attached_thread).
The next attach can fail if it races with exit, in this case
we should just re-read next_thread() and retry.

We should see all sub-threads, copy_process() does list_add_tail().
Once next_thread() returns the group leader, everything is done.

Oleg.


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