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

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