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

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