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