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

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