2017-12-08 04:31:26 +00:00
|
|
|
From 6f9560ad830dbad83429859b2392831463f0fc96 Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-6.8-quit-never-aborts.patch
|
|
|
|
|
|
|
|
FileName: gdb-6.8-quit-never-aborts.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Make the GDB quit processing non-abortable to cleanup everything properly.
|
|
|
|
;;=fedora: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch .
|
|
|
|
|
2013-01-21 15:54:01 +00:00
|
|
|
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).
|
2017-12-08 04:31:26 +00:00
|
|
|
---
|
|
|
|
gdb/defs.h | 4 ++++
|
|
|
|
gdb/extension.c | 5 +++++
|
|
|
|
gdb/top.c | 6 ++++++
|
|
|
|
gdb/utils.c | 7 +++++++
|
|
|
|
4 files changed, 22 insertions(+)
|
2013-01-21 15:54:01 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/defs.h b/gdb/defs.h
|
|
|
|
index 27f3becab0..95395b41a3 100644
|
|
|
|
--- a/gdb/defs.h
|
|
|
|
+++ b/gdb/defs.h
|
|
|
|
@@ -168,6 +168,10 @@ extern void default_quit_handler (void);
|
2014-06-19 20:14:32 +00:00
|
|
|
/* Flag that function quit should call quit_force. */
|
|
|
|
extern volatile int sync_quit_force_run;
|
2013-01-21 15:54:01 +00:00
|
|
|
|
2016-01-09 14:11:44 +00:00
|
|
|
+#ifdef NEED_DETACH_SIGSTOP
|
2013-01-21 15:54:01 +00:00
|
|
|
+extern int quit_flag_cleanup;
|
2016-01-09 14:11:44 +00:00
|
|
|
+#endif
|
2016-07-17 14:35:49 +00:00
|
|
|
+
|
2013-01-21 15:54:01 +00:00
|
|
|
extern void quit (void);
|
2016-07-17 14:35:49 +00:00
|
|
|
|
|
|
|
/* Helper for the QUIT macro. */
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/extension.c b/gdb/extension.c
|
|
|
|
index 4ffad038c9..d029a2f23d 100644
|
|
|
|
--- a/gdb/extension.c
|
|
|
|
+++ b/gdb/extension.c
|
|
|
|
@@ -830,6 +830,11 @@ check_quit_flag (void)
|
2016-01-09 14:11:44 +00:00
|
|
|
int i, result = 0;
|
|
|
|
const struct extension_language_defn *extlang;
|
|
|
|
|
|
|
|
+#ifdef NEED_DETACH_SIGSTOP
|
|
|
|
+ if (quit_flag_cleanup)
|
|
|
|
+ return 0;
|
|
|
|
+#endif
|
2016-07-17 14:35:49 +00:00
|
|
|
+
|
2016-01-09 14:11:44 +00:00
|
|
|
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
|
|
|
|
{
|
|
|
|
if (extlang->ops->check_quit_flag != NULL)
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/top.c b/gdb/top.c
|
|
|
|
index 8cd7c99346..326c2399b3 100644
|
|
|
|
--- a/gdb/top.c
|
|
|
|
+++ b/gdb/top.c
|
|
|
|
@@ -1583,7 +1583,13 @@ quit_force (int *exit_arg, int from_tty)
|
2017-02-27 21:30:32 +00:00
|
|
|
qt.args = NULL;
|
2015-05-31 18:47:21 +00:00
|
|
|
qt.from_tty = from_tty;
|
2013-01-21 15:54:01 +00:00
|
|
|
|
2016-01-09 14:11:44 +00:00
|
|
|
+#ifndef NEED_DETACH_SIGSTOP
|
|
|
|
/* We want to handle any quit errors and exit regardless. */
|
|
|
|
+#else
|
2013-01-21 15:54:01 +00:00
|
|
|
+ /* 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;
|
2016-01-09 14:11:44 +00:00
|
|
|
+#endif
|
2013-01-21 15:54:01 +00:00
|
|
|
|
2013-08-02 20:26:03 +00:00
|
|
|
/* Get out of tfind mode, and kill or detach all inferiors. */
|
2015-05-31 18:47:21 +00:00
|
|
|
TRY
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/utils.c b/gdb/utils.c
|
|
|
|
index f72ddab992..26a923d8b3 100644
|
|
|
|
--- a/gdb/utils.c
|
|
|
|
+++ b/gdb/utils.c
|
|
|
|
@@ -107,6 +107,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
|
2013-01-21 15:54:01 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
static int debug_timestamp = 0;
|
2013-01-21 15:54:01 +00:00
|
|
|
|
2016-01-09 14:11:44 +00:00
|
|
|
+#ifdef NEED_DETACH_SIGSTOP
|
2013-01-21 15:54:01 +00:00
|
|
|
+/* Nonzero means we are already processing the quitting cleanups and we should
|
|
|
|
+ no longer get aborted. */
|
|
|
|
+
|
|
|
|
+int quit_flag_cleanup;
|
2016-01-09 14:11:44 +00:00
|
|
|
+#endif
|
2016-07-17 14:35:49 +00:00
|
|
|
+
|
2014-06-19 20:14:32 +00:00
|
|
|
/* 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.) */
|
2017-12-08 04:31:26 +00:00
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|