From 59f80f10887fdfa0299b22f33b11efa4ec069fee Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sun, 31 Dec 2006 20:20:13 +0000 Subject: [PATCH] * configure.ac: Add tests for TD_VERSION and TD_NOTLS. * linux-thread-db.c (thread_db_err_str): Recognize TD_NOTALLOC, TD_VERSION, and TD_NOTLS. * configure, config.in: Regenerated. --- gdb/ChangeLog | 7 +++ gdb/config.in | 6 ++ gdb/configure | 134 ++++++++++++++++++++++++++++++++++++++++-- gdb/configure.ac | 29 ++++++++- gdb/linux-thread-db.c | 12 ++++ 5 files changed, 182 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 675206d6a85..c24ebc65cb5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2006-12-31 Daniel Jacobowitz + + * configure.ac: Add tests for TD_VERSION and TD_NOTLS. + * linux-thread-db.c (thread_db_err_str): Recognize TD_NOTALLOC, + TD_VERSION, and TD_NOTLS. + * configure, config.in: Regenerated. + 2006-12-31 Joel Brobecker * i386-tdep.c (i386_analyze_stack_align): Add handling of two diff --git a/gdb/config.in b/gdb/config.in index a73bf257048..52176b97025 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -548,6 +548,12 @@ /* Define if has the TD_NOTALLOC error code. */ #undef THREAD_DB_HAS_TD_NOTALLOC +/* Define if has the TD_NOTLS error code. */ +#undef THREAD_DB_HAS_TD_NOTLS + +/* Define if has the TD_VERSION error code. */ +#undef THREAD_DB_HAS_TD_VERSION + /* Define to 1 if the regex included in libiberty should be used. */ #undef USE_INCLUDED_REGEX diff --git a/gdb/configure b/gdb/configure index 0d331c33a33..c2199f9d51c 100755 --- a/gdb/configure +++ b/gdb/configure @@ -20855,6 +20855,116 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $gdb_cv_thread_db_h_has_td_notalloc" >&5 echo "${ECHO_T}$gdb_cv_thread_db_h_has_td_notalloc" >&6 + echo "$as_me:$LINENO: checking whether has TD_VERSION" >&5 +echo $ECHO_N "checking whether has TD_VERSION... $ECHO_C" >&6 +if test "${gdb_cv_thread_db_h_has_td_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +int i = TD_VERSION; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gdb_cv_thread_db_h_has_td_version=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gdb_cv_thread_db_h_has_td_version=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $gdb_cv_thread_db_h_has_td_version" >&5 +echo "${ECHO_T}$gdb_cv_thread_db_h_has_td_version" >&6 + echo "$as_me:$LINENO: checking whether has TD_NOTLS" >&5 +echo $ECHO_N "checking whether has TD_NOTLS... $ECHO_C" >&6 +if test "${gdb_cv_thread_db_h_has_td_notls+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +int i = TD_NOTLS; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gdb_cv_thread_db_h_has_td_notls=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gdb_cv_thread_db_h_has_td_notls=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $gdb_cv_thread_db_h_has_td_notls" >&5 +echo "${ECHO_T}$gdb_cv_thread_db_h_has_td_notls" >&6 fi if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then @@ -20862,6 +20972,20 @@ cat >>confdefs.h <<\_ACEOF #define THREAD_DB_HAS_TD_NOTALLOC 1 _ACEOF +fi +if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then + +cat >>confdefs.h <<\_ACEOF +#define THREAD_DB_HAS_TD_VERSION 1 +_ACEOF + +fi +if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then + +cat >>confdefs.h <<\_ACEOF +#define THREAD_DB_HAS_TD_NOTLS 1 +_ACEOF + fi if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then @@ -22341,7 +22465,7 @@ ac_x_header_dirs=' /usr/openwin/share/include' if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. + # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22349,7 +22473,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -22376,7 +22500,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Xlib.h"; then + if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi @@ -22397,11 +22521,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include int main () { -XrmInitialize () +XtMalloc (0) ; return 0; } diff --git a/gdb/configure.ac b/gdb/configure.ac index 4deb4f5b43c..0f6a1c91b5f 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1024,7 +1024,8 @@ if test ${build} = ${host} -a ${host} = ${target} ; then AC_SUBST(CONFIG_LDFLAGS) fi -dnl See if we have a thread_db header file that has TD_NOTALLOC. +dnl See if we have a thread_db header file that has TD_NOTALLOC and +dnl other error codes. if test "x$ac_cv_header_thread_db_h" = "xyes"; then AC_CACHE_CHECK([whether has TD_NOTALLOC], gdb_cv_thread_db_h_has_td_notalloc, @@ -1035,11 +1036,37 @@ if test "x$ac_cv_header_thread_db_h" = "xyes"; then gdb_cv_thread_db_h_has_td_notalloc=no ) ) + AC_CACHE_CHECK([whether has TD_VERSION], + gdb_cv_thread_db_h_has_td_version, + AC_TRY_COMPILE( + [#include ], + [int i = TD_VERSION;], + gdb_cv_thread_db_h_has_td_version=yes, + gdb_cv_thread_db_h_has_td_version=no + ) + ) + AC_CACHE_CHECK([whether has TD_NOTLS], + gdb_cv_thread_db_h_has_td_notls, + AC_TRY_COMPILE( + [#include ], + [int i = TD_NOTLS;], + gdb_cv_thread_db_h_has_td_notls=yes, + gdb_cv_thread_db_h_has_td_notls=no + ) + ) fi if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1, [Define if has the TD_NOTALLOC error code.]) fi +if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then + AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1, + [Define if has the TD_VERSION error code.]) +fi +if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then + AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1, + [Define if has the TD_NOTLS error code.]) +fi dnl See if we have a sys/syscall header file that has __NR_tkill. if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index fe75a8331f7..4b0aef7951f 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -209,6 +209,18 @@ thread_db_err_str (td_err_e err) return "only part of register set was written/read"; case TD_NOXREGS: return "X register set not available for this thread"; +#ifdef THREAD_DB_HAS_TD_NOTALLOC + case TD_NOTALLOC: + return "thread has not yet allocated TLS for given module"; +#endif +#ifdef THREAD_DB_HAS_TD_VERSION + case TD_VERSION: + return "versions of libpthread and libthread_db do not match"; +#endif +#ifdef THREAD_DB_HAS_TD_NOTLS + case TD_NOTLS: + return "there is no TLS segment in the given module"; +#endif default: snprintf (buf, sizeof (buf), "unknown thread_db error '%d'", err); return buf; -- 2.30.2