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

26bbde
We may abort the process of detaching threads with multiple SIGINTs - which are
26bbde
being sent during a testcase terminating its child GDB.
26bbde
26bbde
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
26bbde
should have been detached with SIGSTOP (as they are accidentally left running
26bbde
on the debugger termination).
26bbde
26bbde
Index: gdb-7.9.50.20150520/gdb/defs.h
26bbde
===================================================================
26bbde
--- gdb-7.9.50.20150520.orig/gdb/defs.h	2015-05-31 18:06:24.579002757 +0200
26bbde
+++ gdb-7.9.50.20150520/gdb/defs.h	2015-05-31 18:06:29.253031613 +0200
26bbde
@@ -145,6 +145,7 @@ extern void set_quit_flag (void);
26bbde
 /* Flag that function quit should call quit_force.  */
26bbde
 extern volatile int sync_quit_force_run;
26bbde
 
26bbde
+extern int quit_flag_cleanup;
26bbde
 extern int immediate_quit;
26bbde
 
26bbde
 extern void quit (void);
26bbde
Index: gdb-7.9.50.20150520/gdb/top.c
26bbde
===================================================================
26bbde
--- gdb-7.9.50.20150520.orig/gdb/top.c	2015-05-31 18:06:24.580002763 +0200
26bbde
+++ gdb-7.9.50.20150520/gdb/top.c	2015-05-31 18:06:29.254031619 +0200
26bbde
@@ -1463,7 +1463,9 @@ quit_force (char *args, int from_tty)
26bbde
   qt.args = args;
26bbde
   qt.from_tty = from_tty;
26bbde
 
26bbde
-  /* We want to handle any quit errors and exit regardless.  */
26bbde
+  /* We want to handle any quit errors and exit regardless but we should never
26bbde
+     get user-interrupted to properly detach the inferior.  */
26bbde
+  quit_flag_cleanup = 1;
26bbde
 
26bbde
   /* Get out of tfind mode, and kill or detach all inferiors.  */
26bbde
   TRY
26bbde
Index: gdb-7.9.50.20150520/gdb/utils.c
26bbde
===================================================================
26bbde
--- gdb-7.9.50.20150520.orig/gdb/utils.c	2015-05-31 18:06:24.582002776 +0200
26bbde
+++ gdb-7.9.50.20150520/gdb/utils.c	2015-05-31 18:06:29.255031625 +0200
26bbde
@@ -122,6 +122,11 @@ int job_control;
26bbde
 
26bbde
 int immediate_quit;
26bbde
 
26bbde
+/* Nonzero means we are already processing the quitting cleanups and we should
26bbde
+   no longer get aborted.  */
26bbde
+
26bbde
+int quit_flag_cleanup;
26bbde
+
26bbde
 /* Nonzero means that strings with character values >0x7F should be printed
26bbde
    as octal escapes.  Zero means just print the value (e.g. it's an
26bbde
    international character, and the terminal or window can cope.)  */
26bbde
Index: gdb-7.9.50.20150520/gdb/extension.c
26bbde
===================================================================
26bbde
--- gdb-7.9.50.20150520.orig/gdb/extension.c	2015-05-31 18:06:24.582002776 +0200
26bbde
+++ gdb-7.9.50.20150520/gdb/extension.c	2015-05-31 18:06:29.256031632 +0200
26bbde
@@ -833,6 +833,9 @@ check_quit_flag (void)
26bbde
   int i, result = 0;
26bbde
   const struct extension_language_defn *extlang;
26bbde
 
26bbde
+  if (quit_flag_cleanup)
26bbde
+    return 0;
26bbde
+
26bbde
   ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
26bbde
     {
26bbde
       if (extlang->ops->check_quit_flag != NULL)