gdb/gdb-6.8-quit-never-aborts.patch
Jan Kratochvil af2c2a5422 Rebase to pre-7.13 FSF GDB trunk.
Dropped gdb-6.7-bz426600-DW_TAG_interface_type-test.patch as GCJ is no more.
2017-02-27 22:30:32 +01:00

75 lines
2.7 KiB
Diff

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