[patch] Accessing tls variables across files causes a bug
Ulrich Weigand
uweigand@de.ibm.com
Tue Dec 2 13:54:00 GMT 2008
Jan Kratochvil wrote:
> > I'm not sure I understand this comment -- the translated address of
> > a thread-local variable obviously depends on the thread in which it
> > is evaluated, so how should a single location like SYMBOL_VALUE_ADDRESS
> > be able to hold that value for all threads?
>
> SYMBOL_VALUE_ADDRESS is used many times across GDB code and I assumed in most
> of such cases it would be more appropriate to return the absolute address
> valid for current inferior_ptid.
>
> But I now briefly checked all these points and found out in fact all of them
> work with SYMBOL_VALUE_ADDRESS referring to function symbols - PC values (just
> except value_static_field() but that is also not in use with TLS symbols).
> Sure PC values are never TLS-translated.
Agreed.
> > In the LOC_COMPUTED case, we'd output something like "at offset ...
> > in the thread-local storage for ...". For consistency reasons, I'd
> > prefer to have the same output in the LOC_UNDEFINED case as well.
>
> While I copied the message from the LOC_COMPUTED case I agree it should be
> consistent and if I wish the absolute address there it should be printed even
> in the LOC_COMPUTED case which would be more a scope of a different patch.
OK, thanks.
> 2008-12-01 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix resolving external references to TLS variables.
> * findvar.c: Include `objfiles.h'.
> (read_var_value <LOC_UNRESOLVED>): New variable `obj_section'. Handle
> SEC_THREAD_LOCAL variables.
> * printcmd.c (address_info <LOC_UNRESOLVED>): Handle SEC_THREAD_LOCAL
> variables.
>
> 2008-12-01 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Test resolving external references to TLS variables.
> * gdb.threads/tls.exp: New tests to examine A_THREAD_LOCAL and
> FILE2_THREAD_LOCAL.
> (testfile2, srcfile2): New variables.
> * gdb.threads/tls.c (file2_thread_local)
> (function_referencing_file2_thread_local): New.
> * gdb.threads/tls2.c: New file.
This is OK.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list