GDB support for thread-local storage
Daniel Jacobowitz
drow@mvista.com
Mon Aug 19 09:05:00 GMT 2002
On Wed, Jun 26, 2002 at 11:56:58PM -0500, Jim Blandy wrote:
>
> 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?
>
> (Not that the question is especially relevant to the discussion --- of
> course it could do a simple checksum check.)
You're right, and you're wrong. For instance, td_ta_map_id2thr.c:
#include <linuxthreads/internals.h>
struct pthread_handle_struct phc;
if (ps_pdread (ta->ph, ta->handles + pt % pthread_threads_max, &phc,
sizeof (struct pthread_handle_struct)) != PS_OK)
if (phc.h_descr == NULL)
etc.
which references:
struct pthread_handle_struct {
struct _pthread_fastlock h_lock; /* Fast lock for sychronized access */
pthread_descr h_descr; /* Thread descriptor or NULL if invalid */
char * h_bottom; /* Lowest address in the stack thread */
};
Worse, it reads the _pthread_descr_struct from the inferior.
_pthread_descr_struct does not describe the layout of anything; it's
the actual descriptor. It has things like a sigjmp_buf in it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gdb
mailing list