summaryrefslogtreecommitdiff
path: root/nptl_db
diff options
context:
space:
mode:
Diffstat (limited to 'nptl_db')
-rw-r--r--nptl_db/ChangeLog10
-rw-r--r--nptl_db/Makefile12
-rw-r--r--nptl_db/db-symbols.awk45
-rw-r--r--nptl_db/db-symbols.h56
-rw-r--r--nptl_db/td_symbol_list.c36
5 files changed, 127 insertions, 32 deletions
diff --git a/nptl_db/ChangeLog b/nptl_db/ChangeLog
index 5166d3df66..610ca9dbb6 100644
--- a/nptl_db/ChangeLog
+++ b/nptl_db/ChangeLog
@@ -1,3 +1,13 @@
+2009-02-27 Roland McGrath <roland@redhat.com>
+
+ * td_symbol_list.c (symbol_list_arr): Move initializer guts to ...
+ * db-symbols.h: ... here, new file.
+ * db-symbols.awk: New file.
+ * Makefile (distribute): Add them.
+ ($(objpfx)db-symbols.out): New target.
+ (tests): Depend on it.
+ ($(objpfx)db-symbols.v.i): New dependent rule.
+
2009-02-06 Ulrich Drepper <drepper@redhat.com>
* td_thr_get_info.c (td_thr_get_info): Initialize schedpolicy in
diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index 5c73ff28f2..af542dcac9 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2009 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -50,7 +50,8 @@ libthread_db-inhibit-o = $(filter-out .os,$(object-suffixes))
# The ps_* callback functions are not defined.
libthread_db.so-no-z-defs = yes
-distribute = thread_dbP.h shlib-versions proc_service.h db_info.c structs.def
+distribute = thread_dbP.h shlib-versions proc_service.h \
+ db_info.c structs.def db-symbols.h db-symbols.awk
include ../Rules
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
@@ -58,3 +59,10 @@ include ../Rules
# a statically-linked program that hasn't already loaded it.
$(objpfx)libthread_db.so: $(common-objpfx)libc.so \
$(common-objpfx)libc_nonshared.a
+
+tests: $(objpfx)db-symbols.out
+$(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \
+ $(common-objpfx)nptl/libpthread.so
+ readelf -W -s $(filter %.so,$^) | $(AWK) -f $< > $@
+
+$(objpfx)db-symbols.v.i: db-symbols.awk
diff --git a/nptl_db/db-symbols.awk b/nptl_db/db-symbols.awk
new file mode 100644
index 0000000000..33272138f7
--- /dev/null
+++ b/nptl_db/db-symbols.awk
@@ -0,0 +1,45 @@
+# This script processes the output of 'readelf -W -s' on the libpthread.so
+# we've just built. It checks for all the symbols used in td_symbol_list.
+
+BEGIN {
+%define DB_LOOKUP_NAME(idx, name) required[STRINGIFY (name)] = 1;
+%define DB_LOOKUP_NAME_TH_UNIQUE(idx, name) th_unique[STRINGIFY (name)] = 1;
+%include "db-symbols.h"
+
+ in_symtab = 0;
+}
+
+/Symbol table '.symtab'/ { in_symtab=1; next }
+NF == 0 { in_symtab=0; next }
+
+!in_symtab { next }
+
+NF >= 8 && $7 != "UND" { seen[$8] = 1 }
+
+END {
+ status = 0;
+
+ for (s in required) {
+ if (s in seen) print s, "ok";
+ else {
+ status = 1;
+ print s, "***MISSING***";
+ }
+ }
+
+ any = "";
+ for (s in th_unique) {
+ if (s in seen) {
+ any = s;
+ break;
+ }
+ }
+ if (any)
+ print "th_unique:", any;
+ else {
+ status = 1;
+ print "th_unique:", "***MISSING***";
+ }
+
+ exit(status);
+}
diff --git a/nptl_db/db-symbols.h b/nptl_db/db-symbols.h
new file mode 100644
index 0000000000..d6c35250b1
--- /dev/null
+++ b/nptl_db/db-symbols.h
@@ -0,0 +1,56 @@
+/* List of symbols in libpthread examined by libthread_db.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define DOT(x) .##x /* PPC64 requires . prefix on code symbols. */
+#else
+# define DOT(x) x /* No prefix. */
+#endif
+
+#define STRINGIFY(name) STRINGIFY_1(name)
+#define STRINGIFY_1(name) #name
+
+#define DB_STRUCT(type) \
+ DB_LOOKUP_NAME (SYM_SIZEOF_##type, _thread_db_sizeof_##type)
+#define DB_STRUCT_FIELD(type, field) \
+ DB_LOOKUP_NAME (SYM_##type##_FIELD_##field, _thread_db_##type##_##field)
+#define DB_SYMBOL(name) \
+ DB_LOOKUP_NAME (SYM_##name, name)
+#define DB_FUNCTION(name) \
+ DB_LOOKUP_NAME (SYM_##name, DOT (name))
+#define DB_VARIABLE(name) \
+ DB_LOOKUP_NAME (SYM_##name, name) \
+ DB_LOOKUP_NAME (SYM_DESC_##name, _thread_db_##name)
+
+# include "structs.def"
+
+# undef DB_STRUCT
+# undef DB_FUNCTION
+# undef DB_SYMBOL
+# undef DB_VARIABLE
+# undef DOT
+
+DB_LOOKUP_NAME_TH_UNIQUE (SYM_TH_UNIQUE_REGISTER64, _thread_db_register64)
+DB_LOOKUP_NAME_TH_UNIQUE (SYM_TH_UNIQUE_REGISTER32, _thread_db_register32)
+DB_LOOKUP_NAME_TH_UNIQUE (SYM_TH_UNIQUE_CONST_THREAD_AREA,
+ _thread_db_const_thread_area)
+DB_LOOKUP_NAME_TH_UNIQUE (SYM_TH_UNIQUE_REGISTER32_THREAD_AREA,
+ _thread_db_register32_thread_area)
+DB_LOOKUP_NAME_TH_UNIQUE (SYM_TH_UNIQUE_REGISTER64_THREAD_AREA,
+ _thread_db_register64_thread_area)
diff --git a/nptl_db/td_symbol_list.c b/nptl_db/td_symbol_list.c
index 5d6c94e5b7..79498404cb 100644
--- a/nptl_db/td_symbol_list.c
+++ b/nptl_db/td_symbol_list.c
@@ -1,5 +1,5 @@
/* Return list of symbols the library can request.
- Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2001,2002,2003,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -22,37 +22,13 @@
#include <gnu/lib-names.h>
#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) \
- [SYM_SIZEOF_##type] = "_thread_db_sizeof_" #type,
-# define DB_STRUCT_FIELD(type, field) \
- [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
-
- [SYM_TH_UNIQUE_CONST_THREAD_AREA] = "_thread_db_const_thread_area",
- [SYM_TH_UNIQUE_REGISTER64] = "_thread_db_register64",
- [SYM_TH_UNIQUE_REGISTER32] = "_thread_db_register32",
- [SYM_TH_UNIQUE_REGISTER32_THREAD_AREA] = "_thread_db_register32_thread_area",
- [SYM_TH_UNIQUE_REGISTER64_THREAD_AREA] = "_thread_db_register64_thread_area",
+# define DB_LOOKUP_NAME(idx, name) [idx] = #name,
+# define DB_LOOKUP_NAME_TH_UNIQUE(idx, name) [idx] = #name,
+# include "db-symbols.h"
+# undef DB_LOOKUP_NAME
+# undef DB_LOOKUP_NAME_TH_UNIQUE
[SYM_NUM_MESSAGES] = NULL
};