[PATCH] Disable thread specific breakpoints when thread dies

Michael Snyder msnyder@redhat.com
Fri Jan 13 04:19:00 GMT 2006


Daniel,

valid_thread_id wouldn't be safe, because thread ids might be re-used.

This implementation looks fine to me...

Michael

Andrew STUBBS wrote:
> Ping.
> 
> Since valid_thread_id did not work am I OK to commit this one. It has 
> been on hold since mid Novemeber.
> 
> Thanks
> 
> Andrew
> 
> Andrew Stubbs wrote:
> 
>> Daniel Jacobowitz wrote:
>>
>>> On Wed, Nov 16, 2005 at 02:52:17PM +0000, Andrew STUBBS wrote:
>>>
>>>> +      /* There is no point inserting thread-specific breakpoints if 
>>>> the
>>>> +     thread no longer exists.  */
>>>> +      if (b->owner->thread != -1
>>>> +      && !target_thread_alive(thread_id_to_pid(b->owner->thread)))
>>>> +    continue;
>>>
>>>
>>>
>>>
>>> You shouldn't need to use the target method here.  Does valid_thread_id
>>> work?
>>>
>>> Also, please remember the space before opening parentheses.
>>
>>
>>
>> The thread still seems to have a valid ID after it has died. You can 
>> even do 'b 8 t 4' after the program has exited. It does give an error 
>> for threads which never existed though.
>>
>> Here is the patch again with the spaces fixed.
>>
>> Andrew
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> 2005-11-17  Andrew Stubbs  <andrew.stubbs@st.com>
>>
>>     * breakpoint.c (insert_breakpoints): Check that a thread exists
>>     before inserting thread specific breakpoints.
>>
>> Index: src/gdb/breakpoint.c
>> ===================================================================
>> --- src.orig/gdb/breakpoint.c    2005-11-17 15:47:04.000000000 +0000
>> +++ src/gdb/breakpoint.c    2005-11-17 15:47:42.000000000 +0000
>> @@ -1142,6 +1142,12 @@ insert_breakpoints (void)
>>        if (!breakpoint_enabled (b->owner))
>>      continue;
>>  
>> +      /* There is no point inserting thread-specific breakpoints if the
>> +     thread no longer exists.  */
>> +      if (b->owner->thread != -1
>> +      && !target_thread_alive (thread_id_to_pid (b->owner->thread)))
>> +    continue;
>> +
>>        /* FIXME drow/2003-10-07: This code should be pushed elsewhere 
>> when
>>       hardware watchpoints are split into multiple loc breakpoints.  */
>>        if ((b->loc_type == bp_loc_hardware_watchpoint
> 
> 
> 



More information about the Gdb-patches mailing list