2010-11-16 04:54:18 +00:00
|
|
|
http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
|
|
|
|
Subject: [patch 4/4]#3 Remove redundant lp->siginfo
|
|
|
|
|
|
|
|
Hi,
|
|
|
|
|
|
|
|
this is a simplification which should not affect GDB behavior. As linux-nat
|
|
|
|
now stops on each received signal without any reordering of them then
|
|
|
|
PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in
|
|
|
|
advance.
|
|
|
|
|
|
|
|
|
|
|
|
Thanks,
|
|
|
|
Jan
|
|
|
|
|
|
|
|
|
|
|
|
gdb/
|
|
|
|
2010-09-20 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
* linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>
|
|
|
|
(linux_nat_resume): Remove LP->SIGINFO clearing.
|
|
|
|
(save_siginfo): Remove.
|
|
|
|
(stop_wait_callback) <WSTOPSIG (status) != SIGSTOP>
|
|
|
|
(linux_nat_filter_event) <linux_nat_status_is_event (status)>: Remove
|
|
|
|
the save_siginfo call.
|
|
|
|
(resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
|
|
|
|
(linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
|
|
|
|
* linux-nat.h (struct lwp_info) <siginfo>: Remove.
|
|
|
|
|
2012-06-03 17:40:44 +00:00
|
|
|
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
|
2010-11-16 04:54:18 +00:00
|
|
|
===================================================================
|
2012-06-03 17:40:44 +00:00
|
|
|
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:36:21.067483466 +0200
|
|
|
|
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:37:55.345447402 +0200
|
|
|
|
@@ -1929,7 +1929,6 @@ resume_lwp (struct lwp_info *lp, int ste
|
|
|
|
step, GDB_SIGNAL_0);
|
2012-01-03 15:00:12 +00:00
|
|
|
lp->stopped = 0;
|
|
|
|
lp->step = step;
|
|
|
|
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
|
|
|
|
lp->stopped_by_watchpoint = 0;
|
|
|
|
}
|
|
|
|
else
|
2012-06-03 17:40:44 +00:00
|
|
|
@@ -2071,7 +2070,6 @@ linux_nat_resume (struct target_ops *ops
|
2012-01-03 15:00:12 +00:00
|
|
|
if (linux_nat_prepare_to_resume != NULL)
|
|
|
|
linux_nat_prepare_to_resume (lp);
|
2010-11-16 04:54:18 +00:00
|
|
|
linux_ops->to_resume (linux_ops, ptid, step, signo);
|
|
|
|
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
|
|
|
|
lp->stopped_by_watchpoint = 0;
|
|
|
|
|
|
|
|
if (debug_linux_nat)
|
2012-06-03 17:40:44 +00:00
|
|
|
@@ -2625,22 +2623,6 @@ wait_lwp (struct lwp_info *lp)
|
2010-11-16 04:54:18 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
-/* Save the most recent siginfo for LP. This is currently only called
|
|
|
|
- for SIGTRAP; some ports use the si_addr field for
|
|
|
|
- target_stopped_data_address. In the future, it may also be used to
|
|
|
|
- restore the siginfo of requeued signals. */
|
|
|
|
-
|
|
|
|
-static void
|
|
|
|
-save_siginfo (struct lwp_info *lp)
|
|
|
|
-{
|
|
|
|
- errno = 0;
|
|
|
|
- ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
|
|
|
|
- (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
|
|
|
|
-
|
|
|
|
- if (errno != 0)
|
|
|
|
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/* Send a SIGSTOP to LP. */
|
|
|
|
|
|
|
|
static int
|
2012-06-03 17:40:44 +00:00
|
|
|
@@ -2885,9 +2867,6 @@ stop_wait_callback (struct lwp_info *lp,
|
2010-11-16 04:54:18 +00:00
|
|
|
{
|
|
|
|
/* The thread was stopped with a signal other than SIGSTOP. */
|
|
|
|
|
|
|
|
- /* Save the trap's siginfo in case we need it later. */
|
|
|
|
- save_siginfo (lp);
|
|
|
|
-
|
|
|
|
save_sigtrap (lp);
|
|
|
|
|
|
|
|
if (debug_linux_nat)
|
2012-06-03 17:40:44 +00:00
|
|
|
@@ -3291,12 +3270,7 @@ linux_nat_filter_event (int lwpid, int s
|
2010-11-16 04:54:18 +00:00
|
|
|
}
|
|
|
|
|
2010-11-17 02:58:16 +00:00
|
|
|
if (linux_nat_status_is_event (status))
|
2010-11-16 04:54:18 +00:00
|
|
|
- {
|
|
|
|
- /* Save the trap's siginfo in case we need it later. */
|
|
|
|
- save_siginfo (lp);
|
|
|
|
-
|
|
|
|
- save_sigtrap (lp);
|
|
|
|
- }
|
|
|
|
+ save_sigtrap (lp);
|
|
|
|
|
|
|
|
/* Check if the thread has exited. */
|
|
|
|
if ((WIFEXITED (status) || WIFSIGNALED (status))
|
2012-06-03 17:40:44 +00:00
|
|
|
@@ -3950,7 +3924,6 @@ resume_stopped_resumed_lwps (struct lwp_
|
2010-11-16 04:54:18 +00:00
|
|
|
linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
|
2012-06-03 17:40:44 +00:00
|
|
|
lp->step, GDB_SIGNAL_0);
|
2010-11-16 04:54:18 +00:00
|
|
|
lp->stopped = 0;
|
|
|
|
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
|
|
|
|
lp->stopped_by_watchpoint = 0;
|
|
|
|
}
|
|
|
|
|
2012-06-03 17:40:44 +00:00
|
|
|
@@ -5227,11 +5200,19 @@ linux_nat_set_prepare_to_resume (struct
|
|
|
|
siginfo_t *
|
2010-11-16 04:54:18 +00:00
|
|
|
linux_nat_get_siginfo (ptid_t ptid)
|
|
|
|
{
|
|
|
|
- struct lwp_info *lp = find_lwp_pid (ptid);
|
2012-06-03 17:40:44 +00:00
|
|
|
+ static siginfo_t siginfo;
|
2010-11-16 04:54:18 +00:00
|
|
|
+ int pid;
|
|
|
|
|
|
|
|
- gdb_assert (lp != NULL);
|
|
|
|
+ pid = GET_LWP (ptid);
|
|
|
|
+ if (pid == 0)
|
|
|
|
+ pid = GET_PID (ptid);
|
|
|
|
+
|
|
|
|
+ errno = 0;
|
|
|
|
+ ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
|
|
|
|
+ if (errno != 0)
|
|
|
|
+ memset (&siginfo, 0, sizeof (siginfo));
|
|
|
|
|
|
|
|
- return &lp->siginfo;
|
|
|
|
+ return &siginfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
2012-06-03 17:40:44 +00:00
|
|
|
Index: gdb-7.4.50.20120602/gdb/linux-nat.h
|
2010-11-16 04:54:18 +00:00
|
|
|
===================================================================
|
2012-06-03 17:40:44 +00:00
|
|
|
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-06-02 21:36:21.067483466 +0200
|
|
|
|
+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 21:36:27.140481144 +0200
|
|
|
|
@@ -76,10 +76,6 @@ struct lwp_info
|
2010-11-16 04:54:18 +00:00
|
|
|
/* The kind of stepping of this LWP. */
|
|
|
|
enum resume_step step;
|
|
|
|
|
|
|
|
- /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
|
|
|
|
- be the address of a hardware watchpoint. */
|
2012-06-03 17:40:44 +00:00
|
|
|
- siginfo_t siginfo;
|
2010-11-16 04:54:18 +00:00
|
|
|
-
|
|
|
|
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
|
|
|
|
watchpoint trap. */
|
|
|
|
int stopped_by_watchpoint;
|