This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC][Patch] Fix gdb failure to access tls data for parent thread
On Sun, 2009-02-15 at 13:22 -0500, Daniel Jacobowitz wrote:
> On Thu, Feb 12, 2009 at 11:13:26AM +0530, Vinay Sridhar wrote:
> > On Wed, 2009-02-11 at 10:53 -0500, Daniel Jacobowitz wrote:
> > > On Wed, Feb 11, 2009 at 02:01:08PM +0530, Vinay Sridhar wrote:
> > > > Daniel,
> > > >
> > > > Sorry for the late response. I can confirm that attach_thread is not
> > > > called on the parent thread. The test case I had listed in my earlier
> > > > mail uses OMP for thread creation. Could that have something to do with
> > > > this?
> > >
> > > Well, it shouldn't; libgomp uses the normal POSIX thread interfaces.
> > > I assume you're using GCC -fopenmp, right? Or is this another OpenMP
> > > implementation?
> > >
> >
> > I used IBM's XLC compiler which has an inbuilt OpenMP implementation.
>
> Sorry for the delay, I missed your message.
>
> In that case, you need to determine whether it is using POSIX threads
> or whether it is using clone directly and ignoring the thread library.
> If it is not using the POSIX threads library, how is it handling TLS
> inside the threads? If it is using pthread_create, why didn't we get
> a notification about it?
>
I was able to recreate this against a gcc compiled binary, so I guess
the omp implementation isnt an issue here.
Just to recap what I've been trying:
$ cat tlsdbg01.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <omp.h>
__thread int thr;
void initTlsData() {
printf("Initialising thread %d\n",thread);
}
int main(int argc, char *argv[]) {
#pragma omp parallel
{
thr = omp_get_thread_num();
initTlsData();
}
return(0);
}
1. gcc -g tlsdbg01.c -fopenmp -o tlsdbg
2. gdb ./tlsdbg
3. break initTlsData
4. thread 1
5. print thr
*Cannot find thread-local storage for LWP 29455, executable
*file /home/tmp/tlsdbg:
*TLS not supported on this target
Regards,
Vinay
--
Vinay Sridhar,
IBM Linux Technology Center