Simplify .spec: Remove conditional revert of: gdb-6.8-attach-signalled-detach-stopped.patch

- Simplify .spec: Remove conditional revert of: gdb-6.8-quit-never-aborts.patch
This commit is contained in:
Jan Kratochvil 2016-01-09 15:11:44 +01:00
parent ccd56ac8c9
commit 5d173531c0
3 changed files with 89 additions and 67 deletions

View File

@ -1,29 +1,50 @@
Index: gdb-7.9.50.20150531/gdb/linux-nat.c diff -dup -rup gdb-7.10.50.20160106-orig/gdb/infrun.c gdb-7.10.50.20160106/gdb/infrun.c
=================================================================== --- gdb-7.10.50.20160106-orig/gdb/infrun.c 2016-01-09 15:05:06.127481758 +0100
--- gdb-7.9.50.20150531.orig/gdb/linux-nat.c 2015-05-31 18:23:56.147494790 +0200 +++ gdb-7.10.50.20160106/gdb/infrun.c 2016-01-09 15:05:24.054593048 +0100
+++ gdb-7.9.50.20150531/gdb/linux-nat.c 2015-05-31 18:24:01.935530759 +0200 @@ -626,6 +626,13 @@ holding the child stopped. Try \"set de
@@ -168,6 +168,9 @@ blocked. */ target_pid_to_str (process_ptid));
}
+#ifdef NEED_DETACH_SIGSTOP
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
+ In this point of code it cannot be 1 as we would not get FORK
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
+ We would have to first TARGET_STOP and WAITPID it as with running
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
+#endif
target_detach (NULL, 0);
}
diff -dup -rup gdb-7.10.50.20160106-orig/gdb/linux-nat.c gdb-7.10.50.20160106/gdb/linux-nat.c
--- gdb-7.10.50.20160106-orig/gdb/linux-nat.c 2016-01-09 15:05:06.225482366 +0100
+++ gdb-7.10.50.20160106/gdb/linux-nat.c 2016-01-09 15:05:24.050593023 +0100
@@ -194,6 +194,11 @@ enum tribool have_ptrace_getregset = TRI
static struct target_ops *linux_ops; static struct target_ops *linux_ops;
static struct target_ops linux_ops_saved; static struct target_ops linux_ops_saved;
+#ifdef NEED_DETACH_SIGSTOP
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */ +/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
+static pid_t pid_was_stopped; +static pid_t pid_was_stopped;
+ +
+#endif
/* The method to call, if any, when a new thread is attached. */ /* The method to call, if any, when a new thread is attached. */
static void (*linux_nat_new_thread) (struct lwp_info *); static void (*linux_nat_new_thread) (struct lwp_info *);
@@ -981,6 +984,7 @@ linux_nat_post_attach_wait (ptid_t ptid, @@ -961,6 +966,9 @@ linux_nat_post_attach_wait (ptid_t ptid,
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n"); "LNPAW: Attaching to a stopped process\n");
+#ifdef NEED_DETACH_SIGSTOP
+ pid_was_stopped = ptid_get_pid (ptid); + pid_was_stopped = ptid_get_pid (ptid);
+#endif
/* The process is definitely stopped. It is in a job control /* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED / stop, unless the kernel predates the TASK_STOPPED /
@@ -1529,6 +1529,23 @@ get_pending_status (struct lwp_info *lp, @@ -1303,6 +1311,25 @@ get_pending_status (struct lwp_info *lp,
gdb_signal_to_string (signo)); gdb_signal_to_string (signo));
} }
+#ifdef NEED_DETACH_SIGSTOP
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that + /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
+ many TIDs are left unstopped). See RH Bug 496732. */ + many TIDs are left unstopped). See RH Bug 496732. */
+ if (ptid_get_pid (lp->ptid) == pid_was_stopped) + if (ptid_get_pid (lp->ptid) == pid_was_stopped)
@ -41,22 +62,26 @@ Index: gdb-7.9.50.20150531/gdb/linux-nat.c
+ } + }
+ } + }
+ +
+#endif
return 0; return 0;
} }
@@ -1581,6 +1588,8 @@ linux_nat_detach (struct target_ops *ops @@ -1416,6 +1443,10 @@ linux_nat_detach (struct target_ops *ops
} }
else else
linux_ops->to_detach (ops, args, from_tty); linux_ops->to_detach (ops, args, from_tty);
+#ifdef NEED_DETACH_SIGSTOP
+ +
+ pid_was_stopped = 0; + pid_was_stopped = 0;
+#endif
} }
/* Resume execution of the inferior process. If STEP is nonzero, /* Resume execution of the inferior process. If STEP is nonzero,
@@ -1839,6 +1848,14 @@ linux_nat_resume (struct target_ops *ops @@ -1674,6 +1705,16 @@ linux_nat_resume (struct target_ops *ops
return; return;
} }
+#ifdef NEED_DETACH_SIGSTOP
+ /* At this point, we are going to resume the inferior and if we + /* At this point, we are going to resume the inferior and if we
+ have attached to a stopped process, we no longer should leave + have attached to a stopped process, we no longer should leave
+ it as stopped if the user detaches. PTID variable has PID set to LWP + it as stopped if the user detaches. PTID variable has PID set to LWP
@ -65,23 +90,25 @@ Index: gdb-7.9.50.20150531/gdb/linux-nat.c
+ if (!step && lp && pid_was_stopped == ptid_get_pid (lp->ptid)) + if (!step && lp && pid_was_stopped == ptid_get_pid (lp->ptid))
+ pid_was_stopped = 0; + pid_was_stopped = 0;
+ +
+#endif
if (resume_many) if (resume_many)
iterate_over_lwps (ptid, linux_nat_resume_callback, lp); iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
@@ -3935,6 +3952,8 @@ linux_nat_mourn_inferior (struct target_ @@ -3618,6 +3659,10 @@ linux_nat_mourn_inferior (struct target_
/* Let the arch-specific native code know this process is gone. */ /* Let the arch-specific native code know this process is gone. */
linux_nat_forget_process (pid); linux_nat_forget_process (pid);
+#ifdef NEED_DETACH_SIGSTOP
+ +
+ pid_was_stopped = 0; + pid_was_stopped = 0;
+#endif
} }
/* Convert a native/host siginfo object, into/from the siginfo in the /* Convert a native/host siginfo object, into/from the siginfo in the
Index: gdb-7.9.50.20150531/gdb/testsuite/gdb.threads/attach-stopped.exp diff -dup -rup gdb-7.10.50.20160106-orig/gdb/testsuite/gdb.threads/attach-stopped.exp gdb-7.10.50.20160106/gdb/testsuite/gdb.threads/attach-stopped.exp
=================================================================== --- gdb-7.10.50.20160106-orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2016-01-06 02:48:38.000000000 +0100
--- gdb-7.9.50.20150531.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2015-05-31 18:23:56.148494796 +0200 +++ gdb-7.10.50.20160106/gdb/testsuite/gdb.threads/attach-stopped.exp 2016-01-09 15:05:48.917747101 +0100
+++ gdb-7.9.50.20150531/gdb/testsuite/gdb.threads/attach-stopped.exp 2015-05-31 18:24:01.935530759 +0200 @@ -56,7 +56,65 @@ proc corefunc { threadtype } {
@@ -61,7 +61,65 @@ proc corefunc { threadtype } {
gdb_reinitialize_dir $srcdir/$subdir gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile} gdb_load ${binfile}
@ -148,19 +175,3 @@ Index: gdb-7.9.50.20150531/gdb/testsuite/gdb.threads/attach-stopped.exp
set test "$threadtype: attach2 to stopped, after setting file" set test "$threadtype: attach2 to stopped, after setting file"
gdb_test_multiple "attach $testpid" "$test" { gdb_test_multiple "attach $testpid" "$test" {
Index: gdb-7.9.50.20150531/gdb/infrun.c
===================================================================
--- gdb-7.9.50.20150531.orig/gdb/infrun.c 2015-05-31 18:23:56.150494809 +0200
+++ gdb-7.9.50.20150531/gdb/infrun.c 2015-05-31 18:24:01.938530778 +0200
@@ -591,6 +591,11 @@ holding the child stopped. Try \"set de
target_pid_to_str (process_ptid));
}
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
+ In this point of code it cannot be 1 as we would not get FORK
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
+ We would have to first TARGET_STOP and WAITPID it as with running
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
target_detach (NULL, 0);
}

View File

@ -5,60 +5,65 @@ 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 should have been detached with SIGSTOP (as they are accidentally left running
on the debugger termination). on the debugger termination).
Index: gdb-7.9.50.20150520/gdb/defs.h diff -dup -rup gdb-7.10.50.20160106-orig/gdb/defs.h gdb-7.10.50.20160106/gdb/defs.h
=================================================================== --- gdb-7.10.50.20160106-orig/gdb/defs.h 2016-01-09 15:06:57.658172875 +0100
--- gdb-7.9.50.20150520.orig/gdb/defs.h 2015-05-31 18:06:24.579002757 +0200 +++ gdb-7.10.50.20160106/gdb/defs.h 2016-01-09 15:07:12.431264378 +0100
+++ gdb-7.9.50.20150520/gdb/defs.h 2015-05-31 18:06:29.253031613 +0200 @@ -145,6 +145,9 @@ extern void set_quit_flag (void);
@@ -145,6 +145,7 @@ extern void set_quit_flag (void);
/* Flag that function quit should call quit_force. */ /* Flag that function quit should call quit_force. */
extern volatile int sync_quit_force_run; extern volatile int sync_quit_force_run;
+#ifdef NEED_DETACH_SIGSTOP
+extern int quit_flag_cleanup; +extern int quit_flag_cleanup;
+#endif
extern int immediate_quit; extern int immediate_quit;
extern void quit (void); extern void quit (void);
Index: gdb-7.9.50.20150520/gdb/top.c diff -dup -rup gdb-7.10.50.20160106-orig/gdb/extension.c gdb-7.10.50.20160106/gdb/extension.c
=================================================================== --- gdb-7.10.50.20160106-orig/gdb/extension.c 2016-01-06 02:48:37.000000000 +0100
--- gdb-7.9.50.20150520.orig/gdb/top.c 2015-05-31 18:06:24.580002763 +0200 +++ gdb-7.10.50.20160106/gdb/extension.c 2016-01-09 15:07:12.434264396 +0100
+++ gdb-7.9.50.20150520/gdb/top.c 2015-05-31 18:06:29.254031619 +0200 @@ -833,6 +833,11 @@ check_quit_flag (void)
@@ -1463,7 +1463,9 @@ quit_force (char *args, int from_tty) 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)
diff -dup -rup gdb-7.10.50.20160106-orig/gdb/top.c gdb-7.10.50.20160106/gdb/top.c
--- gdb-7.10.50.20160106-orig/gdb/top.c 2016-01-06 02:48:38.000000000 +0100
+++ gdb-7.10.50.20160106/gdb/top.c 2016-01-09 15:07:12.432264384 +0100
@@ -1557,7 +1557,13 @@ quit_force (char *args, int from_tty)
qt.args = args; qt.args = args;
qt.from_tty = from_tty; qt.from_tty = from_tty;
- /* We want to handle any quit errors and exit regardless. */ +#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 + /* We want to handle any quit errors and exit regardless but we should never
+ get user-interrupted to properly detach the inferior. */ + get user-interrupted to properly detach the inferior. */
+ quit_flag_cleanup = 1; + quit_flag_cleanup = 1;
+#endif
/* Get out of tfind mode, and kill or detach all inferiors. */ /* Get out of tfind mode, and kill or detach all inferiors. */
TRY TRY
Index: gdb-7.9.50.20150520/gdb/utils.c diff -dup -rup gdb-7.10.50.20160106-orig/gdb/utils.c gdb-7.10.50.20160106/gdb/utils.c
=================================================================== --- gdb-7.10.50.20160106-orig/gdb/utils.c 2016-01-09 15:06:57.654172850 +0100
--- gdb-7.9.50.20150520.orig/gdb/utils.c 2015-05-31 18:06:24.582002776 +0200 +++ gdb-7.10.50.20160106/gdb/utils.c 2016-01-09 15:07:12.433264390 +0100
+++ gdb-7.9.50.20150520/gdb/utils.c 2015-05-31 18:06:29.255031625 +0200 @@ -122,6 +122,13 @@ int job_control;
@@ -122,6 +122,11 @@ int job_control;
int immediate_quit; int immediate_quit;
+#ifdef NEED_DETACH_SIGSTOP
+/* Nonzero means we are already processing the quitting cleanups and we should +/* Nonzero means we are already processing the quitting cleanups and we should
+ no longer get aborted. */ + no longer get aborted. */
+ +
+int quit_flag_cleanup; +int quit_flag_cleanup;
+ +
+#endif
/* Nonzero means that strings with character values >0x7F should be printed /* 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 as octal escapes. Zero means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */ international character, and the terminal or window can cope.) */
Index: gdb-7.9.50.20150520/gdb/extension.c
===================================================================
--- gdb-7.9.50.20150520.orig/gdb/extension.c 2015-05-31 18:06:24.582002776 +0200
+++ gdb-7.9.50.20150520/gdb/extension.c 2015-05-31 18:06:29.256031632 +0200
@@ -833,6 +833,9 @@ check_quit_flag (void)
int i, result = 0;
const struct extension_language_defn *extlang;
+ if (quit_flag_cleanup)
+ return 0;
+
ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang)
{
if (extlang->ops->check_quit_flag != NULL)

View File

@ -27,7 +27,7 @@ Version: 7.10.50.%{snapsrc}
# The release always contains a leading reserved number, start it at 1. # The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 40%{?dist} Release: 41%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers Group: Development/Debuggers
@ -878,13 +878,9 @@ find -name "*.info*"|xargs rm -f
%patch848 -p1 %patch848 -p1
%patch833 -p1 %patch833 -p1
%patch642 -p1 %patch642 -p1
%patch337 -p1 %patch337 -p1
%patch331 -p1 %patch331 -p1
%if 0%{!?rhel:1} || 0%{?rhel} > 6
%patch331 -p1 -R
%patch337 -p1 -R
%endif
%patch1044 -p1 %patch1044 -p1
%if 0%{!?rhel:1} || 0%{?rhel} > 7 %if 0%{!?rhel:1} || 0%{?rhel} > 7
%patch1044 -p1 -R %patch1044 -p1 -R
@ -954,6 +950,12 @@ CFLAGS="$CFLAGS -DGDB_INDEX_VERIFY_VENDOR"
CFLAGS="$CFLAGS -DNEED_RL_STATE_FEDORA_GDB" CFLAGS="$CFLAGS -DNEED_RL_STATE_FEDORA_GDB"
%endif %endif
# Patch337: gdb-6.8-attach-signalled-detach-stopped.patch
# Patch331: gdb-6.8-quit-never-aborts.patch
%if 0%{?rhel:1} && 0%{?rhel} <= 6
CFLAGS="$CFLAGS -DNEED_DETACH_SIGSTOP"
%endif
# --htmldir and --pdfdir are not used as they are used from %{gdb_build}. # --htmldir and --pdfdir are not used as they are used from %{gdb_build}.
../configure \ ../configure \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
@ -1396,6 +1398,10 @@ then
fi fi
%changelog %changelog
* Sat Jan 9 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.10.50.20160106-41.fc24
- Simplify .spec: Remove conditional revert of: gdb-6.8-attach-signalled-detach-stopped.patch
- Simplify .spec: Remove conditional revert of: gdb-6.8-quit-never-aborts.patch
* Sat Jan 9 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.10.50.20160106-40.fc24 * Sat Jan 9 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.10.50.20160106-40.fc24
- Merge gdb-rhel5-compat.patch into: gdb-6.8-attach-signalled-detach-stopped.patch - Merge gdb-rhel5-compat.patch into: gdb-6.8-attach-signalled-detach-stopped.patch