Fix TLS access for -static -pthread
Commit Message
On 06/05/2014 04:06 PM, Jan Kratochvil wrote:
>> This patch is to set another breakpoint at the end of main, so that
>> > main thread will hit it, and we can check the value of tlsvar then.
>> > It is safe and we don't have to worry about whether gdb is able to
>> > unwind from pthread library to main function or not.
> I have to warn that it may be a bit weaker test, it never tests both threads
> TLS access during the same stop, it tests only the current thread.
>
> But it still tests the patch works so I am fine with it (not an approval).
>
The patch below is to keep testing TLS access in one stop, and
work around the bug of unwinding clone. WDYT?
Comments
On Thu, 05 Jun 2014 11:29:32 +0200, Yao Qi wrote:
> The patch below is to keep testing TLS access in one stop, and
> work around the bug of unwinding clone. WDYT?
Great idea, I like this one more.
Jan
On 06/05/2014 05:39 PM, Jan Kratochvil wrote:
> On Thu, 05 Jun 2014 11:29:32 +0200, Yao Qi wrote:
>> The patch below is to keep testing TLS access in one stop, and
>> work around the bug of unwinding clone. WDYT?
>
> Great idea, I like this one more.
>
Can I check it in?
On 06/05/2014 03:18 PM, Yao Qi wrote:
> On 06/05/2014 05:39 PM, Jan Kratochvil wrote:
>> On Thu, 05 Jun 2014 11:29:32 +0200, Yao Qi wrote:
>>> The patch below is to keep testing TLS access in one stop, and
>>> work around the bug of unwinding clone. WDYT?
>>
>> Great idea, I like this one more.
>>
>
> Can I check it in?
Sure, thanks.
On 06/05/2014 11:23 PM, Pedro Alves wrote:
>> Can I check it in?
> Sure, thanks.
Patch is pushed in.
@@ -38,7 +38,6 @@ thread_function (void *arg)
#ifdef HAVE_TLS
tlsvar = 2;
#endif
- printf ("Thread executing\n"); /* tlsvar-is-set */
while (sem_wait (&semaphore) != 0)
{
if (errno != EINTR)
@@ -47,6 +46,7 @@ thread_function (void *arg)
return NULL;
}
}
+ printf ("Thread executing\n"); /* tlsvar-is-set */
return NULL;
}
@@ -105,7 +105,7 @@ if { "$have_tls" != "" } {
gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*"
gdb_test "p tlsvar" " = 2" "tlsvar in thread"
gdb_test "thread 1" ".*"
- # Unwind from pthread_join.
+ # Unwind to main.
gdb_test "up 10" " in main .*"
gdb_test "p tlsvar" " = 1" "tlsvar in main"
}