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

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