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

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