Blame SOURCES/gdb-6.3-bz140532-ppc-unwinding-test.patch

2c2fa1
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
2c2fa1
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S	1969-12-31 19:00:00.000000000 -0500
2c2fa1
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S	2007-08-02 13:23:10.000000000 -0400
2c2fa1
@@ -0,0 +1,78 @@
2c2fa1
+/* This testcase is part of GDB, the GNU debugger.
2c2fa1
+
2c2fa1
+   Copyright 2007 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
+	.section	".text"
2c2fa1
+	.align 2
2c2fa1
+	.globl func0
2c2fa1
+	.type	func0, @function
2c2fa1
+func0:
2c2fa1
+	stwu 1,-16(1)
2c2fa1
+	mflr 0
2c2fa1
+	stw 31,12(1)
2c2fa1
+	stw 0,20(1)
2c2fa1
+	mr 31,1
2c2fa1
+	bl abort
2c2fa1
+	.size	func0, .-func0
2c2fa1
+	.align 2
2c2fa1
+	.globl func1
2c2fa1
+	.type	func1, @function
2c2fa1
+func1:
2c2fa1
+	stwu 1,-16(1)
2c2fa1
+	mflr 0
2c2fa1
+/* 20 = BO = branch always
2c2fa1
+   31 = BI = CR bit (ignored)  */
2c2fa1
+	bcl 20,31,.Lpie
2c2fa1
+.Lpie:	stw 31,12(1)
2c2fa1
+	stw 0,20(1)
2c2fa1
+	mr 31,1
2c2fa1
+	bl func0
2c2fa1
+	mr 0,3
2c2fa1
+	lis 9,var@ha
2c2fa1
+	lwz 9,var@l(9)
2c2fa1
+	add 0,0,9
2c2fa1
+	mr 3,0
2c2fa1
+	lwz 11,0(1)
2c2fa1
+	lwz 0,4(11)
2c2fa1
+	mtlr 0
2c2fa1
+	lwz 31,-4(11)
2c2fa1
+	mr 1,11
2c2fa1
+	blr
2c2fa1
+	.size	func1, .-func1
2c2fa1
+	.section	.note.GNU-stack,"",@progbits
2c2fa1
+	.ident	"GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
2c2fa1
+
2c2fa1
+/* Original source file:
2c2fa1
+
2c2fa1
+#include <stdlib.h>
2c2fa1
+
2c2fa1
+extern volatile int var;
2c2fa1
+
2c2fa1
+int func0 (void) __attribute__((__noinline__));
2c2fa1
+int func0 (void)
2c2fa1
+{
2c2fa1
+  abort ();
2c2fa1
+  return var;
2c2fa1
+}
2c2fa1
+
2c2fa1
+int func1 (void) __attribute__((__noinline__));
2c2fa1
+int func1 (void)
2c2fa1
+{
2c2fa1
+  return func0 () + var;
2c2fa1
+}
2c2fa1
+
2c2fa1
+*/
2c2fa1
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
2c2fa1
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S	1969-12-31 19:00:00.000000000 -0500
2c2fa1
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S	2007-08-02 14:28:56.000000000 -0400
2c2fa1
@@ -0,0 +1,98 @@
2c2fa1
+/* This testcase is part of GDB, the GNU debugger.
2c2fa1
+
2c2fa1
+   Copyright 2007 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
+	.section	".toc","aw"
2c2fa1
+	.section	".text"
2c2fa1
+	.align 2
2c2fa1
+	.globl func0
2c2fa1
+	.section	".opd","aw"
2c2fa1
+	.align 3
2c2fa1
+func0:
2c2fa1
+	.quad	.L.func0,.TOC.@tocbase
2c2fa1
+	.previous
2c2fa1
+	.type	func0, @function
2c2fa1
+.L.func0:
2c2fa1
+	mflr 0
2c2fa1
+	std 31,-8(1)
2c2fa1
+	std 0,16(1)
2c2fa1
+	stdu 1,-128(1)
2c2fa1
+	mr 31,1
2c2fa1
+	bl abort
2c2fa1
+	nop
2c2fa1
+	.long 0
2c2fa1
+	.byte 0,0,0,1,128,1,0,1
2c2fa1
+	.size	func0,.-.L.func0
2c2fa1
+	.section	".toc","aw"
2c2fa1
+.LC1:
2c2fa1
+	.tc var[TC],var
2c2fa1
+	.section	".text"
2c2fa1
+	.align 2
2c2fa1
+	.globl func1
2c2fa1
+	.section	".opd","aw"
2c2fa1
+	.align 3
2c2fa1
+func1:
2c2fa1
+	.quad	.L.func1,.TOC.@tocbase
2c2fa1
+	.previous
2c2fa1
+	.type	func1, @function
2c2fa1
+.L.func1:
2c2fa1
+	mflr 0
2c2fa1
+/* 20 = BO = branch always
2c2fa1
+   31 = BI = CR bit (ignored)  */
2c2fa1
+	bcl 20,31,.Lpie
2c2fa1
+.Lpie:	std 31,-8(1)
2c2fa1
+	std 0,16(1)
2c2fa1
+	stdu 1,-128(1)
2c2fa1
+	mr 31,1
2c2fa1
+	bl func0
2c2fa1
+	mr 11,3
2c2fa1
+	ld 9,.LC1@toc(2)
2c2fa1
+	lwz 0,0(9)
2c2fa1
+	add 0,11,0
2c2fa1
+	extsw 0,0
2c2fa1
+	mr 3,0
2c2fa1
+	ld 1,0(1)
2c2fa1
+	ld 0,16(1)
2c2fa1
+	mtlr 0
2c2fa1
+	ld 31,-8(1)
2c2fa1
+	blr
2c2fa1
+	.long 0
2c2fa1
+	.byte 0,0,0,1,128,1,0,1
2c2fa1
+	.size	func1,.-.L.func1
2c2fa1
+	.section	.note.GNU-stack,"",@progbits
2c2fa1
+	.ident	"GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
2c2fa1
+
2c2fa1
+/* Original source file:
2c2fa1
+
2c2fa1
+#include <stdlib.h>
2c2fa1
+
2c2fa1
+extern volatile int var;
2c2fa1
+
2c2fa1
+int func0 (void) __attribute__((__noinline__));
2c2fa1
+int func0 (void)
2c2fa1
+{
2c2fa1
+  abort ();
2c2fa1
+  return var;
2c2fa1
+}
2c2fa1
+
2c2fa1
+int func1 (void) __attribute__((__noinline__));
2c2fa1
+int func1 (void)
2c2fa1
+{
2c2fa1
+  return func0 () + var;
2c2fa1
+}
2c2fa1
+
2c2fa1
+*/
2c2fa1
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
2c2fa1
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c	1969-12-31 19:00:00.000000000 -0500
2c2fa1
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c	2007-08-02 13:25:10.000000000 -0400
2c2fa1
@@ -0,0 +1,29 @@
2c2fa1
+/* This testcase is part of GDB, the GNU debugger.
2c2fa1
+
2c2fa1
+   Copyright 2007 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
+/* Force `-fpie' double jump bl->blrl.  */
2c2fa1
+/* No longer used.  */
2c2fa1
+volatile int var;
2c2fa1
+
2c2fa1
+extern int func1 (void);
2c2fa1
+
2c2fa1
+int main (void)
2c2fa1
+{
2c2fa1
+  func1 ();
2c2fa1
+  return 0;
2c2fa1
+}
2c2fa1
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
2c2fa1
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp	1969-12-31 19:00:00.000000000 -0500
2c2fa1
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp	2007-08-02 14:21:29.000000000 -0400
2c2fa1
@@ -0,0 +1,72 @@
2c2fa1
+#   Copyright 2006, 2007 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
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
2c2fa1
+# jump of the PIE code.
2c2fa1
+
2c2fa1
+if ![istarget "powerpc*-*-linux*"] then {
2c2fa1
+    verbose "Skipping powerpc-linux prologue tests."
2c2fa1
+    return
2c2fa1
+}
2c2fa1
+
2c2fa1
+set testfile "powerpc-bcl-prologue"
2c2fa1
+set srcfile1 ${testfile}.c
2c2fa1
+set flags "debug"
2c2fa1
+if [istarget "powerpc-*"] then {
2c2fa1
+    set srcfile2 ${testfile}-asm32.S
2c2fa1
+    set flags "$flags additional_flags=-m32"
2c2fa1
+} elseif [istarget "powerpc64-*"] then {
2c2fa1
+    set srcfile2 ${testfile}-asm64.S
2c2fa1
+    set flags "$flags additional_flags=-m64"
2c2fa1
+} else {
2c2fa1
+   fail "powerpc arch test"
2c2fa1
+   return
2c2fa1
+}
2c2fa1
+set objfile2 ${objdir}/${subdir}/${testfile}-asm.o
2c2fa1
+set binfile ${objdir}/${subdir}/${testfile}
2c2fa1
+
2c2fa1
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
2c2fa1
+    return -1
2c2fa1
+}
2c2fa1
+
2c2fa1
+gdb_exit
2c2fa1
+gdb_start
2c2fa1
+gdb_reinitialize_dir $srcdir/$subdir
2c2fa1
+gdb_load ${binfile}
2c2fa1
+
2c2fa1
+# We should stop in abort(3).
2c2fa1
+
2c2fa1
+gdb_run_cmd
2c2fa1
+
2c2fa1
+gdb_test_multiple {} "continue to abort()" {
2c2fa1
+    -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
2c2fa1
+       pass "continue to abort()"
2c2fa1
+    }
2c2fa1
+}
2c2fa1
+
2c2fa1
+# Check backtrace:
2c2fa1
+# #3  0x0804835f in func0 ()
2c2fa1
+# #4  0x0804836a in func1 ()
2c2fa1
+# #5  0x0804838c in main ()
2c2fa1
+# (gdb)
2c2fa1
+# `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
2c2fa1
+
2c2fa1
+set test "matching unwind"
2c2fa1
+gdb_test_multiple "backtrace" $test {
2c2fa1
+    -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" {
2c2fa1
+	pass $test
2c2fa1
+    }
2c2fa1
+}
2c2fa1
2c2fa1
Fixup the testcase for ppc64 biarch GDB.
2c2fa1
2c2fa1
--- ./gdb/testsuite/gdb.arch/powerpc-prologue.exp	2008-01-13 13:32:19.000000000 +0100
2c2fa1
+++ ./gdb/testsuite/gdb.arch/powerpc-prologue.exp	2008-01-02 00:04:10.000000000 +0100
2c2fa1
@@ -17,8 +17,9 @@
2c2fa1
 # Test PowerPC prologue analyzer.
2c2fa1
 
2c2fa1
 # Do not run on AIX (where we won't be able to build the tests without
2c2fa1
-# some surgery) or on PowerPC64 (ditto, dot symbols).
2c2fa1
-if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
2c2fa1
+# some surgery).  PowerPC64 target would break due to dot symbols but we build
2c2fa1
+# there PowerPC32 inferior.
2c2fa1
+if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then {
2c2fa1
     verbose "Skipping PowerPC prologue tests."
2c2fa1
     return
2c2fa1
 }