Blame SOURCES/gdb-6.8-bz466901-backtrace-full-prelinked.patch

7a6771
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
7a6771
7a6771
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp	2009-09-09 20:10:35.000000000 +0200
7a6771
@@ -0,0 +1,102 @@
7a6771
+# Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+
7a6771
+# Minimal DWARF-2 unit test
7a6771
+
7a6771
+# This test can only be run on i386/x86_64 targets which support DWARF-2.
7a6771
+# For now pick a sampling of likely targets.
7a6771
+if {(![istarget *-*-linux*]
7a6771
+     && ![istarget *-*-gnu*]
7a6771
+     && ![istarget *-*-elf*]
7a6771
+     && ![istarget *-*-openbsd*])
7a6771
+    || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
7a6771
+    return 0  
7a6771
+}
7a6771
+
7a6771
+set testfile "dw2-loclist-prelinked"
7a6771
+set srcfuncfile ${testfile}-func.S
7a6771
+set binsharedfuncfile [standard_output_file ${testfile}.so]
7a6771
+set srcmainfile ${testfile}-main.c
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+
7a6771
+remote_exec build "rm -f ${binfile}"
7a6771
+
7a6771
+# get the value of gcc_compiled
7a6771
+if [get_compiler_info ${binfile}] {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+# This test can only be run on gcc as we use additional_flags=FIXME
7a6771
+if {$gcc_compiled == 0} {
7a6771
+    return 0
7a6771
+}
7a6771
+
7a6771
+if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
7a6771
+    untested "Couldn't compile test library"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+# The new separate debug info file will be stored in the .debug subdirectory.
7a6771
+
7a6771
+if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
7a6771
+    # check that you have a recent version of strip and objcopy installed
7a6771
+    unsupported "cannot produce separate debug info files"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
7a6771
+    # Maybe we don't have prelink.
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
7a6771
+		   "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+gdb_run_cmd
7a6771
+
7a6771
+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
7a6771
+
7a6771
+# Incorrect:
7a6771
+# #0  0x00110430 in __kernel_vsyscall ()
7a6771
+# No symbol table info available.
7a6771
+# #1  0x003d44c0 in raise () from /lib/libc.so.6
7a6771
+# No symbol table info available.
7a6771
+# #2  0x003d5e88 in abort () from /lib/libc.so.6
7a6771
+# No symbol table info available.
7a6771
+# #3  0x44f10437 in func () at dw2-loclist-prelinked.c:8
7a6771
+# 	i = Could not find the frame base for "func".
7a6771
+
7a6771
+# Correct:
7a6771
+# #0  0x00110430 in __kernel_vsyscall ()
7a6771
+# No symbol table info available.
7a6771
+# #1  0x003d44c0 in raise () from /lib/libc.so.6
7a6771
+# No symbol table info available.
7a6771
+# #2  0x003d5e88 in abort () from /lib/libc.so.6
7a6771
+# No symbol table info available.
7a6771
+# #3  0x4ae36437 in func () at dw2-loclist-prelinked.c:8
7a6771
+# 	i = 3827288
7a6771
+# #4  0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
7a6771
+# No locals.
7a6771
+
7a6771
+# `abort' can get expressed as `*__GI_abort'.
7a6771
+gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
7a6771
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c	2009-09-09 20:10:35.000000000 +0200
7a6771
@@ -0,0 +1,26 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+/* dw2-loclist-prelinked-func.S */
7a6771
+extern void func (void);
7a6771
+
7a6771
+int
7a6771
+main (void)
7a6771
+{
7a6771
+  func ();
7a6771
+  return 0;
7a6771
+}
7a6771
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S	2009-09-09 20:10:35.000000000 +0200
7a6771
@@ -0,0 +1,328 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+/*
7a6771
+#include <stdlib.h>
7a6771
+
7a6771
+void
7a6771
+func (void)
7a6771
+{
7a6771
+  int i;
7a6771
+
7a6771
+  abort ();
7a6771
+}
7a6771
+*/
7a6771
+	.file	"dw2-loclist-prelinked.c"
7a6771
+	.section	.debug_abbrev,"",@progbits
7a6771
+.Ldebug_abbrev0:
7a6771
+	.section	.debug_info,"",@progbits
7a6771
+.Ldebug_info0:
7a6771
+	.section	.debug_line,"",@progbits
7a6771
+.Ldebug_line0:
7a6771
+	.text
7a6771
+.Ltext0:
7a6771
+.globl func
7a6771
+	.type	func, @function
7a6771
+func:
7a6771
+.LFB2:
7a6771
+	.file 1 "dw2-loclist-prelinked.c"
7a6771
+	.loc 1 5 0
7a6771
+	pushl	%ebp
7a6771
+.LCFI0:
7a6771
+	movl	%esp, %ebp
7a6771
+.LCFI1:
7a6771
+	subl	$24, %esp
7a6771
+.LCFI2:
7a6771
+	.loc 1 8 0
7a6771
+	call	abort
7a6771
+.LFE2:
7a6771
+	.size	func, .-func
7a6771
+	.section	.debug_frame,"",@progbits
7a6771
+.Lframe0:
7a6771
+	.long	.LECIE0-.LSCIE0
7a6771
+.LSCIE0:
7a6771
+	.long	0xffffffff
7a6771
+	.byte	0x1
7a6771
+	.string	""
7a6771
+	.uleb128 0x1
7a6771
+	.sleb128 -4
7a6771
+	.byte	0x8
7a6771
+	.byte	0xc
7a6771
+	.uleb128 0x4
7a6771
+	.uleb128 0x4
7a6771
+	.byte	0x88
7a6771
+	.uleb128 0x1
7a6771
+	.align 4
7a6771
+.LECIE0:
7a6771
+.LSFDE0:
7a6771
+	.long	.LEFDE0-.LASFDE0
7a6771
+.LASFDE0:
7a6771
+	.long	.Lframe0
7a6771
+	.long	.LFB2
7a6771
+	.long	.LFE2-.LFB2
7a6771
+	.byte	0x4
7a6771
+	.long	.LCFI0-.LFB2
7a6771
+	.byte	0xe
7a6771
+	.uleb128 0x8
7a6771
+	.byte	0x85
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x4
7a6771
+	.long	.LCFI1-.LCFI0
7a6771
+	.byte	0xd
7a6771
+	.uleb128 0x5
7a6771
+	.align 4
7a6771
+.LEFDE0:
7a6771
+	.text
7a6771
+.Letext0:
7a6771
+	.section	.debug_loc,"",@progbits
7a6771
+.Ldebug_loc0:
7a6771
+.LLST0:
7a6771
+	.long	.LFB2-.Ltext0
7a6771
+	.long	.LCFI0-.Ltext0
7a6771
+	.value	0x2
7a6771
+	.byte	0x74
7a6771
+	.sleb128 4
7a6771
+	.long	.LCFI0-.Ltext0
7a6771
+	.long	.LCFI1-.Ltext0
7a6771
+	.value	0x2
7a6771
+	.byte	0x74
7a6771
+	.sleb128 8
7a6771
+	.long	.LCFI1-.Ltext0
7a6771
+	.long	.LFE2-.Ltext0
7a6771
+	.value	0x2
7a6771
+	.byte	0x75
7a6771
+	.sleb128 8
7a6771
+	.long	0x0
7a6771
+	.long	0x0
7a6771
+	.section	.debug_info
7a6771
+	.long	0x94
7a6771
+	.value	0x2
7a6771
+	.long	.Ldebug_abbrev0
7a6771
+	.byte	0x4
7a6771
+	.uleb128 0x1
7a6771
+	.long	.LASF10
7a6771
+	.byte	0x1
7a6771
+	.long	.LASF11
7a6771
+	.long	.LASF12
7a6771
+	.long	.Ltext0
7a6771
+	.long	.Letext0
7a6771
+	.long	.Ldebug_line0
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x4
7a6771
+	.byte	0x7
7a6771
+	.long	.LASF0
7a6771
+	.uleb128 0x3
7a6771
+	.byte	0x4
7a6771
+	.byte	0x5
7a6771
+	.string	"int"
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x4
7a6771
+	.byte	0x5
7a6771
+	.long	.LASF1
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x1
7a6771
+	.byte	0x8
7a6771
+	.long	.LASF2
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x2
7a6771
+	.byte	0x7
7a6771
+	.long	.LASF3
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x4
7a6771
+	.byte	0x7
7a6771
+	.long	.LASF4
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x1
7a6771
+	.byte	0x6
7a6771
+	.long	.LASF5
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x2
7a6771
+	.byte	0x5
7a6771
+	.long	.LASF6
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x8
7a6771
+	.byte	0x5
7a6771
+	.long	.LASF7
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x8
7a6771
+	.byte	0x7
7a6771
+	.long	.LASF8
7a6771
+	.uleb128 0x4
7a6771
+	.byte	0x4
7a6771
+	.byte	0x7
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x1
7a6771
+	.byte	0x6
7a6771
+	.long	.LASF9
7a6771
+	.uleb128 0x5
7a6771
+	.byte	0x1
7a6771
+	.long	.LASF13
7a6771
+	.byte	0x1
7a6771
+	.byte	0x5
7a6771
+	.byte	0x1
7a6771
+	.long	.LFB2
7a6771
+	.long	.LFE2
7a6771
+	.long	.LLST0
7a6771
+	.uleb128 0x6
7a6771
+	.string	"i"
7a6771
+	.byte	0x1
7a6771
+	.byte	0x6
7a6771
+	.long	0x2c
7a6771
+	.byte	0x2
7a6771
+	.byte	0x91
7a6771
+	.sleb128 -12
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.section	.debug_abbrev
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x11
7a6771
+	.byte	0x1
7a6771
+	.uleb128 0x25
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x13
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x1b
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x11
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x12
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x10
7a6771
+	.uleb128 0x6
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x2
7a6771
+	.uleb128 0x24
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3e
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x24
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3e
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x8
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x4
7a6771
+	.uleb128 0x24
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3e
7a6771
+	.uleb128 0xb
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x5
7a6771
+	.uleb128 0x2e
7a6771
+	.byte	0x1
7a6771
+	.uleb128 0x3f
7a6771
+	.uleb128 0xc
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x27
7a6771
+	.uleb128 0xc
7a6771
+	.uleb128 0x11
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x12
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x40
7a6771
+	.uleb128 0x6
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x6
7a6771
+	.uleb128 0x34
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x8
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x49
7a6771
+	.uleb128 0x13
7a6771
+	.uleb128 0x2
7a6771
+	.uleb128 0xa
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.section	.debug_pubnames,"",@progbits
7a6771
+	.long	0x17
7a6771
+	.value	0x2
7a6771
+	.long	.Ldebug_info0
7a6771
+	.long	0x98
7a6771
+	.long	0x75
7a6771
+	.string	"func"
7a6771
+	.long	0x0
7a6771
+	.section	.debug_aranges,"",@progbits
7a6771
+	.long	0x1c
7a6771
+	.value	0x2
7a6771
+	.long	.Ldebug_info0
7a6771
+	.byte	0x4
7a6771
+	.byte	0x0
7a6771
+	.value	0x0
7a6771
+	.value	0x0
7a6771
+	.long	.Ltext0
7a6771
+	.long	.Letext0-.Ltext0
7a6771
+	.long	0x0
7a6771
+	.long	0x0
7a6771
+	.section	.debug_str,"MS",@progbits,1
7a6771
+.LASF7:
7a6771
+	.string	"long long int"
7a6771
+.LASF0:
7a6771
+	.string	"unsigned int"
7a6771
+.LASF11:
7a6771
+	.string	"dw2-loclist-prelinked.c"
7a6771
+.LASF12:
7a6771
+	.string	"gdb-6.8/gdb/testsuite/gdb.dwarf2"
7a6771
+.LASF4:
7a6771
+	.string	"long unsigned int"
7a6771
+.LASF8:
7a6771
+	.string	"long long unsigned int"
7a6771
+.LASF2:
7a6771
+	.string	"unsigned char"
7a6771
+.LASF9:
7a6771
+	.string	"char"
7a6771
+.LASF1:
7a6771
+	.string	"long int"
7a6771
+.LASF3:
7a6771
+	.string	"short unsigned int"
7a6771
+.LASF5:
7a6771
+	.string	"signed char"
7a6771
+.LASF10:
7a6771
+	.string	"GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)"
7a6771
+.LASF13:
7a6771
+	.string	"func"
7a6771
+.LASF6:
7a6771
+	.string	"short int"
7a6771
+	.ident	"GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)"
7a6771
+	.section	.note.GNU-stack,"",@progbits