142 lines
4.4 KiB
Diff
142 lines
4.4 KiB
Diff
2007-01-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
* gdb.base/bt-ppc.c, gdb.base/bt-ppc.exp: New files.
|
|
|
|
|
|
diff -u -rupN gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.c gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.c
|
|
--- gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.c 1969-12-31 19:00:00.000000000 -0500
|
|
+++ gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.c 2007-01-12 21:34:55.000000000 -0500
|
|
@@ -0,0 +1,41 @@
|
|
+/* 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. */
|
|
+
|
|
+#include <stdlib.h>
|
|
+
|
|
+/* Force `-fpie' double jump bl->blrl. */
|
|
+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;
|
|
+}
|
|
+
|
|
+int main (void)
|
|
+{
|
|
+ func1 ();
|
|
+ return 0;
|
|
+}
|
|
diff -u -rupN gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.exp gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.exp
|
|
--- gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.exp 1969-12-31 19:00:00.000000000 -0500
|
|
+++ gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.exp 2007-01-12 21:27:25.000000000 -0500
|
|
@@ -0,0 +1,87 @@
|
|
+# 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 multiple unwinding fixes of PPC platform.
|
|
+# As the tests are platform independent we can run it everywhere.
|
|
+
|
|
+if $tracelevel then {
|
|
+ strace $tracelevel
|
|
+}
|
|
+
|
|
+set prms_id 0
|
|
+set bug_id 0
|
|
+
|
|
+# This test uses GCC-specific syntax.
|
|
+if [get_compiler_info not-used] {
|
|
+ return -1
|
|
+}
|
|
+
|
|
+if {![test_compiler_info "gcc-*"]} {
|
|
+ return 0
|
|
+}
|
|
+
|
|
+proc do_test { opts addons } {
|
|
+ global objdir srcdir subdir gdb_prompt
|
|
+
|
|
+ set testfile "bt-ppc"
|
|
+ set srcfile ${testfile}.c
|
|
+ set binfile ${objdir}/${subdir}/${testfile}
|
|
+
|
|
+ # `additional_flags' should be last as it eats arguments till eol.
|
|
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list $opts additional_flags=$addons]] != ""} {
|
|
+ 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 show [concat $opts $addons]
|
|
+ gdb_test_multiple "bt" "Correct unwind for: $show" {
|
|
+ -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 "Correct unwind for: $show"
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+foreach eh_frame {{-fno-asynchronous-unwind-tables}
|
|
+ {-fasynchronous-unwind-tables}} {
|
|
+ foreach pie {{} {-fpie -pie}} {
|
|
+ foreach optim {{} {-O2}} {
|
|
+ foreach is_debug {{} {debug}} {
|
|
+ do_test $is_debug [concat $eh_frame $pie $optim]
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+}
|