Blame SOURCES/gdb-6.5-sharedlibrary-path.patch

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