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

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