7a31f8b
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
7a31f8b
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S	1969-12-31 19:00:00.000000000 -0500
7a31f8b
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S	2007-08-02 13:23:10.000000000 -0400
7a31f8b
@@ -0,0 +1,78 @@
7a31f8b
+/* This testcase is part of GDB, the GNU debugger.
7a31f8b
+
7a31f8b
+   Copyright 2007 Free Software Foundation, Inc.
7a31f8b
+
7a31f8b
+   This program is free software; you can redistribute it and/or modify
7a31f8b
+   it under the terms of the GNU General Public License as published by
7a31f8b
+   the Free Software Foundation; either version 2 of the License, or
7a31f8b
+   (at your option) any later version.
7a31f8b
+
7a31f8b
+   This program is distributed in the hope that it will be useful,
7a31f8b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a31f8b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a31f8b
+   GNU General Public License for more details.
7a31f8b
+ 
7a31f8b
+   You should have received a copy of the GNU General Public License
7a31f8b
+   along with this program; if not, write to the Free Software
7a31f8b
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7a31f8b
+
7a31f8b
+	.section	".text"
7a31f8b
+	.align 2
7a31f8b
+	.globl func0
7a31f8b
+	.type	func0, @function
7a31f8b
+func0:
7a31f8b
+	stwu 1,-16(1)
7a31f8b
+	mflr 0
7a31f8b
+	stw 31,12(1)
7a31f8b
+	stw 0,20(1)
7a31f8b
+	mr 31,1
7a31f8b
+	bl abort
7a31f8b
+	.size	func0, .-func0
7a31f8b
+	.align 2
7a31f8b
+	.globl func1
7a31f8b
+	.type	func1, @function
7a31f8b
+func1:
7a31f8b
+	stwu 1,-16(1)
7a31f8b
+	mflr 0
7a31f8b
+/* 20 = BO = branch always
7a31f8b
+   31 = BI = CR bit (ignored)  */
7a31f8b
+	bcl 20,31,.Lpie
7a31f8b
+.Lpie:	stw 31,12(1)
7a31f8b
+	stw 0,20(1)
7a31f8b
+	mr 31,1
7a31f8b
+	bl func0
7a31f8b
+	mr 0,3
7a31f8b
+	lis 9,var@ha
7a31f8b
+	lwz 9,var@l(9)
7a31f8b
+	add 0,0,9
7a31f8b
+	mr 3,0
7a31f8b
+	lwz 11,0(1)
7a31f8b
+	lwz 0,4(11)
7a31f8b
+	mtlr 0
7a31f8b
+	lwz 31,-4(11)
7a31f8b
+	mr 1,11
7a31f8b
+	blr
7a31f8b
+	.size	func1, .-func1
7a31f8b
+	.section	.note.GNU-stack,"",@progbits
7a31f8b
+	.ident	"GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
7a31f8b
+
7a31f8b
+/* Original source file:
7a31f8b
+
7a31f8b
+#include <stdlib.h>
7a31f8b
+
7a31f8b
+extern volatile int var;
7a31f8b
+
7a31f8b
+int func0 (void) __attribute__((__noinline__));
7a31f8b
+int func0 (void)
7a31f8b
+{
7a31f8b
+  abort ();
7a31f8b
+  return var;
7a31f8b
+}
7a31f8b
+
7a31f8b
+int func1 (void) __attribute__((__noinline__));
7a31f8b
+int func1 (void)
7a31f8b
+{
7a31f8b
+  return func0 () + var;
7a31f8b
+}
7a31f8b
+
7a31f8b
+*/
7a31f8b
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
7a31f8b
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S	1969-12-31 19:00:00.000000000 -0500
7a31f8b
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S	2007-08-02 14:28:56.000000000 -0400
7a31f8b
@@ -0,0 +1,98 @@
7a31f8b
+/* This testcase is part of GDB, the GNU debugger.
7a31f8b
+
7a31f8b
+   Copyright 2007 Free Software Foundation, Inc.
7a31f8b
+
7a31f8b
+   This program is free software; you can redistribute it and/or modify
7a31f8b
+   it under the terms of the GNU General Public License as published by
7a31f8b
+   the Free Software Foundation; either version 2 of the License, or
7a31f8b
+   (at your option) any later version.
7a31f8b
+
7a31f8b
+   This program is distributed in the hope that it will be useful,
7a31f8b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a31f8b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a31f8b
+   GNU General Public License for more details.
7a31f8b
+ 
7a31f8b
+   You should have received a copy of the GNU General Public License
7a31f8b
+   along with this program; if not, write to the Free Software
7a31f8b
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7a31f8b
+
7a31f8b
+	.section	".toc","aw"
7a31f8b
+	.section	".text"
7a31f8b
+	.align 2
7a31f8b
+	.globl func0
7a31f8b
+	.section	".opd","aw"
7a31f8b
+	.align 3
7a31f8b
+func0:
7a31f8b
+	.quad	.L.func0,.TOC.@tocbase
7a31f8b
+	.previous
7a31f8b
+	.type	func0, @function
7a31f8b
+.L.func0:
7a31f8b
+	mflr 0
7a31f8b
+	std 31,-8(1)
7a31f8b
+	std 0,16(1)
7a31f8b
+	stdu 1,-128(1)
7a31f8b
+	mr 31,1
7a31f8b
+	bl abort
7a31f8b
+	nop
7a31f8b
+	.long 0
7a31f8b
+	.byte 0,0,0,1,128,1,0,1
7a31f8b
+	.size	func0,.-.L.func0
7a31f8b
+	.section	".toc","aw"
7a31f8b
+.LC1:
7a31f8b
+	.tc var[TC],var
7a31f8b
+	.section	".text"
7a31f8b
+	.align 2
7a31f8b
+	.globl func1
7a31f8b
+	.section	".opd","aw"
7a31f8b
+	.align 3
7a31f8b
+func1:
7a31f8b
+	.quad	.L.func1,.TOC.@tocbase
7a31f8b
+	.previous
7a31f8b
+	.type	func1, @function
7a31f8b
+.L.func1:
7a31f8b
+	mflr 0
7a31f8b
+/* 20 = BO = branch always
7a31f8b
+   31 = BI = CR bit (ignored)  */
7a31f8b
+	bcl 20,31,.Lpie
7a31f8b
+.Lpie:	std 31,-8(1)
7a31f8b
+	std 0,16(1)
7a31f8b
+	stdu 1,-128(1)
7a31f8b
+	mr 31,1
7a31f8b
+	bl func0
7a31f8b
+	mr 11,3
7a31f8b
+	ld 9,.LC1@toc(2)
7a31f8b
+	lwz 0,0(9)
7a31f8b
+	add 0,11,0
7a31f8b
+	extsw 0,0
7a31f8b
+	mr 3,0
7a31f8b
+	ld 1,0(1)
7a31f8b
+	ld 0,16(1)
7a31f8b
+	mtlr 0
7a31f8b
+	ld 31,-8(1)
7a31f8b
+	blr
7a31f8b
+	.long 0
7a31f8b
+	.byte 0,0,0,1,128,1,0,1
7a31f8b
+	.size	func1,.-.L.func1
7a31f8b
+	.section	.note.GNU-stack,"",@progbits
7a31f8b
+	.ident	"GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
7a31f8b
+
7a31f8b
+/* Original source file:
7a31f8b
+
7a31f8b
+#include <stdlib.h>
7a31f8b
+
7a31f8b
+extern volatile int var;
7a31f8b
+
7a31f8b
+int func0 (void) __attribute__((__noinline__));
7a31f8b
+int func0 (void)
7a31f8b
+{
7a31f8b
+  abort ();
7a31f8b
+  return var;
7a31f8b
+}
7a31f8b
+
7a31f8b
+int func1 (void) __attribute__((__noinline__));
7a31f8b
+int func1 (void)
7a31f8b
+{
7a31f8b
+  return func0 () + var;
7a31f8b
+}
7a31f8b
+
7a31f8b
+*/
7a31f8b
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
7a31f8b
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c	1969-12-31 19:00:00.000000000 -0500
7a31f8b
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c	2007-08-02 13:25:10.000000000 -0400
7a31f8b
@@ -0,0 +1,29 @@
7a31f8b
+/* This testcase is part of GDB, the GNU debugger.
7a31f8b
+
7a31f8b
+   Copyright 2007 Free Software Foundation, Inc.
7a31f8b
+
7a31f8b
+   This program is free software; you can redistribute it and/or modify
7a31f8b
+   it under the terms of the GNU General Public License as published by
7a31f8b
+   the Free Software Foundation; either version 2 of the License, or
7a31f8b
+   (at your option) any later version.
7a31f8b
+
7a31f8b
+   This program is distributed in the hope that it will be useful,
7a31f8b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a31f8b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a31f8b
+   GNU General Public License for more details.
7a31f8b
+ 
7a31f8b
+   You should have received a copy of the GNU General Public License
7a31f8b
+   along with this program; if not, write to the Free Software
7a31f8b
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7a31f8b
+
7a31f8b
+/* Force `-fpie' double jump bl->blrl.  */
7a31f8b
+/* No longer used.  */
7a31f8b
+volatile int var;
7a31f8b
+
7a31f8b
+extern int func1 (void);
7a31f8b
+
7a31f8b
+int main (void)
7a31f8b
+{
7a31f8b
+  func1 ();
7a31f8b
+  return 0;
7a31f8b
+}
7a31f8b
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
7a31f8b
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp	1969-12-31 19:00:00.000000000 -0500
7a31f8b
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp	2007-08-02 14:21:29.000000000 -0400
dd46ae6
@@ -0,0 +1,72 @@
7a31f8b
+#   Copyright 2006, 2007 Free Software Foundation, Inc.
7a31f8b
+
7a31f8b
+# This program is free software; you can redistribute it and/or modify
7a31f8b
+# it under the terms of the GNU General Public License as published by
7a31f8b
+# the Free Software Foundation; either version 2 of the License, or
7a31f8b
+# (at your option) any later version.
7a31f8b
+# 
7a31f8b
+# This program is distributed in the hope that it will be useful,
7a31f8b
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a31f8b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a31f8b
+# GNU General Public License for more details.
7a31f8b
+# 
7a31f8b
+# You should have received a copy of the GNU General Public License
7a31f8b
+# along with this program; if not, write to the Free Software
7a31f8b
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
7a31f8b
+
7a31f8b
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
7a31f8b
+# jump of the PIE code.
7a31f8b
+
7a31f8b
+if ![istarget "powerpc*-*-linux*"] then {
7a31f8b
+    verbose "Skipping powerpc-linux prologue tests."
7a31f8b
+    return
7a31f8b
+}
7a31f8b
+
7a31f8b
+set testfile "powerpc-bcl-prologue"
7a31f8b
+set srcfile1 ${testfile}.c
7a31f8b
+set flags "debug"
7a31f8b
+if [istarget "powerpc-*"] then {
7a31f8b
+    set srcfile2 ${testfile}-asm32.S
7a31f8b
+    set flags "$flags additional_flags=-m32"
7a31f8b
+} elseif [istarget "powerpc64-*"] then {
7a31f8b
+    set srcfile2 ${testfile}-asm64.S
7a31f8b
+    set flags "$flags additional_flags=-m64"
7a31f8b
+} else {
7a31f8b
+   fail "powerpc arch test"
7a31f8b
+   return
7a31f8b
+}
7a31f8b
+set objfile2 ${objdir}/${subdir}/${testfile}-asm.o
7a31f8b
+set binfile ${objdir}/${subdir}/${testfile}
7a31f8b
+
7a31f8b
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
7a31f8b
+    return -1
7a31f8b
+}
7a31f8b
+
7a31f8b
+gdb_exit
7a31f8b
+gdb_start
7a31f8b
+gdb_reinitialize_dir $srcdir/$subdir
7a31f8b
+gdb_load ${binfile}
7a31f8b
+
7a31f8b
+# We should stop in abort(3).
7a31f8b
+
7a31f8b
+gdb_run_cmd
7a31f8b
+
7a31f8b
+gdb_test_multiple {} "continue to abort()" {
7a31f8b
+    -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
7a31f8b
+       pass "continue to abort()"
7a31f8b
+    }
7a31f8b
+}
7a31f8b
+
7a31f8b
+# Check backtrace:
7a31f8b
+# #3  0x0804835f in func0 ()
7a31f8b
+# #4  0x0804836a in func1 ()
7a31f8b
+# #5  0x0804838c in main ()
7a31f8b
+# (gdb)
7a31f8b
+# `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
7a31f8b
+
7a31f8b
+set test "matching unwind"
7a31f8b
+gdb_test_multiple "backtrace" $test {
7a31f8b
+    -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 $" {
7a31f8b
+	pass $test
7a31f8b
+    }
7a31f8b
+}
6a80c39
6a80c39
Fixup the testcase for ppc64 biarch GDB.
6a80c39
6a80c39
--- ./gdb/testsuite/gdb.arch/powerpc-prologue.exp	2008-01-13 13:32:19.000000000 +0100
6a80c39
+++ ./gdb/testsuite/gdb.arch/powerpc-prologue.exp	2008-01-02 00:04:10.000000000 +0100
6a80c39
@@ -17,8 +17,9 @@
6a80c39
 # Test PowerPC prologue analyzer.
6a80c39
 
6a80c39
 # Do not run on AIX (where we won't be able to build the tests without
6a80c39
-# some surgery) or on PowerPC64 (ditto, dot symbols).
6a80c39
-if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
6a80c39
+# some surgery).  PowerPC64 target would break due to dot symbols but we build
6a80c39
+# there PowerPC32 inferior.
6a80c39
+if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then {
6a80c39
     verbose "Skipping PowerPC prologue tests."
6a80c39
     return
6a80c39
 }