1 http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
2 Subject: [patch 4/4]#3 Remove redundant lp->siginfo
6 this is a simplification which should not affect GDB behavior. As linux-nat
7 now stops on each received signal without any reordering of them then
8 PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in
17 2010-09-20 Jan Kratochvil <jan.kratochvil@redhat.com>
19 * linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>
20 (linux_nat_resume): Remove LP->SIGINFO clearing.
21 (save_siginfo): Remove.
22 (stop_wait_callback) <WSTOPSIG (status) != SIGSTOP>
23 (linux_nat_filter_event) <linux_nat_status_is_event (status)>: Remove
24 the save_siginfo call.
25 (resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
26 (linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
27 * linux-nat.h (struct lwp_info) <siginfo>: Remove.
29 Index: gdb-7.4.50.20111218/gdb/linux-nat.c
30 ===================================================================
31 --- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-19 02:17:05.000000000 +0100
32 +++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:43.188466854 +0100
33 @@ -1883,7 +1883,6 @@ resume_lwp (struct lwp_info *lp, int ste
34 step, TARGET_SIGNAL_0);
37 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
38 lp->stopped_by_watchpoint = 0;
41 @@ -2027,7 +2026,6 @@ linux_nat_resume (struct target_ops *ops
42 if (linux_nat_prepare_to_resume != NULL)
43 linux_nat_prepare_to_resume (lp);
44 linux_ops->to_resume (linux_ops, ptid, step, signo);
45 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
46 lp->stopped_by_watchpoint = 0;
49 @@ -2612,22 +2610,6 @@ wait_lwp (struct lwp_info *lp)
53 -/* Save the most recent siginfo for LP. This is currently only called
54 - for SIGTRAP; some ports use the si_addr field for
55 - target_stopped_data_address. In the future, it may also be used to
56 - restore the siginfo of requeued signals. */
59 -save_siginfo (struct lwp_info *lp)
62 - ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
63 - (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
66 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
69 /* Send a SIGSTOP to LP. */
72 @@ -2872,9 +2854,6 @@ stop_wait_callback (struct lwp_info *lp,
74 /* The thread was stopped with a signal other than SIGSTOP. */
76 - /* Save the trap's siginfo in case we need it later. */
82 @@ -3278,12 +3257,7 @@ linux_nat_filter_event (int lwpid, int s
85 if (linux_nat_status_is_event (status))
87 - /* Save the trap's siginfo in case we need it later. */
94 /* Check if the thread has exited. */
95 if ((WIFEXITED (status) || WIFSIGNALED (status))
96 @@ -3961,7 +3935,6 @@ resume_stopped_resumed_lwps (struct lwp_
97 linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
98 lp->step, TARGET_SIGNAL_0);
100 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
101 lp->stopped_by_watchpoint = 0;
104 @@ -6029,11 +6002,19 @@ linux_nat_set_prepare_to_resume (struct
106 linux_nat_get_siginfo (ptid_t ptid)
108 - struct lwp_info *lp = find_lwp_pid (ptid);
109 + static struct siginfo siginfo;
112 - gdb_assert (lp != NULL);
113 + pid = GET_LWP (ptid);
115 + pid = GET_PID (ptid);
118 + ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
120 + memset (&siginfo, 0, sizeof (siginfo));
122 - return &lp->siginfo;
126 /* Provide a prototype to silence -Wmissing-prototypes. */
127 Index: gdb-7.4.50.20111218/gdb/linux-nat.h
128 ===================================================================
129 --- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:40:59.000000000 +0100
130 +++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-19 02:17:21.355548276 +0100
131 @@ -77,10 +77,6 @@ struct lwp_info
132 /* The kind of stepping of this LWP. */
133 enum resume_step step;
135 - /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
136 - be the address of a hardware watchpoint. */
137 - struct siginfo siginfo;
139 /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
141 int stopped_by_watchpoint;