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

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