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

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