GDB support for thread-local storage

Jim Blandy
Fri Jun 21 16:14:00 GMT 2002

One of the reasons I really like having libthread_db handle TLS
resolution is that the alternative is to do an inferior function call
when you reference a variable.  Check out Uli's document, at the
pointer I gave --- even the compiler will sometimes have to generate a
call to __tls_get_addr to find a __thread variable's address.

And GDB shouldn't cache this base address while the inferior runs,
either --- remember the "GDB must never lie" rule.  Evaluating `x' in
GDB had better reference the same storage that it would if the compiler
evaluated `x' at the point where the program is stopped.

So if we have trouble keeping the Insight variable window up-to-date

Anyway, in that context, having libthread_db handle it all in-process
seems really nice.

More information about the Gdb mailing list