Re: [RFC][Patch] Fix gdb failure to access tls data for parent thread

Vinay Sridhar
2009-02-24T10:57:43Z

> Pedro,
>
> Please try this test and let me know if you're able to get a recreate:
>
> ï»¿$ cat test.c
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <omp.h>
>
> __thread int thr;
>
> void initTlsData() {
> printf("Initialising thread %d\n",thr);
> }
>
> int main(int argc, char *argv[]) {
> #pragma omp parallel
> {
> thr = omp_get_thread_num();
> initTlsData();
> }
> return(0);
> }
>
> 0. export OMP_NUM_THREADS = <X>
> 1. gcc -g test.c -fopenmp -o test
> 2. gdb ./test
> 3. break initTlsData
==========================

4. run (extremely sorry for missing this in the previous mail)

==========================

> 4. thread 1 (Switch to main thread)
> 5. print thr (You should see the error after this)
>