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