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 03/18] attach + target always in non-stop mode: stop all threads


On 11/26/2015 04:12 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>> It actually ends up being the same, and bit more generic to go with
>> lowest, because target_attach should always adds the main thread first.
>> Otherwise, there's no such concept of "main" thread in the common code.
>> "The thread with pid == lwpid" holds true for NTPL/Linux, but not everywhere,
>> and even then the leader thread may have exited already.  I'll update
>> the comment.
> 
> Yes, there is no such concept of "main" thread.  My real concern on
> "choosing lowest one" is about pid recycling.  Our intention is to pick up
> main thread, but the lowest one may not be the main thread if pid
> recycling is considered.

But this the GDB thread id.  If a new thread recycles an old pid/tid, it'll
still get a new GDB thread id.  (And if GDB thread ids wrap around we have
bigger problems elsewhere, which I think we'd likely sort by simply making
gdb thread ids 64-bit instead).

Thanks,
Pedro Alves


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