]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - gdb/patches/gdb-bz592031-siginfo-lost-5of5.patch
kernel: Update to 3.15.6.
[people/ms/ipfire-3.x.git] / gdb / patches / gdb-bz592031-siginfo-lost-5of5.patch
1 http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
2 Subject: [patch 4/4]#3 Remove redundant lp->siginfo
3
4 Hi,
5
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
9 advance.
10
11
12 Thanks,
13 Jan
14
15
16 gdb/
17 2010-09-20 Jan Kratochvil <jan.kratochvil@redhat.com>
18
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.
28
29 Index: gdb-7.2.50.20101116/gdb/linux-nat.c
30 ===================================================================
31 --- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 09:12:26.000000000 +0100
32 +++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 09:13:21.000000000 +0100
33 @@ -1850,7 +1850,6 @@ resume_callback (struct lwp_info *lp, vo
34 target_pid_to_str (lp->ptid));
35 lp->stopped = 0;
36 lp->step = 0;
37 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
38 lp->stopped_by_watchpoint = 0;
39 }
40 else if (lp->stopped && debug_linux_nat)
41 @@ -1993,7 +1992,6 @@ linux_nat_resume (struct target_ops *ops
42 ptid = pid_to_ptid (GET_LWP (lp->ptid));
43
44 linux_ops->to_resume (linux_ops, ptid, step, signo);
45 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
46 lp->stopped_by_watchpoint = 0;
47
48 if (debug_linux_nat)
49 @@ -2503,22 +2501,6 @@ wait_lwp (struct lwp_info *lp)
50 return status;
51 }
52
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. */
57 -
58 -static void
59 -save_siginfo (struct lwp_info *lp)
60 -{
61 - errno = 0;
62 - ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
63 - (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
64 -
65 - if (errno != 0)
66 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
67 -}
68 -
69 /* Send a SIGSTOP to LP. */
70
71 static int
72 @@ -2787,9 +2769,6 @@ stop_wait_callback (struct lwp_info *lp,
73 {
74 /* The thread was stopped with a signal other than SIGSTOP. */
75
76 - /* Save the trap's siginfo in case we need it later. */
77 - save_siginfo (lp);
78 -
79 save_sigtrap (lp);
80
81 if (debug_linux_nat)
82 @@ -3155,12 +3134,7 @@ linux_nat_filter_event (int lwpid, int s
83 }
84
85 if (linux_nat_status_is_event (status))
86 - {
87 - /* Save the trap's siginfo in case we need it later. */
88 - save_siginfo (lp);
89 -
90 - save_sigtrap (lp);
91 - }
92 + save_sigtrap (lp);
93
94 /* Check if the thread has exited. */
95 if ((WIFEXITED (status) || WIFSIGNALED (status))
96 @@ -3763,7 +3737,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);
99 lp->stopped = 0;
100 - memset (&lp->siginfo, 0, sizeof (lp->siginfo));
101 lp->stopped_by_watchpoint = 0;
102 }
103
104 @@ -5932,11 +5905,19 @@ linux_nat_set_siginfo_fixup (struct targ
105 struct siginfo *
106 linux_nat_get_siginfo (ptid_t ptid)
107 {
108 - struct lwp_info *lp = find_lwp_pid (ptid);
109 + static struct siginfo siginfo;
110 + int pid;
111
112 - gdb_assert (lp != NULL);
113 + pid = GET_LWP (ptid);
114 + if (pid == 0)
115 + pid = GET_PID (ptid);
116 +
117 + errno = 0;
118 + ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
119 + if (errno != 0)
120 + memset (&siginfo, 0, sizeof (siginfo));
121
122 - return &lp->siginfo;
123 + return &siginfo;
124 }
125
126 /* Provide a prototype to silence -Wmissing-prototypes. */
127 Index: gdb-7.2.50.20101116/gdb/linux-nat.h
128 ===================================================================
129 --- gdb-7.2.50.20101116.orig/gdb/linux-nat.h 2010-11-16 07:54:36.000000000 +0100
130 +++ gdb-7.2.50.20101116/gdb/linux-nat.h 2010-11-16 09:12:44.000000000 +0100
131 @@ -58,10 +58,6 @@ struct lwp_info
132 /* The kind of stepping of this LWP. */
133 enum resume_step step;
134
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;
138 -
139 /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
140 watchpoint trap. */
141 int stopped_by_watchpoint;