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

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