summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeimin Pan <weimin.pan@oracle.com>2017-11-02 18:38:36 -0600
committerSimon Marchi <simon.marchi@polymtl.ca>2018-03-23 22:57:46 -0400
commitbce02d8884d6baa72c537d0d7c59f924cb290799 (patch)
tree81c208f2daa6d456ba31a63a938101db5313a578
parent9a96cf38344355c529bfb47251a01ad679d75459 (diff)
downloadbinutils-gdb-bce02d8884d6baa72c537d0d7c59f924cb290799.tar.gz
aarch64: Make "info address" resolve TLS variables
TLS variables can't be resolved on aarch64-linux-gnu Running the test case with upstream gdb shows two failures: (1) Receiving different error messages when printing TLS variable before program runs - because the ARM compiler does not emit dwarf attribute DW_AT_location for TLS, the result is expected and the baseline may need to be changed for aarch64. (2) Using "info address" command on C++ static TLS object resulted in "symbol unresolved" error - below is a snippet from the test case: class K { public: static __thread int another_thread_local; }; __thread int K::another_thread_local; (gdb) info address K::another_thread_local Symbol "K::another_thread_local" is unresolved. This patch contains fix for (2). Function info_address_command() handles the "info address" command and calls lookup_minimal_symbol_and_objfile() to find sym's symbol entry in mininal symbol table if SYMBOL_COMPUTED_OPS (sym) is false. Problem is that function lookup_minimal_symbol_and_objfile() only looked up an objfile's minsym ordinary hash table, not its demangled hash table, which was the reason why the C++ name was not found. The fix is to call lookup_minimal_symbol(), which already looks up entries in both minsym's hash tables, to find names when traversing the object file list in lookup_minimal_symbol_and_objfile(). Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/minsyms.c17
-rw-r--r--gdb/minsyms.h2
3 files changed, 10 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b543904db2b..c1945cb5e27 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-01 Weimin Pan <weimin.pan@oracle.com>
+
+ * minsyms.c (lookup_minimal_symbol_and_objfile): Use
+ lookup_minimal_symbol() to find symbol entry.
+ * minsyms.h (lookup_minimal_symbol_and_objfile): Update comment.
+
2018-03-23 Keith Seitz <keiths@redhat.com>
PR c++/22968
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index a55c0718fcb..72969b77787 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1009,23 +1009,12 @@ lookup_minimal_symbol_and_objfile (const char *name)
{
struct bound_minimal_symbol result;
struct objfile *objfile;
- unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
ALL_OBJFILES (objfile)
{
- struct minimal_symbol *msym;
-
- for (msym = objfile->per_bfd->msymbol_hash[hash];
- msym != NULL;
- msym = msym->hash_next)
- {
- if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0)
- {
- result.minsym = msym;
- result.objfile = objfile;
- return result;
- }
- }
+ result = lookup_minimal_symbol (name, NULL, objfile);
+ if (result.minsym != NULL)
+ return result;
}
memset (&result, 0, sizeof (result));
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index 78b32e8d1c4..11a202025d3 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -203,7 +203,7 @@ struct bound_minimal_symbol lookup_minimal_symbol (const char *,
struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *);
/* Find the minimal symbol named NAME, and return both the minsym
- struct and its objfile. This only checks the linkage name. */
+ struct and its objfile. */
struct bound_minimal_symbol lookup_minimal_symbol_and_objfile (const char *);