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