Skip to content

Commit

Permalink
2003-12-02 Roland McGrath <roland@redhat.com>
Browse files Browse the repository at this point in the history
	* 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.
  • Loading branch information
Roland McGrath committed Dec 18, 2003
1 parent 2d951ab commit d43147c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions nptl_db/db_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ DESC (_thread_db_pthread_dtvp,
#define DB_VARIABLE(name) DESC (_thread_db_##name, 0, name)
#define DB_ARRAY_VARIABLE(name) ARRAY_DESC (_thread_db_##name, 0, name)
#define DB_SYMBOL(name) /* Nothing. */
#define DB_FUNCTION(name) /* Nothing. */
#include "structs.def"
#undef DB_STRUCT
#undef DB_STRUCT_FIELD
#undef DB_SYMBOL
#undef DB_FUNCTION
#undef DB_VARIABLE
#undef DESC

Expand Down
4 changes: 2 additions & 2 deletions nptl_db/structs.def
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ DB_STRUCT_FIELD (td_eventbuf_t, eventdata)
DB_SYMBOL (stack_used)
DB_SYMBOL (__stack_user)
DB_SYMBOL (nptl_version)
DB_SYMBOL (__nptl_create_event)
DB_SYMBOL (__nptl_death_event)
DB_FUNCTION (__nptl_create_event)
DB_FUNCTION (__nptl_death_event)
DB_SYMBOL (__nptl_threads_events)
DB_VARIABLE (__nptl_nthreads)
DB_VARIABLE (__nptl_last_event)
Expand Down
23 changes: 22 additions & 1 deletion nptl_db/td_symbol_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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

Expand All @@ -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;
}
5 changes: 5 additions & 0 deletions nptl_db/thread_dbP.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ enum
# define DB_STRUCT(type) SYM_SIZEOF_##type,
# define DB_STRUCT_FIELD(type, field) SYM_##type##_FIELD_##field,
# define DB_SYMBOL(name) SYM_##name,
# define DB_FUNCTION(name) SYM_##name,
# define DB_VARIABLE(name) SYM_##name, SYM_DESC_##name,
# include "structs.def"
# undef DB_STRUCT
# undef DB_STRUCT_FIELD
# undef DB_SYMBOL
# undef DB_FUNCTION
# undef DB_VARIABLE

SYM_TH_UNIQUE_CONST_THREAD_AREA,
Expand Down Expand Up @@ -88,12 +90,15 @@ struct td_thragent
db_desc_t ta_field_##type##_##field;
# define DB_SYMBOL(name) \
psaddr_t ta_addr_##name;
# define DB_FUNCTION(name) \
psaddr_t ta_addr_##name;
# define DB_VARIABLE(name) \
psaddr_t ta_addr_##name; \
db_desc_t ta_var_##name;
# include "structs.def"
# undef DB_STRUCT
# undef DB_STRUCT_FIELD
# undef DB_FUNCTION
# undef DB_SYMBOL
# undef DB_VARIABLE

Expand Down

0 comments on commit d43147c

Please sign in to comment.