about summary refs log tree commit diff
path: root/nptl_db/td_symbol_list.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-12-18 02:51:04 +0000
committerRoland McGrath <roland@gnu.org>2003-12-18 02:51:04 +0000
commitd43147cd8983e002455633651de6d89fdf21de36 (patch)
tree01b715bd6c54a5912a6f838da9c7ba070dd2e362 /nptl_db/td_symbol_list.c
parent2d951ab68550e19f9fd1e63a645a826c2b6f6b8f (diff)
downloadglibc-d43147cd8983e002455633651de6d89fdf21de36.tar.gz
glibc-d43147cd8983e002455633651de6d89fdf21de36.tar.xz
glibc-d43147cd8983e002455633651de6d89fdf21de36.zip
2003-12-02 Roland McGrath <roland@redhat.com>
	* thread_dbP.h (DB_FUNCTION): New macro.
	* structs.def: Use it for __nptl_create_event and __nptl_death_event.
	* db_info.c (DB_FUNCTION): New macro.
	* td_symbol_list.c (DB_FUNCTION): New macro, prepend "." to symbol
	name under [HAVE_ASM_GLOBAL_DOT_NAME].
	(td_lookup) [HAVE_ASM_GLOBAL_DOT_NAME]: If lookup fails with PS_NOSYM
	and name starts with a dot, try it without the dot.
Diffstat (limited to 'nptl_db/td_symbol_list.c')
-rw-r--r--nptl_db/td_symbol_list.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/nptl_db/td_symbol_list.c b/nptl_db/td_symbol_list.c
index 061767eb74..5d6c94e5b7 100644
--- a/nptl_db/td_symbol_list.c
+++ b/nptl_db/td_symbol_list.c
@@ -23,6 +23,12 @@
 #include "thread_dbP.h"
 
 
+#ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define DOT "."		/* PPC64 requires . prefix on code symbols.  */
+#else
+# define DOT			/* No prefix.  */
+#endif
+
 static const char *symbol_list_arr[] =
 {
 # define DB_STRUCT(type) \
@@ -31,11 +37,14 @@ static const char *symbol_list_arr[] =
   [SYM_##type##_FIELD_##field] = "_thread_db_" #type "_" #field,
 # define DB_SYMBOL(name) \
   [SYM_##name] = #name,
+# define DB_FUNCTION(name) \
+  [SYM_##name] = DOT #name,
 # define DB_VARIABLE(name) \
   [SYM_##name] = #name, \
   [SYM_DESC_##name] = "_thread_db_" #name,
 # include "structs.def"
 # undef DB_STRUCT
+# undef DB_FUNCTION
 # undef DB_SYMBOL
 # undef DB_VARIABLE
 
@@ -59,6 +68,18 @@ td_symbol_list (void)
 ps_err_e
 td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr)
 {
+  ps_err_e result;
   assert (idx >= 0 && idx < SYM_NUM_MESSAGES);
-  return ps_pglobal_lookup (ps, LIBPTHREAD_SO, symbol_list_arr[idx], sym_addr);
+  result = ps_pglobal_lookup (ps, LIBPTHREAD_SO, symbol_list_arr[idx],
+			      sym_addr);
+
+#ifdef HAVE_ASM_GLOBAL_DOT_NAME
+  /* For PowerPC, 64-bit uses dot symbols but 32-bit does not.
+     We could be a 64-bit libthread_db debugging a 32-bit libpthread.  */
+  if (result == PS_NOSYM && symbol_list_arr[idx][0] == '.')
+    result = ps_pglobal_lookup (ps, LIBPTHREAD_SO, &symbol_list_arr[idx][1],
+				sym_addr);
+#endif
+
+  return result;
 }