Re: GDB support for thread-local storage

Andrew Cagney
2002-06-27T15:13:09Z

> Andrew Cagney <ac131313@ges.redhat.com> writes:
>
>> > Doesn't libthread_db read `struct _pthread_descr_struct' from the
>> > linuxthreads library in the inferior, rather than knowing the layout
>> > itself? So it's actually the inferior's linuxthreads library that
>> > describes its own structures' layout.
>
>>
>> The structure layout will have been compiled into libthread-db.a. It
>> implicitly knows the layout itself.
>
>
> I think you're wrong here. Could you show me the code?

Sorry, you've lost me.

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/linuxthreads/descr.h?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=glibc
> struct _pthread_descr_struct {
> /* XXX Remove this union for IA-64 style TLS module */
> union {
> struct {
> void *tcb; /* Pointer to the TCB. This is not always
> the address of this thread descriptor. */
> union dtv *dtvp;
> pthread_descr self; /* Pointer to this structure */
> } data;
> void *__padding[16];
> } p_header;
> pthread_descr p_nextlive, p_prevlive;
> /* Double chaining of active threads */
> pthread_descr p_nextwaiting; /* Next element in the queue holding the thr */
> pthread_descr p_nextlock; /* can be on a queue and waiting on a lock */
> pthread_t p_tid; /* Thread identifier */
> int p_pid; /* PID of Unix process */

Note the use of ISA/ABI dependant data types such as ``int'', ``void
*'', ... As such they are implicitly included in and compiled into
libhread-db.a

enjoy,
Andrew