|
|
ed07ac |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
ed07ac |
From: Fedora GDB patches <invalid@email.com>
|
|
|
ed07ac |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
ed07ac |
Subject: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
|
|
ed07ac |
|
|
|
ed07ac |
;; Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
|
|
ed07ac |
;; (Philippe Waroquiers, RH BZ 1149205).
|
|
|
ed07ac |
;;=fedoratest
|
|
|
ed07ac |
|
|
|
ed07ac |
URL: <https://sourceware.org/ml/gdb-patches/2013-05/msg00364.html>
|
|
|
ed07ac |
Message-ID: <1368136582.30058.7.camel@soleil>
|
|
|
ed07ac |
|
|
|
ed07ac |
From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
|
|
|
ed07ac |
To: gdb-patches at sourceware dot org
|
|
|
ed07ac |
Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
|
|
|
ed07ac |
Date: Thu, 09 May 2013 23:56:22 +0200
|
|
|
ed07ac |
|
|
|
ed07ac |
The attached patch fixes a gdb_assert caused by the combination of catch
|
|
|
ed07ac |
signal and fork:
|
|
|
ed07ac |
break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
|
|
|
ed07ac |
|
|
|
ed07ac |
The problem is that the signal_catch_counts is decremented by detach_breakpoints.
|
|
|
ed07ac |
The fix consists in not detaching breakpoint locations of type bp_loc_other.
|
|
|
ed07ac |
The patch introduces a new test.
|
|
|
ed07ac |
|
|
|
ed07ac |
Comments by Sergio Durigan Junior:
|
|
|
ed07ac |
|
|
|
ed07ac |
I addded a specific testcase for this patch, which tests exactly the
|
|
|
ed07ac |
issue that the customer is facing. This patch does not solve the
|
|
|
ed07ac |
whole problem of catching a syscall and forking (for more details,
|
|
|
ed07ac |
see <https://sourceware.org/bugzilla/show_bug.cgi?id=13457>,
|
|
|
ed07ac |
specifically comment #3), but it solves the issue reported by the
|
|
|
ed07ac |
customer.
|
|
|
ed07ac |
|
|
|
ed07ac |
I also removed the original testcase of this patch, because it
|
|
|
ed07ac |
relied on "catch signal", which is a command that is not implemented
|
|
|
ed07ac |
in this version of GDB.
|
|
|
ed07ac |
|
|
|
ed07ac |
commit bd9673a4ded96ea5c108601501c8e59003ea1be6
|
|
|
ed07ac |
Author: Philippe Waroquiers <philippe@sourceware.org>
|
|
|
ed07ac |
Date: Tue May 21 18:47:05 2013 +0000
|
|
|
ed07ac |
|
|
|
ed07ac |
Fix internal error caused by interaction between catch signal and fork
|
|
|
ed07ac |
|
|
|
ed07ac |
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
|
|
ed07ac |
new file mode 100644
|
|
|
ed07ac |
--- /dev/null
|
|
|
ed07ac |
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
|
|
ed07ac |
@@ -0,0 +1,11 @@
|
|
|
ed07ac |
+#include <stdio.h>
|
|
|
ed07ac |
+#include <unistd.h>
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+int
|
|
|
ed07ac |
+main (int argc, char **argv)
|
|
|
ed07ac |
+{
|
|
|
ed07ac |
+ if (fork () == 0)
|
|
|
ed07ac |
+ sleep (1);
|
|
|
ed07ac |
+ chdir (".");
|
|
|
ed07ac |
+ return 0;
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
|
|
ed07ac |
new file mode 100644
|
|
|
ed07ac |
--- /dev/null
|
|
|
ed07ac |
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
|
|
ed07ac |
@@ -0,0 +1,58 @@
|
|
|
ed07ac |
+# Copyright 2015 Free Software Foundation, Inc.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# This program is free software; you can redistribute it and/or modify
|
|
|
ed07ac |
+# it under the terms of the GNU General Public License as published by
|
|
|
ed07ac |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
ed07ac |
+# (at your option) any later version.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# This program is distributed in the hope that it will be useful,
|
|
|
ed07ac |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ed07ac |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ed07ac |
+# GNU General Public License for more details.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# You should have received a copy of the GNU General Public License
|
|
|
ed07ac |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if { [is_remote target] || ![isnative] } then {
|
|
|
ed07ac |
+ continue
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set testfile "gdb-rhbz1149205-catch-syscall-fork"
|
|
|
ed07ac |
+set srcfile ${testfile}.c
|
|
|
ed07ac |
+set binfile [standard_output_file ${testfile}]
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# Until "catch syscall" is implemented on other targets...
|
|
|
ed07ac |
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
|
|
|
ed07ac |
+ continue
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# This shall be updated whenever 'catch syscall' is implemented
|
|
|
ed07ac |
+# on some architecture.
|
|
|
ed07ac |
+#if { ![istarget "i\[34567\]86-*-linux*"]
|
|
|
ed07ac |
+if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
|
|
|
ed07ac |
+ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
|
|
|
ed07ac |
+ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
|
|
|
ed07ac |
+ continue
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
|
ed07ac |
+ untested ${testfile}.exp
|
|
|
ed07ac |
+ return -1
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+gdb_exit
|
|
|
ed07ac |
+gdb_start
|
|
|
ed07ac |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
ed07ac |
+gdb_load $binfile
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if { ![runto_main] } {
|
|
|
ed07ac |
+ return -1
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+gdb_test "catch syscall chdir" \
|
|
|
ed07ac |
+ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \
|
|
|
ed07ac |
+ "catch syscall chdir"
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+gdb_test "continue" \
|
|
|
ed07ac |
+ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
|
|
|
ed07ac |
+ "continue from catch syscall after fork"
|