80 lines
2.6 KiB
Diff
80 lines
2.6 KiB
Diff
|
|
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||
|
|
new file mode 100644
|
||
|
|
--- /dev/null
|
||
|
|
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||
|
|
@@ -0,0 +1,11 @@
|
||
|
|
+#include <stdio.h>
|
||
|
|
+#include <unistd.h>
|
||
|
|
+
|
||
|
|
+int
|
||
|
|
+main (int argc, char **argv)
|
||
|
|
+{
|
||
|
|
+ if (fork () == 0)
|
||
|
|
+ sleep (1);
|
||
|
|
+ chdir (".");
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||
|
|
new file mode 100644
|
||
|
|
--- /dev/null
|
||
|
|
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||
|
|
@@ -0,0 +1,58 @@
|
||
|
|
+# Copyright 2015 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 3 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, see <http://www.gnu.org/licenses/>.
|
||
|
|
+
|
||
|
|
+if { [is_remote target] || ![isnative] } then {
|
||
|
|
+ continue
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+set testfile "gdb-rhbz1149205-catch-syscall-fork"
|
||
|
|
+set srcfile ${testfile}.c
|
||
|
|
+set binfile [standard_output_file ${testfile}]
|
||
|
|
+
|
||
|
|
+# Until "catch syscall" is implemented on other targets...
|
||
|
|
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
|
||
|
|
+ continue
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+# This shall be updated whenever 'catch syscall' is implemented
|
||
|
|
+# on some architecture.
|
||
|
|
+#if { ![istarget "i\[34567\]86-*-linux*"]
|
||
|
|
+if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
|
||
|
|
+ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
|
||
|
|
+ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
|
||
|
|
+ continue
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||
|
|
+ untested ${testfile}.exp
|
||
|
|
+ return -1
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+gdb_exit
|
||
|
|
+gdb_start
|
||
|
|
+gdb_reinitialize_dir $srcdir/$subdir
|
||
|
|
+gdb_load $binfile
|
||
|
|
+
|
||
|
|
+if { ![runto_main] } {
|
||
|
|
+ return -1
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+gdb_test "catch syscall chdir" \
|
||
|
|
+ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \
|
||
|
|
+ "catch syscall chdir"
|
||
|
|
+
|
||
|
|
+gdb_test "continue" \
|
||
|
|
+ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
|
||
|
|
+ "continue from catch syscall after fork"
|