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

861f93
We may abort the process of detaching threads with multiple SIGINTs - which are
861f93
being sent during a testcase terminating its child GDB.
861f93
861f93
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
861f93
should have been detached with SIGSTOP (as they are accidentally left running
861f93
on the debugger termination).
861f93
861f93
Index: gdb-7.5.50.20130118/gdb/defs.h
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/defs.h	2013-01-01 07:32:41.000000000 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/defs.h	2013-01-21 16:40:29.889256633 +0100
861f93
@@ -176,6 +176,7 @@ extern int check_quit_flag (void);
861f93
 /* Set the quit flag.  */
861f93
 extern void set_quit_flag (void);
861f93
 
861f93
+extern int quit_flag_cleanup;
861f93
 extern int immediate_quit;
861f93
 
861f93
 extern void quit (void);
861f93
Index: gdb-7.5.50.20130118/gdb/top.c
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/top.c	2013-01-21 14:56:12.000000000 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/top.c	2013-01-21 14:56:16.385710056 +0100
861f93
@@ -1329,7 +1329,9 @@ quit_force (char *args, int from_tty)
861f93
   qt.args = args;
861f93
   qt.from_tty = from_tty;
861f93
 
861f93
-  /* We want to handle any quit errors and exit regardless.  */
861f93
+  /* We want to handle any quit errors and exit regardless but we should never
861f93
+     get user-interrupted to properly detach the inferior.  */
861f93
+  quit_flag_cleanup = 1;
861f93
   catch_errors (quit_target, &qt,
861f93
 	        "Quitting: ", RETURN_MASK_ALL);
861f93
 
861f93
Index: gdb-7.5.50.20130118/gdb/utils.c
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/utils.c	2013-01-21 14:56:12.000000000 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/utils.c	2013-01-21 16:41:02.225233493 +0100
861f93
@@ -141,6 +141,11 @@ int quit_flag;
861f93
 
861f93
 int immediate_quit;
861f93
 
861f93
+/* Nonzero means we are already processing the quitting cleanups and we should
861f93
+   no longer get aborted.  */
861f93
+
861f93
+int quit_flag_cleanup;
861f93
+
861f93
 #ifndef HAVE_PYTHON
861f93
 
861f93
 /* Clear the quit flag.  */
861f93
@@ -164,6 +169,9 @@ set_quit_flag (void)
861f93
 int
861f93
 check_quit_flag (void)
861f93
 {
861f93
+  if (quit_flag_cleanup)
861f93
+    return 0;
861f93
+
861f93
   /* This is written in a particular way to avoid races.  */
861f93
   if (quit_flag)
861f93
     {
861f93
Index: gdb-7.5.50.20130118/gdb/python/python.c
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/python/python.c	2013-01-21 16:39:03.000000000 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/python/python.c	2013-01-21 16:39:30.698299142 +0100
861f93
@@ -181,6 +181,9 @@ set_quit_flag (void)
861f93
 int
861f93
 check_quit_flag (void)
861f93
 {
861f93
+  if (quit_flag_cleanup)
861f93
+    return 0;
861f93
+
861f93
   return PyOS_InterruptOccurred ();
861f93
 }
861f93