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

f9426a
We may abort the process of detaching threads with multiple SIGINTs - which are
f9426a
being sent during a testcase terminating its child GDB.
f9426a
f9426a
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
f9426a
should have been detached with SIGSTOP (as they are accidentally left running
f9426a
on the debugger termination).
f9426a
f9426a
Index: gdb-7.7.90.20140613/gdb/defs.h
f9426a
===================================================================
f9426a
--- gdb-7.7.90.20140613.orig/gdb/defs.h	2014-06-13 23:10:18.876623018 +0200
f9426a
+++ gdb-7.7.90.20140613/gdb/defs.h	2014-06-13 23:10:52.450660505 +0200
f9426a
@@ -174,6 +174,7 @@ extern void set_quit_flag (void);
f9426a
 /* Flag that function quit should call quit_force.  */
f9426a
 extern volatile int sync_quit_force_run;
f9426a
 
f9426a
+extern int quit_flag_cleanup;
f9426a
 extern int immediate_quit;
f9426a
 
f9426a
 extern void quit (void);
f9426a
Index: gdb-7.7.90.20140613/gdb/top.c
f9426a
===================================================================
f9426a
--- gdb-7.7.90.20140613.orig/gdb/top.c	2014-06-13 23:10:15.910619715 +0200
f9426a
+++ gdb-7.7.90.20140613/gdb/top.c	2014-06-13 23:10:18.877623020 +0200
f9426a
@@ -1378,7 +1378,9 @@ quit_force (char *args, int from_tty)
f9426a
   if (ex.reason < 0) \
f9426a
     exception_print (gdb_stderr, ex)
f9426a
 
f9426a
-  /* We want to handle any quit errors and exit regardless.  */
f9426a
+  /* We want to handle any quit errors and exit regardless but we should never
f9426a
+     get user-interrupted to properly detach the inferior.  */
f9426a
+  quit_flag_cleanup = 1;
f9426a
 
f9426a
   /* Get out of tfind mode, and kill or detach all inferiors.  */
f9426a
   DO_TRY
f9426a
Index: gdb-7.7.90.20140613/gdb/utils.c
f9426a
===================================================================
f9426a
--- gdb-7.7.90.20140613.orig/gdb/utils.c	2014-06-13 23:10:18.878623021 +0200
f9426a
+++ gdb-7.7.90.20140613/gdb/utils.c	2014-06-13 23:10:38.307644652 +0200
f9426a
@@ -125,6 +125,11 @@ int job_control;
f9426a
 
f9426a
 int immediate_quit;
f9426a
 
f9426a
+/* Nonzero means we are already processing the quitting cleanups and we should
f9426a
+   no longer get aborted.  */
f9426a
+
f9426a
+int quit_flag_cleanup;
f9426a
+
f9426a
 /* Nonzero means that strings with character values >0x7F should be printed
f9426a
    as octal escapes.  Zero means just print the value (e.g. it's an
f9426a
    international character, and the terminal or window can cope.)  */
f9426a
Index: gdb-7.7.90.20140613/gdb/extension.c
f9426a
===================================================================
f9426a
--- gdb-7.7.90.20140613.orig/gdb/extension.c	2014-06-13 03:59:36.000000000 +0200
f9426a
+++ gdb-7.7.90.20140613/gdb/extension.c	2014-06-13 23:11:32.434704853 +0200
f9426a
@@ -817,6 +817,9 @@ check_quit_flag (void)
f9426a
   int i, result = 0;
f9426a
   const struct extension_language_defn *extlang;
f9426a
 
f9426a
+  if (quit_flag_cleanup)
f9426a
+    return 0;
f9426a
+
f9426a
   ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
f9426a
     {
f9426a
       if (extlang->ops->check_quit_flag != NULL)