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

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