OLD | NEW |
1 /* Native debugging support for GNU/Linux (LWP layer). | 1 /* Native debugging support for GNU/Linux (LWP layer). |
2 | 2 |
3 Copyright (C) 2000-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2000-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
11 | 11 |
12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 |
20 #include "target.h" | 20 #include "target.h" |
21 | 21 |
22 #include <signal.h> | 22 #include <signal.h> |
23 | 23 |
| 24 struct arch_lwp_info; |
| 25 |
24 /* Ways to "resume" a thread. */ | 26 /* Ways to "resume" a thread. */ |
25 | 27 |
26 enum resume_kind | 28 enum resume_kind |
27 { | 29 { |
28 /* Thread should continue. */ | 30 /* Thread should continue. */ |
29 resume_continue, | 31 resume_continue, |
30 | 32 |
31 /* Thread should single-step. */ | 33 /* Thread should single-step. */ |
32 resume_step, | 34 resume_step, |
33 | 35 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 69 |
68 /* The last resume GDB requested on this thread. */ | 70 /* The last resume GDB requested on this thread. */ |
69 enum resume_kind last_resume_kind; | 71 enum resume_kind last_resume_kind; |
70 | 72 |
71 /* If non-zero, a pending wait status. */ | 73 /* If non-zero, a pending wait status. */ |
72 int status; | 74 int status; |
73 | 75 |
74 /* Non-zero if we were stepping this LWP. */ | 76 /* Non-zero if we were stepping this LWP. */ |
75 int step; | 77 int step; |
76 | 78 |
77 /* Non-zero si_signo if this LWP stopped with a trap. si_addr may | |
78 be the address of a hardware watchpoint. */ | |
79 struct siginfo siginfo; | |
80 | |
81 /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data | 79 /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data |
82 watchpoint trap. */ | 80 watchpoint trap. */ |
83 int stopped_by_watchpoint; | 81 int stopped_by_watchpoint; |
84 | 82 |
85 /* On architectures where it is possible to know the data address of | 83 /* On architectures where it is possible to know the data address of |
86 a triggered watchpoint, STOPPED_DATA_ADDRESS_P is non-zero, and | 84 a triggered watchpoint, STOPPED_DATA_ADDRESS_P is non-zero, and |
87 STOPPED_DATA_ADDRESS contains such data address. Otherwise, | 85 STOPPED_DATA_ADDRESS contains such data address. Otherwise, |
88 STOPPED_DATA_ADDRESS_P is false, and STOPPED_DATA_ADDRESS is | 86 STOPPED_DATA_ADDRESS_P is false, and STOPPED_DATA_ADDRESS is |
89 undefined. Only valid if STOPPED_BY_WATCHPOINT is true. */ | 87 undefined. Only valid if STOPPED_BY_WATCHPOINT is true. */ |
90 int stopped_data_address_p; | 88 int stopped_data_address_p; |
(...skipping 10 matching lines...) Expand all Loading... |
101 /* Signal wether we are in a SYSCALL_ENTRY or | 99 /* Signal wether we are in a SYSCALL_ENTRY or |
102 in a SYSCALL_RETURN event. | 100 in a SYSCALL_RETURN event. |
103 Values: | 101 Values: |
104 - TARGET_WAITKIND_SYSCALL_ENTRY | 102 - TARGET_WAITKIND_SYSCALL_ENTRY |
105 - TARGET_WAITKIND_SYSCALL_RETURN */ | 103 - TARGET_WAITKIND_SYSCALL_RETURN */ |
106 int syscall_state; | 104 int syscall_state; |
107 | 105 |
108 /* The processor core this LWP was last seen on. */ | 106 /* The processor core this LWP was last seen on. */ |
109 int core; | 107 int core; |
110 | 108 |
| 109 /* Arch-specific additions. */ |
| 110 struct arch_lwp_info *arch_private; |
| 111 |
111 /* Next LWP in list. */ | 112 /* Next LWP in list. */ |
112 struct lwp_info *next; | 113 struct lwp_info *next; |
113 }; | 114 }; |
114 | 115 |
115 /* The global list of LWPs, for ALL_LWPS. Unlike the threads list, | 116 /* The global list of LWPs, for ALL_LWPS. Unlike the threads list, |
116 there is always at least one LWP on the list while the GNU/Linux | 117 there is always at least one LWP on the list while the GNU/Linux |
117 native target is active. */ | 118 native target is active. */ |
118 extern struct lwp_info *lwp_list; | 119 extern struct lwp_info *lwp_list; |
119 | 120 |
120 /* Iterate over each active thread (light-weight process). */ | 121 /* Iterate over each active thread (light-weight process). */ |
(...skipping 17 matching lines...) Expand all Loading... |
138 | 139 |
139 /* Find process PID's pending signal set from /proc/pid/status. */ | 140 /* Find process PID's pending signal set from /proc/pid/status. */ |
140 void linux_proc_pending_signals (int pid, sigset_t *pending, | 141 void linux_proc_pending_signals (int pid, sigset_t *pending, |
141 sigset_t *blocked, sigset_t *ignored); | 142 sigset_t *blocked, sigset_t *ignored); |
142 | 143 |
143 /* linux-nat functions for handling fork events. */ | 144 /* linux-nat functions for handling fork events. */ |
144 extern void linux_enable_event_reporting (ptid_t ptid); | 145 extern void linux_enable_event_reporting (ptid_t ptid); |
145 | 146 |
146 extern int lin_lwp_attach_lwp (ptid_t ptid); | 147 extern int lin_lwp_attach_lwp (ptid_t ptid); |
147 | 148 |
| 149 extern void linux_stop_lwp (struct lwp_info *lwp); |
| 150 |
148 /* Iterator function for lin-lwp's lwp list. */ | 151 /* Iterator function for lin-lwp's lwp list. */ |
149 struct lwp_info *iterate_over_lwps (ptid_t filter, | 152 struct lwp_info *iterate_over_lwps (ptid_t filter, |
150 int (*callback) (struct lwp_info *, | 153 int (*callback) (struct lwp_info *, |
151 void *), | 154 void *), |
152 void *data); | 155 void *data); |
153 | 156 |
| 157 typedef int (*linux_nat_iterate_watchpoint_lwps_ftype) (struct lwp_info *lwp, |
| 158 void *arg); |
| 159 |
| 160 extern void linux_nat_iterate_watchpoint_lwps |
| 161 (linux_nat_iterate_watchpoint_lwps_ftype callback, void *callback_data); |
| 162 |
154 /* Create a prototype generic GNU/Linux target. The client can | 163 /* Create a prototype generic GNU/Linux target. The client can |
155 override it with local methods. */ | 164 override it with local methods. */ |
156 struct target_ops * linux_target (void); | 165 struct target_ops * linux_target (void); |
157 | 166 |
158 /* Create a generic GNU/Linux target using traditional | 167 /* Create a generic GNU/Linux target using traditional |
159 ptrace register access. */ | 168 ptrace register access. */ |
160 struct target_ops * | 169 struct target_ops * |
161 linux_trad_target (CORE_ADDR (*register_u_offset)(struct gdbarch *, int, int)); | 170 linux_trad_target (CORE_ADDR (*register_u_offset)(struct gdbarch *, int, int)); |
162 | 171 |
163 /* Register the customized GNU/Linux target. This should be used | 172 /* Register the customized GNU/Linux target. This should be used |
164 instead of calling add_target directly. */ | 173 instead of calling add_target directly. */ |
165 void linux_nat_add_target (struct target_ops *); | 174 void linux_nat_add_target (struct target_ops *); |
166 | 175 |
167 /* Register a method to call whenever a new thread is attached. */ | 176 /* Register a method to call whenever a new thread is attached. */ |
168 void linux_nat_set_new_thread (struct target_ops *, void (*) (ptid_t)); | 177 void linux_nat_set_new_thread (struct target_ops *, void (*) (struct lwp_info *)
); |
169 | 178 |
170 /* Register a method that converts a siginfo object between the layout | 179 /* Register a method that converts a siginfo object between the layout |
171 that ptrace returns, and the layout in the architecture of the | 180 that ptrace returns, and the layout in the architecture of the |
172 inferior. */ | 181 inferior. */ |
173 void linux_nat_set_siginfo_fixup (struct target_ops *, | 182 void linux_nat_set_siginfo_fixup (struct target_ops *, |
174 » » » » int (*) (struct siginfo *, | 183 » » » » int (*) (siginfo_t *, |
175 gdb_byte *, | 184 gdb_byte *, |
176 int)); | 185 int)); |
177 | 186 |
| 187 /* Register a method to call prior to resuming a thread. */ |
| 188 |
| 189 void linux_nat_set_prepare_to_resume (struct target_ops *, |
| 190 void (*) (struct lwp_info *)); |
| 191 |
178 /* Update linux-nat internal state when changing from one fork | 192 /* Update linux-nat internal state when changing from one fork |
179 to another. */ | 193 to another. */ |
180 void linux_nat_switch_fork (ptid_t new_ptid); | 194 void linux_nat_switch_fork (ptid_t new_ptid); |
181 | 195 |
182 /* Return the saved siginfo associated with PTID. */ | 196 /* Store the saved siginfo associated with PTID in *SIGINFO. |
183 struct siginfo *linux_nat_get_siginfo (ptid_t ptid); | 197 Return 1 if it was retrieved successfully, 0 otherwise (*SIGINFO is |
184 | 198 uninitialized in such case). */ |
185 /* Compute and return the processor core of a given thread. */ | 199 int linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo); |
186 int linux_nat_core_of_thread_1 (ptid_t ptid); | |
187 | 200 |
188 /* Set alternative SIGTRAP-like events recognizer. */ | 201 /* Set alternative SIGTRAP-like events recognizer. */ |
189 void linux_nat_set_status_is_event (struct target_ops *t, | 202 void linux_nat_set_status_is_event (struct target_ops *t, |
190 int (*status_is_event) (int status)); | 203 int (*status_is_event) (int status)); |
OLD | NEW |