[PATCH] Remove support for thread events without PTRACE_EVENT_CLONE in GDB.

Antoine Tremblay antoine.tremblay@ericsson.com
Thu Dec 10 15:21:00 GMT 2015



On 12/10/2015 09:47 AM, Pedro Alves wrote:
> On 12/09/2015 05:39 PM, Antoine Tremblay wrote:
>> Before, on systems that did not support PTRACE_EVENT_CLONE, both GDB and
>> GDBServer coordinated with libthread_db.so to insert breakpoints at magic
>> locations in libpthread.so, in order to break at thread creation and
>> thread death.
>>
>> Support for thread events was removed from GDBServer as patch:
>> https://sourceware.org/ml/gdb-patches/2015-11/msg00466.html
>>
>> This patch removes support for thread events in GDB.
>>
>> No regressions found on Ubuntu 14.04 x86_64.
>>
>> gdb/ChangeLog:
>> 	* breakpoint.c (create_thread_event_breakpoint): Remove.
>> 	(remove_thread_event_breakpoints): Remove.
>
> That's still used:
>
>   $ grep create_thread_event_breakpoint gdb/*
>   gdb/aix-thread.c:  if (!create_thread_event_breakpoint (target_gdbarch (), pd_brk_addr))
>
>

Ouch, I had missed that one. I'll re-add the function.

Also I noticed I forgot to remove the declaration in breakpoint.h I'll 
fix that for remove_thread_event_breakpoint.

>
>> -  /* Under GNU/Linux, we have to attach to each and every thread.  */
>> -  if (target_has_execution
>> -      && tp == NULL)
>> -    {
>> -      int res;
>> -
>> -      res = lin_lwp_attach_lwp (ptid_build (ptid_get_pid (ptid),
>> -					    ti_p->ti_lid, 0));
>> -      if (res < 0)
>> -	{
>> -	  /* Error, stop iterating.  */
>
>
> Is lin_lwp_attach_lwp used anywhere after this?
>

No indeed, Removing.

>
>
>> @@ -1592,24 +1200,10 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
>>
>>     if (ti.ti_tid == 0)
>>       {
>> -      /* A thread ID of zero means that this is the main thread, but
>> -	 glibc has not yet initialized thread-local storage and the
>> -	 pthread library.  We do not know what the thread's TID will
>> -	 be yet.  Just enable event reporting and otherwise ignore
>> -	 it.  */
>
> You shouldn't remove the whole comment -- it's still all correct
> except the last sentence.
>

Yes I hesitated on that one, it felt like the reason for the comment was 
the last sentence so I removed it.

But I'm OK with leaving it there.

V2 follows in next mail.

Thanks,
Antoine



More information about the Gdb-patches mailing list