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.

gdb/testsuite/
	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 commit is contained in:
Jan Kratochvil
2008-12-02 14:51:01 +00:00
parent c29235ac9f
commit e0740f779c
7 changed files with 98 additions and 10 deletions

View File

@ -1241,16 +1241,25 @@ address_info (char *exp, int from_tty)
else
{
section = SYMBOL_OBJ_SECTION (msym);
printf_filtered (_("static storage at address "));
load_addr = SYMBOL_VALUE_ADDRESS (msym);
fputs_filtered (paddress (load_addr), gdb_stdout);
if (section_is_overlay (section))
if (section
&& (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
printf_filtered (_("a thread-local variable at offset %s "
"in the thread-local storage for `%s'"),
paddr_nz (load_addr), section->objfile->name);
else
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
printf_filtered (_("static storage at address "));
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}
}
}
}