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