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