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

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