aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog22
-rw-r--r--gdb/config.in5
-rwxr-xr-xgdb/configure167
-rw-r--r--gdb/configure.in17
-rw-r--r--gdb/findvar.c6
-rw-r--r--gdb/gdb_thread_db.h3
-rw-r--r--gdb/target.c1
-rw-r--r--gdb/target.h16
-rw-r--r--gdb/thread-db.c100
9 files changed, 264 insertions, 73 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 317f049..360ee52 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+2002-11-11 Elena Zannoni <ezannoni@redhat.com>
+
+ * findvar.c (read_var_value): Reenable TLS code.
+
+2002-11-11 Elena Zannoni <ezannoni@redhat.com>
+ Jim Blandy <jimb@redhat.com>
+
+ * gdb_thread_db.h (enum): Add TD_NOTALLOC.
+ * target.c (update_current_target): Add
+ to_get_thread_local_address.
+ * target.h (to_get_thread_local_address): Export.
+ (target_get_thread_local_address): Define.
+ (target_get_thread_local_address_p): Define.
+ * thread-db.c: Include solib-svr4.h.
+ (td_thr_tls_get_addr_p): Define.
+ (thread_db_load): Get a pointer to td_thr_tls_get_addr.
+ (thread_db_get_thread_local_address): New function.
+ (init_thread_db_ops): Initialize to_get_thread_local_address.
+ * configure.in: Add test for TD_NOTALLOC in thread_db.h.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2002-11-11 David Carlton <carlton@math.stanford.edu>
* linespec.c (set_flags): New function.
diff --git a/gdb/config.in b/gdb/config.in
index 8c1c7bf..fa1ab9a 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -1,4 +1,4 @@
-/* config.in. Generated automatically from configure.in by autoheader 2.13. */
+/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if on AIX 3.
System headers sometimes define this.
@@ -514,3 +514,6 @@
/* Define if <sys/procfs.h> has pr_siginfo64_t. */
#undef HAVE_PR_SIGINFO64_T
+/* Define if <thread_db.h> has the TD_NOTALLOC error code. */
+#undef THREAD_DB_HAS_TD_NOTALLOC
+
diff --git a/gdb/configure b/gdb/configure
index 64370a8..f96b8f9 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -6546,6 +6546,43 @@ EOF
fi
+if test "x$ac_cv_header_thread_db_h" = "xyes"; then
+ echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6
+echo "configure:6552: checking whether <thread_db.h> has TD_NOTALLOC" >&5
+if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 6557 "configure"
+#include "confdefs.h"
+#include <thread_db.h>
+int main() {
+int i = TD_NOTALLOC;
+; return 0; }
+EOF
+if { (eval echo configure:6564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ gdb_cv_thread_db_h_has_td_notalloc=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gdb_cv_thread_db_h_has_td_notalloc=no
+
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$gdb_cv_thread_db_h_has_td_notalloc" 1>&6
+fi
+if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
+ cat >> confdefs.h <<\EOF
+#define THREAD_DB_HAS_TD_NOTALLOC 1
+EOF
+
+fi
+
# Check whether --enable-gdbcli or --disable-gdbcli was given.
if test "${enable_gdbcli+set}" = set; then
@@ -6737,7 +6774,7 @@ WERROR_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
then
echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6
-echo "configure:6741: checking compiler warning flags" >&5
+echo "configure:6778: checking compiler warning flags" >&5
# Separate out the -Werror flag as some files just cannot be
# compiled with it enabled.
for w in ${build_warnings}; do
@@ -6747,14 +6784,14 @@ echo "configure:6741: checking compiler warning flags" >&5
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $w"
cat > conftest.$ac_ext <<EOF
-#line 6751 "configure"
+#line 6788 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:6758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
WARN_CFLAGS="${WARN_CFLAGS} $w"
else
@@ -6814,12 +6851,12 @@ fi
if test $want_included_regex = false; then
echo $ac_n "checking for GNU regex""... $ac_c" 1>&6
-echo "configure:6818: checking for GNU regex" >&5
+echo "configure:6855: checking for GNU regex" >&5
if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6823 "configure"
+#line 6860 "configure"
#include "confdefs.h"
#include <gnu-versions.h>
#include <sys/types.h>
@@ -6831,7 +6868,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:6835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdb_cv_have_gnu_regex=yes
else
@@ -6860,12 +6897,12 @@ fi
# In the Cygwin environment, we need some additional flags.
echo $ac_n "checking for cygwin""... $ac_c" 1>&6
-echo "configure:6864: checking for cygwin" >&5
+echo "configure:6901: checking for cygwin" >&5
if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6869 "configure"
+#line 6906 "configure"
#include "confdefs.h"
#if defined (__CYGWIN__) || defined (__CYGWIN32__)
@@ -6903,7 +6940,7 @@ if test x$gdb_cv_os_cygwin = xyes; then
else
TERM_LIB=
echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:6907: checking for tgetent in -lncurses" >&5
+echo "configure:6944: checking for tgetent in -lncurses" >&5
ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6911,7 +6948,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6915 "configure"
+#line 6952 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6922,7 +6959,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:6926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6941,7 +6978,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6
-echo "configure:6945: checking for tgetent in -lHcurses" >&5
+echo "configure:6982: checking for tgetent in -lHcurses" >&5
ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6949,7 +6986,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lHcurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6953 "configure"
+#line 6990 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6960,7 +6997,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:6964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6979,7 +7016,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6
-echo "configure:6983: checking for tgetent in -ltermlib" >&5
+echo "configure:7020: checking for tgetent in -ltermlib" >&5
ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6987,7 +7024,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ltermlib $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6991 "configure"
+#line 7028 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6998,7 +7035,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:7002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7017,7 +7054,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:7021: checking for tgetent in -ltermcap" >&5
+echo "configure:7058: checking for tgetent in -ltermcap" >&5
ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7025,7 +7062,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7029 "configure"
+#line 7066 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7036,7 +7073,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:7040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7055,7 +7092,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:7059: checking for tgetent in -lcurses" >&5
+echo "configure:7096: checking for tgetent in -lcurses" >&5
ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7063,7 +7100,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7067 "configure"
+#line 7104 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7074,7 +7111,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:7078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7093,7 +7130,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6
-echo "configure:7097: checking for tgetent in -lterminfo" >&5
+echo "configure:7134: checking for tgetent in -lterminfo" >&5
ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7101,7 +7138,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lterminfo $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7105 "configure"
+#line 7142 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -7112,7 +7149,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:7116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7277,7 +7314,7 @@ if test "${with_tclconfig+set}" = set; then
fi
echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:7281: checking for Tcl configuration" >&5
+echo "configure:7318: checking for Tcl configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7385,7 +7422,7 @@ if test "${with_tkconfig+set}" = set; then
fi
echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6
-echo "configure:7389: checking for Tk configuration" >&5
+echo "configure:7426: checking for Tk configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7494,7 +7531,7 @@ fi
no_tcl=true
echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6
-echo "configure:7498: checking for Tcl private headers. dir=${configdir}" >&5
+echo "configure:7535: checking for Tcl private headers. dir=${configdir}" >&5
# Check whether --with-tclinclude or --without-tclinclude was given.
if test "${with_tclinclude+set}" = set; then
withval="$with_tclinclude"
@@ -7560,17 +7597,17 @@ fi
if test x"${ac_cv_c_tclh}" = x ; then
ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6
-echo "configure:7564: checking for tclInt.h" >&5
+echo "configure:7601: checking for tclInt.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7569 "configure"
+#line 7606 "configure"
#include "confdefs.h"
#include <tclInt.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -7630,7 +7667,7 @@ fi
#
no_tk=true
echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6
-echo "configure:7634: checking for Tk private headers" >&5
+echo "configure:7671: checking for Tk private headers" >&5
# Check whether --with-tkinclude or --without-tkinclude was given.
if test "${with_tkinclude+set}" = set; then
withval="$with_tkinclude"
@@ -7696,17 +7733,17 @@ fi
if test x"${ac_cv_c_tkh}" = x ; then
ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for tk.h""... $ac_c" 1>&6
-echo "configure:7700: checking for tk.h" >&5
+echo "configure:7737: checking for tk.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7705 "configure"
+#line 7742 "configure"
#include "confdefs.h"
#include <tk.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -7752,7 +7789,7 @@ fi
echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:7756: checking for Itcl private headers. srcdir=${srcdir}" >&5
+echo "configure:7793: checking for Itcl private headers. srcdir=${srcdir}" >&5
if test x"${ac_cv_c_itclh}" = x ; then
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
if test -f $i/generic/itcl.h ; then
@@ -7775,7 +7812,7 @@ fi
echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:7779: checking for Itk private headers. srcdir=${srcdir}" >&5
+echo "configure:7816: checking for Itk private headers. srcdir=${srcdir}" >&5
if test x"${ac_cv_c_itkh}" = x ; then
for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
if test -f $i/generic/itk.h ; then
@@ -7798,7 +7835,7 @@ fi
echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:7802: checking for Tix private headers. srcdir=${srcdir}" >&5
+echo "configure:7839: checking for Tix private headers. srcdir=${srcdir}" >&5
if test x"${ac_cv_c_tixh}" = x ; then
for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do
if test -f $i/generic/tix.h ; then
@@ -7850,7 +7887,7 @@ if test "${with_itclconfig+set}" = set; then
fi
echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6
-echo "configure:7854: checking for Itcl configuration" >&5
+echo "configure:7891: checking for Itcl configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7953,7 +7990,7 @@ if test "${with_itkconfig+set}" = set; then
fi
echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6
-echo "configure:7957: checking for Itk configuration" >&5
+echo "configure:7994: checking for Itk configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8056,7 +8093,7 @@ if test "${with_tixconfig+set}" = set; then
fi
echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6
-echo "configure:8060: checking for Tix configuration" >&5
+echo "configure:8097: checking for Tix configuration" >&5
if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8202,7 +8239,7 @@ fi
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:8206: checking for X" >&5
+echo "configure:8243: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -8264,12 +8301,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 8268 "configure"
+#line 8305 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -8338,14 +8375,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8342 "configure"
+#line 8379 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:8349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -8637,7 +8674,7 @@ fi
# ``gdbserver'' can only be built in a native configuration.
if test x"${target}" = x"${host}"; then
echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6
-echo "configure:8641: checking whether gdbserver is supported on this host" >&5
+echo "configure:8678: checking whether gdbserver is supported on this host" >&5
if test x"${build_gdbserver}" = xyes ; then
configdirs="${configdirs} gdbserver"
SUBDIRS="${SUBDIRS} gdbserver"
@@ -8699,7 +8736,7 @@ fi
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:8703: checking whether ln -s works" >&5
+echo "configure:8740: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8723,12 +8760,12 @@ fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:8727: checking for Cygwin environment" >&5
+echo "configure:8764: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8732 "configure"
+#line 8769 "configure"
#include "confdefs.h"
int main() {
@@ -8739,7 +8776,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:8743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8780: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -8756,19 +8793,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:8760: checking for mingw32 environment" >&5
+echo "configure:8797: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8765 "configure"
+#line 8802 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:8772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -8787,7 +8824,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:8791: checking for executable suffix" >&5
+echo "configure:8828: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8797,7 +8834,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:8801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:8838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -8839,7 +8876,7 @@ fi
echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:8843: checking for iconv" >&5
+echo "configure:8880: checking for iconv" >&5
if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8847,7 +8884,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
cat > conftest.$ac_ext <<EOF
-#line 8851 "configure"
+#line 8888 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -8857,7 +8894,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:8861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_func_iconv=yes
else
@@ -8869,7 +8906,7 @@ rm -f conftest*
am_save_LIBS="$LIBS"
LIBS="$LIBS -liconv"
cat > conftest.$ac_ext <<EOF
-#line 8873 "configure"
+#line 8910 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -8879,7 +8916,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:8883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_lib_iconv=yes
am_cv_func_iconv=yes
@@ -8900,13 +8937,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
EOF
echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:8904: checking for iconv declaration" >&5
+echo "configure:8941: checking for iconv declaration" >&5
if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8910 "configure"
+#line 8947 "configure"
#include "confdefs.h"
#include <stdlib.h>
@@ -8925,7 +8962,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:8929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_proto_iconv_arg1=""
else
diff --git a/gdb/configure.in b/gdb/configure.in
index 8628e80..4c2e063 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -600,6 +600,23 @@ 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.
+if test "x$ac_cv_header_thread_db_h" = "xyes"; then
+ AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
+ gdb_cv_thread_db_h_has_td_notalloc,
+ AC_TRY_COMPILE(
+ [#include <thread_db.h>],
+ [int i = TD_NOTALLOC;],
+ gdb_cv_thread_db_h_has_td_notalloc=yes,
+ gdb_cv_thread_db_h_has_td_notalloc=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 <thread_db.h> has the TD_NOTALLOC error code.])
+fi
+
dnl The CLI cannot be disabled yet, but may be in the future
dnl Handle CLI sub-directory configury.
diff --git a/gdb/findvar.c b/gdb/findvar.c
index dd3061b..9eff168 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -544,11 +544,6 @@ addresses have not been bound by the dynamic loader. Try again when executable i
case LOC_THREAD_LOCAL_STATIC:
{
-#if 0
- /* FIXME: ezannoni 2002-10-21: Temporarly disable the code
- below, until the rest of the TLS support code is checked
- in. */
-
/* We want to let the target / ABI-specific code construct
this value for us, so we need to dispose of the value
allocated for us above. */
@@ -560,7 +555,6 @@ addresses have not been bound by the dynamic loader. Try again when executable i
finding TLS is an ABI-specific thing. But we don't do that
yet. */
else
-#endif
error ("Cannot find thread-local variables on this target");
break;
}
diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h
index 8088da0..c47c424 100644
--- a/gdb/gdb_thread_db.h
+++ b/gdb/gdb_thread_db.h
@@ -63,7 +63,8 @@ typedef enum
TD_NOTSD, /* No thread-specific data available. */
TD_MALLOC, /* Out of memory. */
TD_PARTIALREG, /* Not entire register set was read or written. */
- TD_NOXREGS /* X register set not available for given thread. */
+ TD_NOXREGS, /* X register set not available for given thread. */
+ TD_NOTALLOC /* TLS memory not yet allocated. */
} td_err_e;
diff --git a/gdb/target.c b/gdb/target.c
index c7a2acf..51ace74 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -666,6 +666,7 @@ update_current_target (void)
INHERIT (to_async_mask_value, t);
INHERIT (to_find_memory_regions, t);
INHERIT (to_make_corefile_notes, t);
+ INHERIT (to_get_thread_local_address, t);
INHERIT (to_magic, t);
#undef INHERIT
diff --git a/gdb/target.h b/gdb/target.h
index 18b95b0..5cdb76f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -328,6 +328,16 @@ struct target_ops
void *),
void *);
char * (*to_make_corefile_notes) (bfd *, int *);
+
+ /* Return the thread-local address at OFFSET in the
+ thread-local storage for the thread PTID and the shared library
+ or executable file given by OBJFILE. If that block of
+ thread-local storage hasn't been allocated yet, this function
+ may return an error. */
+ CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid,
+ struct objfile *objfile,
+ CORE_ADDR offset);
+
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
@@ -1039,6 +1049,12 @@ extern void (*target_new_objfile_hook) (struct objfile *);
#define target_make_corefile_notes(BFD, SIZE_P) \
(current_target.to_make_corefile_notes) (BFD, SIZE_P)
+/* Thread-local values. */
+#define target_get_thread_local_address \
+ (current_target.to_get_thread_local_address)
+#define target_get_thread_local_address_p() \
+ (target_get_thread_local_address != NULL)
+
/* Hook to call target-dependent code after reading in a new symbol table. */
#ifndef TARGET_SYMFILE_POSTREAD
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
index 34b5c55..9338c57 100644
--- a/gdb/thread-db.c
+++ b/gdb/thread-db.c
@@ -32,6 +32,7 @@
#include "objfiles.h"
#include "target.h"
#include "regcache.h"
+#include "solib-svr4.h"
#ifndef LIBTHREAD_DB_SO
#define LIBTHREAD_DB_SO "libthread_db.so.1"
@@ -108,6 +109,11 @@ static td_err_e (*td_thr_setgregs_p) (const td_thrhandle_t *th,
prgregset_t gregs);
static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, int event);
+static td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th,
+ void *map_address,
+ size_t offset,
+ void **address);
+
/* Location of the thread creation event breakpoint. The code at this
location in the child process will be called by the pthread library
whenever a new thread is created. By setting a special breakpoint
@@ -348,6 +354,7 @@ thread_db_load (void)
td_ta_set_event_p = dlsym (handle, "td_ta_set_event");
td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg");
td_thr_event_enable_p = dlsym (handle, "td_thr_event_enable");
+ td_thr_tls_get_addr_p = dlsym (handle, "td_thr_tls_get_addr");
return 1;
}
@@ -1003,6 +1010,97 @@ thread_db_pid_to_str (ptid_t ptid)
return normal_pid_to_str (ptid);
}
+/* Get the address of the thread local variable in OBJFILE which is
+ stored at OFFSET within the thread local storage for thread PTID. */
+
+static CORE_ADDR
+thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile,
+ CORE_ADDR offset)
+{
+ if (is_thread (ptid))
+ {
+ int objfile_is_library = (objfile->flags & OBJF_SHARED);
+ td_err_e err;
+ td_thrhandle_t th;
+ void *address;
+ CORE_ADDR lm;
+
+ /* glibc doesn't provide the needed interface. */
+ if (! td_thr_tls_get_addr_p)
+ error ("Cannot find thread-local variables in this thread library.");
+
+ /* Get the address of the link map for this objfile. */
+ lm = svr4_fetch_objfile_link_map (objfile);
+
+ /* Whoops, we couldn't find one. Bail out. */
+ if (!lm)
+ {
+ if (objfile_is_library)
+ error ("Cannot find shared library `%s' link_map in dynamic"
+ " linker's module list", objfile->name);
+ else
+ error ("Cannot find executable file `%s' link_map in dynamic"
+ " linker's module list", objfile->name);
+ }
+
+ /* Get info about the thread. */
+ err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th);
+ if (err != TD_OK)
+ error ("Cannot find thread %ld: %s",
+ (long) GET_THREAD (ptid), thread_db_err_str (err));
+
+ /* Finally, get the address of the variable. */
+ err = td_thr_tls_get_addr_p (&th, (void *) lm, offset, &address);
+
+#ifdef THREAD_DB_HAS_TD_NOTALLOC
+ /* The memory hasn't been allocated, yet. */
+ if (err == TD_NOTALLOC)
+ {
+ /* Now, if libthread_db provided the initialization image's
+ address, we *could* try to build a non-lvalue value from
+ the initialization image. */
+ if (objfile_is_library)
+ error ("The inferior has not yet allocated storage for"
+ " thread-local variables in\n"
+ "the shared library `%s'\n"
+ "for the thread %ld",
+ objfile->name, (long) GET_THREAD (ptid));
+ else
+ error ("The inferior has not yet allocated storage for"
+ " thread-local variables in\n"
+ "the executable `%s'\n"
+ "for the thread %ld",
+ objfile->name, (long) GET_THREAD (ptid));
+ }
+#endif
+
+ /* Something else went wrong. */
+ if (err != TD_OK)
+ {
+ if (objfile_is_library)
+ error ("Cannot find thread-local storage for thread %ld, "
+ "shared library %s:\n%s",
+ (long) GET_THREAD (ptid),
+ objfile->name,
+ thread_db_err_str (err));
+ else
+ error ("Cannot find thread-local storage for thread %ld, "
+ "executable file %s:\n%s",
+ (long) GET_THREAD (ptid),
+ objfile->name,
+ thread_db_err_str (err));
+ }
+
+ /* Cast assuming host == target. Joy. */
+ return (CORE_ADDR) address;
+ }
+
+ if (target_beneath->to_get_thread_local_address)
+ return target_beneath->to_get_thread_local_address (ptid, objfile, offset);
+
+ error ("Cannot find thread-local values on this target.");
+}
+
static void
init_thread_db_ops (void)
{
@@ -1025,6 +1123,8 @@ init_thread_db_ops (void)
thread_db_ops.to_pid_to_str = thread_db_pid_to_str;
thread_db_ops.to_stratum = thread_stratum;
thread_db_ops.to_has_thread_control = tc_schedlock;
+ thread_db_ops.to_get_thread_local_address
+ = thread_db_get_thread_local_address;
thread_db_ops.to_magic = OPS_MAGIC;
}