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

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