Blame SOURCES/gdb-6.8-quit-never-aborts.patch

7a6771
We may abort the process of detaching threads with multiple SIGINTs - which are
7a6771
being sent during a testcase terminating its child GDB.
7a6771
7a6771
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
7a6771
should have been detached with SIGSTOP (as they are accidentally left running
7a6771
on the debugger termination).
7a6771
7a6771
Index: gdb-7.11.50.20160630/gdb/defs.h
7a6771
===================================================================
7a6771
--- gdb-7.11.50.20160630.orig/gdb/defs.h	2016-07-03 16:40:43.423078926 +0200
7a6771
+++ gdb-7.11.50.20160630/gdb/defs.h	2016-07-03 16:41:08.568271741 +0200
7a6771
@@ -175,6 +175,10 @@
7a6771
 /* Flag that function quit should call quit_force.  */
7a6771
 extern volatile int sync_quit_force_run;
7a6771
 
7a6771
+#ifdef NEED_DETACH_SIGSTOP
7a6771
+extern int quit_flag_cleanup;
7a6771
+#endif
7a6771
+
7a6771
 extern void quit (void);
7a6771
 
7a6771
 /* Helper for the QUIT macro.  */
7a6771
Index: gdb-7.11.50.20160630/gdb/extension.c
7a6771
===================================================================
7a6771
--- gdb-7.11.50.20160630.orig/gdb/extension.c	2016-07-03 16:40:41.723065890 +0200
7a6771
+++ gdb-7.11.50.20160630/gdb/extension.c	2016-07-03 16:41:44.896550309 +0200
7a6771
@@ -830,6 +830,11 @@
7a6771
   int i, result = 0;
7a6771
   const struct extension_language_defn *extlang;
7a6771
 
7a6771
+#ifdef NEED_DETACH_SIGSTOP
7a6771
+  if (quit_flag_cleanup)
7a6771
+    return 0;
7a6771
+#endif
7a6771
+
7a6771
   ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
7a6771
     {
7a6771
       if (extlang->ops->check_quit_flag != NULL)
7a6771
Index: gdb-7.11.50.20160630/gdb/top.c
7a6771
===================================================================
7a6771
--- gdb-7.11.50.20160630.orig/gdb/top.c	2016-07-03 16:40:41.724065898 +0200
7a6771
+++ gdb-7.11.50.20160630/gdb/top.c	2016-07-03 16:40:43.424078934 +0200
7a6771
@@ -1617,7 +1617,13 @@
7a6771
   qt.args = args;
7a6771
   qt.from_tty = from_tty;
7a6771
 
7a6771
+#ifndef NEED_DETACH_SIGSTOP
7a6771
   /* We want to handle any quit errors and exit regardless.  */
7a6771
+#else
7a6771
+  /* We want to handle any quit errors and exit regardless but we should never
7a6771
+     get user-interrupted to properly detach the inferior.  */
7a6771
+  quit_flag_cleanup = 1;
7a6771
+#endif
7a6771
 
7a6771
   /* Get out of tfind mode, and kill or detach all inferiors.  */
7a6771
   TRY
7a6771
Index: gdb-7.11.50.20160630/gdb/utils.c
7a6771
===================================================================
7a6771
--- gdb-7.11.50.20160630.orig/gdb/utils.c	2016-07-03 16:40:41.725065905 +0200
7a6771
+++ gdb-7.11.50.20160630/gdb/utils.c	2016-07-03 16:41:38.961504799 +0200
7a6771
@@ -109,6 +109,13 @@
7a6771
 
7a6771
 int job_control;
7a6771
 
7a6771
+#ifdef NEED_DETACH_SIGSTOP
7a6771
+/* Nonzero means we are already processing the quitting cleanups and we should
7a6771
+   no longer get aborted.  */
7a6771
+
7a6771
+int quit_flag_cleanup;
7a6771
+#endif
7a6771
+
7a6771
 /* Nonzero means that strings with character values >0x7F should be printed
7a6771
    as octal escapes.  Zero means just print the value (e.g. it's an
7a6771
    international character, and the terminal or window can cope.)  */