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

Vinay Sridhar
2009-02-23T08:53:46Z

On Sun, 2009-02-22 at 14:43 -0500, Daniel Jacobowitz wrote:
> On Fri, Feb 20, 2009 at 09:29:19AM +0530, Vinay Sridhar wrote:
> > I placed a break on "add_thread" as you suggested. It doesn't seem to be
> > hit at all, for any of the threads.
> > BTW, I'm using GNU gdb (GDB) 6.8.50.20090216.
>
> At the time of the original error, are all your threads in the thread
> list? GDB's internal thread_list variable, not the result of "info
> threads", which will check for new threads.
>

At the time of the error, all the threads are in the thread_list. All
threads but the parent thread have private field filled.

(gdb) p thread_list->private {pid = 12022, lwp = 12027}
$7 = (struct private_thread_info *) 0x10870530
(gdb) p thread_list->next->private {pid = 12022, lwp = 12026}
$8 = (struct private_thread_info *) 0x108a7b80
(gdb) p thread_list->next->next->private {pid = 12022, lwp = 12025}
$9 = (struct private_thread_info *) 0x10844e70
(gdb) p thread_list->next->next->next->private {pid = 12022,lwp = 12022}
$10 = (struct private_thread_info *) 0x0

> If they are, and they do not have private info set, what added them to
> the thread list? I missed one function; maybe they were added by
> add_thread_silent?
>

yes, add_thread_silent () is called on the threads. Its called for the
parent from fork_inferior () and for the child threads from
add_thread_with_info ()