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