|
|
7a6771 |
If you provided some relative path to the shared library, such as with
|
|
|
7a6771 |
export LD_LIBRARY_PATH=.
|
|
|
7a6771 |
then gdb would fail to match the shared library name during the TLS lookup.
|
|
|
7a6771 |
|
|
|
7a6771 |
|
|
|
7a6771 |
Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed?
|
|
|
7a6771 |
|
|
|
7a6771 |
|
|
|
7a6771 |
The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'.
|
|
|
7a6771 |
The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
|
|
7a6771 |
|
|
|
7a6771 |
|
|
|
7a6771 |
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
7a6771 |
|
|
|
7a6771 |
* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
|
|
|
7a6771 |
requested pathnames to the internal loaded relative pathnames.
|
|
|
7a6771 |
|
|
|
7a6771 |
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
7a6771 |
|
|
|
7a6771 |
Port to GDB-6.7.
|
|
|
7a6771 |
|
|
|
7a6771 |
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
7a6771 |
|
|
|
7a6771 |
Port to gdb-6.7.50.20080227.
|
|
|
7a6771 |
|
|
|
7a6771 |
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
|
|
|
7a6771 |
===================================================================
|
|
|
7a6771 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
7a6771 |
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-sepdebug-main.c 2016-02-16 10:16:12.629875073 +0100
|
|
|
7a6771 |
@@ -0,0 +1,25 @@
|
|
|
7a6771 |
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ Copyright 2006 Free Software Foundation, Inc.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
7a6771 |
+ it under the terms of the GNU General Public License as published by
|
|
|
7a6771 |
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
7a6771 |
+ (at your option) any later version.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ This program is distributed in the hope that it will be useful,
|
|
|
7a6771 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7a6771 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
7a6771 |
+ GNU General Public License for more details.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ You should have received a copy of the GNU General Public License
|
|
|
7a6771 |
+ along with this program; if not, write to the Free Software
|
|
|
7a6771 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ Please email any bugs, comments, and/or additions to this file to:
|
|
|
7a6771 |
+ bug-gdb@prep.ai.mit.edu */
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+int main()
|
|
|
7a6771 |
+{
|
|
|
7a6771 |
+ return 0;
|
|
|
7a6771 |
+}
|
|
|
7a6771 |
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
|
|
|
7a6771 |
===================================================================
|
|
|
7a6771 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
7a6771 |
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c 2016-02-16 10:16:12.630875080 +0100
|
|
|
7a6771 |
@@ -0,0 +1,22 @@
|
|
|
7a6771 |
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ Copyright 2006 Free Software Foundation, Inc.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
7a6771 |
+ it under the terms of the GNU General Public License as published by
|
|
|
7a6771 |
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
7a6771 |
+ (at your option) any later version.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ This program is distributed in the hope that it will be useful,
|
|
|
7a6771 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7a6771 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
7a6771 |
+ GNU General Public License for more details.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ You should have received a copy of the GNU General Public License
|
|
|
7a6771 |
+ along with this program; if not, write to the Free Software
|
|
|
7a6771 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ Please email any bugs, comments, and/or additions to this file to:
|
|
|
7a6771 |
+ bug-gdb@prep.ai.mit.edu */
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+__thread int var = 42;
|
|
|
7a6771 |
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-sepdebug.exp
|
|
|
7a6771 |
===================================================================
|
|
|
7a6771 |
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
|
7a6771 |
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2016-02-16 10:16:31.241001010 +0100
|
|
|
7a6771 |
@@ -0,0 +1,87 @@
|
|
|
7a6771 |
+# Copyright 2006 Free Software Foundation, Inc.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
7a6771 |
+# it under the terms of the GNU General Public License as published by
|
|
|
7a6771 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
7a6771 |
+# (at your option) any later version.
|
|
|
7a6771 |
+#
|
|
|
7a6771 |
+# This program is distributed in the hope that it will be useful,
|
|
|
7a6771 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7a6771 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
7a6771 |
+# GNU General Public License for more details.
|
|
|
7a6771 |
+#
|
|
|
7a6771 |
+# You should have received a copy of the GNU General Public License
|
|
|
7a6771 |
+# along with this program; if not, write to the Free Software
|
|
|
7a6771 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+if $tracelevel then {
|
|
|
7a6771 |
+ strace $tracelevel
|
|
|
7a6771 |
+}
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+set testfile tls-sepdebug
|
|
|
7a6771 |
+set srcmainfile ${testfile}-main.c
|
|
|
7a6771 |
+set srcsharedfile ${testfile}-shared.c
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+set binmainfile [standard_output_file ${testfile}-main]
|
|
|
7a6771 |
+set binsharedbase ${testfile}-shared.so
|
|
|
7a6771 |
+set binsharedfile [standard_output_file ${binsharedbase}]
|
|
|
7a6771 |
+set binshareddebugfile [standard_output_file ${binsharedbase}.debug]
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# Use explicit -soname as otherwise the full path to the library would get
|
|
|
7a6771 |
+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# FIXME: gcc dependency (-Wl,-soname).
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
|
|
|
7a6771 |
+ untested "Couldn't compile test library"
|
|
|
7a6771 |
+ return -1
|
|
|
7a6771 |
+}
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'.
|
|
|
7a6771 |
+if 0 then {
|
|
|
7a6771 |
+ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}"
|
|
|
7a6771 |
+} else {
|
|
|
7a6771 |
+ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}"
|
|
|
7a6771 |
+ remote_exec build "objcopy --strip-debug ${binsharedfile}"
|
|
|
7a6771 |
+ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}"
|
|
|
7a6771 |
+}
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# Do not use `shlib=' as it will automatically add also -rpath for gcc.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } {
|
|
|
7a6771 |
+ untested "Couldn't compile test program"
|
|
|
7a6771 |
+ return -1
|
|
|
7a6771 |
+}
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# Get things started.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+# Test also the proper resolving of relative library names to absolute ones.
|
|
|
7a6771 |
+# \$PWD is easy - it is the absolute way
|
|
|
7a6771 |
+# ${subdir} would fail on "print var"
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+set absdir [file dirname [standard_output_file ${binsharedbase}]]
|
|
|
7a6771 |
+foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] name { absolute relative } {
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ gdb_exit
|
|
|
7a6771 |
+ gdb_start
|
|
|
7a6771 |
+ ###gdb_reinitialize_dir $srcdir/$subdir
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \
|
|
|
7a6771 |
+ "" \
|
|
|
7a6771 |
+ "set env LD_LIBRARY_PATH is $name"
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ gdb_load ${binmainfile}
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ # For C programs, "start" should stop in main().
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ gdb_test "start" \
|
|
|
7a6771 |
+ "main \\(\\) at .*${srcmainfile}.*" \
|
|
|
7a6771 |
+ "start"
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list
|
|
|
7a6771 |
+ # as happens with TLS variables and `separate_debug_objfile_backlink'.
|
|
|
7a6771 |
+
|
|
|
7a6771 |
+ gdb_test "print var" \
|
|
|
7a6771 |
+ "\\\$1 = \[0-9\].*" \
|
|
|
7a6771 |
+ "print TLS variable from a shared library with $name-directory separate debug info file"
|
|
|
7a6771 |
+}
|