Amusing problem in current libthread_db

Daniel Jacobowitz
2003-06-03T22:09:20Z

In recent versions of libthread_db, there's this interesting code:

td_err_e
td_thr_getgregs (const td_thrhandle_t *th, prgregset_t gregs)
{
struct _pthread_descr_struct pds;

LOG ("td_thr_getgregs");

if (th->th_unique == NULL)
{
/* No data yet. */
memset (gregs, '\0', sizeof (prgregset_t));
return TD_OK;
}

So, if we don't have a th_unique, claim to have no registers. So for the
first thread, until the thread manager is initialized [for LinuxThreads at
least - is it initialized earlier in NPTL?], we claim that all
registers are zero. GDB loads the registers during this interval.

So it thinks the PC is zero. Anyone know the reason for this change, which
appears to have come in with:
date: 2002/07/16 03:35:49; author: drepper; state: Exp; lines: +7 -0
Some more changes to handle TLS-enabled libpthread.

It doesn't seem to cause any problems, which baffles me just a little bit.
I'm still trying to figure that part out.

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer