Commit | Line | Data |
---|---|---|
ce3a066d | 1 | /* Target operations for the remote server for GDB. |
32d0add0 | 2 | Copyright (C) 2002-2015 Free Software Foundation, Inc. |
ce3a066d DJ |
3 | |
4 | Contributed by MontaVista Software. | |
5 | ||
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 10 | the Free Software Foundation; either version 3 of the License, or |
ce3a066d DJ |
11 | (at your option) any later version. |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
ce3a066d DJ |
20 | |
21 | #ifndef TARGET_H | |
22 | #define TARGET_H | |
23 | ||
721ec300 | 24 | #include "target/target.h" |
33b60d58 LM |
25 | #include "target/resume.h" |
26 | #include "target/wait.h" | |
27 | #include "target/waitstatus.h" | |
802e8e6d | 28 | #include "mem-break.h" |
043c3577 | 29 | #include "btrace-common.h" |
3360c0bf | 30 | |
6a271cae | 31 | struct emit_ops; |
9accd112 | 32 | struct buffer; |
6a6bbd9d | 33 | struct process_info; |
6a271cae | 34 | |
2bd7c093 PA |
35 | /* This structure describes how to resume a particular thread (or all |
36 | threads) based on the client's request. If thread is -1, then this | |
37 | entry applies to all threads. These are passed around as an | |
38 | array. */ | |
64386c31 DJ |
39 | |
40 | struct thread_resume | |
41 | { | |
95954743 | 42 | ptid_t thread; |
64386c31 | 43 | |
bd99dc85 PA |
44 | /* How to "resume". */ |
45 | enum resume_kind kind; | |
64386c31 | 46 | |
bd99dc85 PA |
47 | /* If non-zero, send this signal when we resume, or to stop the |
48 | thread. If stopping a thread, and this is 0, the target should | |
49 | stop the thread however it best decides to (e.g., SIGSTOP on | |
30d50328 | 50 | linux; SuspendThread on win32). This is a host signal value (not |
2ea28649 | 51 | enum gdb_signal). */ |
64386c31 | 52 | int sig; |
c2d6af84 PA |
53 | |
54 | /* Range to single step within. Valid only iff KIND is resume_step. | |
55 | ||
56 | Single-step once, and then continuing stepping as long as the | |
57 | thread stops in this range. (If the range is empty | |
58 | [STEP_RANGE_START == STEP_RANGE_END], then this is a single-step | |
59 | request.) */ | |
60 | CORE_ADDR step_range_start; /* Inclusive */ | |
61 | CORE_ADDR step_range_end; /* Exclusive */ | |
64386c31 DJ |
62 | }; |
63 | ||
ce3a066d DJ |
64 | struct target_ops |
65 | { | |
66 | /* Start a new process. | |
67 | ||
68 | PROGRAM is a path to the program to execute. | |
69 | ARGS is a standard NULL-terminated array of arguments, | |
70 | to be passed to the inferior as ``argv''. | |
71 | ||
a9fa9f7d | 72 | Returns the new PID on success, -1 on failure. Registers the new |
ce3a066d DJ |
73 | process with the process list. */ |
74 | ||
75 | int (*create_inferior) (char *program, char **args); | |
76 | ||
77 | /* Attach to a running process. | |
78 | ||
79 | PID is the process ID to attach to, specified by the user | |
1d5315fe PA |
80 | or a higher layer. |
81 | ||
82 | Returns -1 if attaching is unsupported, 0 on success, and calls | |
83 | error() otherwise. */ | |
ce3a066d | 84 | |
a1928bad | 85 | int (*attach) (unsigned long pid); |
ce3a066d | 86 | |
95954743 | 87 | /* Kill inferior PID. Return -1 on failure, and 0 on success. */ |
ce3a066d | 88 | |
95954743 | 89 | int (*kill) (int pid); |
ce3a066d | 90 | |
95954743 PA |
91 | /* Detach from inferior PID. Return -1 on failure, and 0 on |
92 | success. */ | |
6ad8ae5c | 93 | |
95954743 | 94 | int (*detach) (int pid); |
444d6139 | 95 | |
8336d594 PA |
96 | /* The inferior process has died. Do what is right. */ |
97 | ||
98 | void (*mourn) (struct process_info *proc); | |
99 | ||
95954743 PA |
100 | /* Wait for inferior PID to exit. */ |
101 | void (*join) (int pid); | |
6ad8ae5c | 102 | |
ce3a066d DJ |
103 | /* Return 1 iff the thread with process ID PID is alive. */ |
104 | ||
95954743 | 105 | int (*thread_alive) (ptid_t pid); |
ce3a066d | 106 | |
64386c31 | 107 | /* Resume the inferior process. */ |
ce3a066d | 108 | |
2bd7c093 | 109 | void (*resume) (struct thread_resume *resume_info, size_t n); |
ce3a066d | 110 | |
5b1c542e | 111 | /* Wait for the inferior process or thread to change state. Store |
95954743 PA |
112 | status through argument pointer STATUS. |
113 | ||
114 | PTID = -1 to wait for any pid to do something, PTID(pid,0,0) to | |
115 | wait for any thread of process pid to do something. Return ptid | |
116 | of child, or -1 in case of error; store status through argument | |
117 | pointer STATUS. OPTIONS is a bit set of options defined as | |
118 | TARGET_W* above. If options contains TARGET_WNOHANG and there's | |
119 | no child stop to report, return is | |
120 | null_ptid/TARGET_WAITKIND_IGNORE. */ | |
ce3a066d | 121 | |
95954743 | 122 | ptid_t (*wait) (ptid_t ptid, struct target_waitstatus *status, int options); |
ce3a066d DJ |
123 | |
124 | /* Fetch registers from the inferior process. | |
125 | ||
126 | If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO. */ | |
127 | ||
442ea881 | 128 | void (*fetch_registers) (struct regcache *regcache, int regno); |
aa691b87 | 129 | |
ce3a066d DJ |
130 | /* Store registers to the inferior process. |
131 | ||
132 | If REGNO is -1, store all registers; otherwise, store at least REGNO. */ | |
133 | ||
442ea881 | 134 | void (*store_registers) (struct regcache *regcache, int regno); |
ce3a066d | 135 | |
90d74c30 PA |
136 | /* Prepare to read or write memory from the inferior process. |
137 | Targets use this to do what is necessary to get the state of the | |
138 | inferior such that it is possible to access memory. | |
139 | ||
140 | This should generally only be called from client facing routines, | |
802e8e6d PA |
141 | such as gdb_read_memory/gdb_write_memory, or the GDB breakpoint |
142 | insertion routine. | |
90d74c30 PA |
143 | |
144 | Like `read_memory' and `write_memory' below, returns 0 on success | |
145 | and errno on failure. */ | |
146 | ||
147 | int (*prepare_to_access_memory) (void); | |
148 | ||
149 | /* Undo the effects of prepare_to_access_memory. */ | |
150 | ||
0146f85b | 151 | void (*done_accessing_memory) (void); |
90d74c30 | 152 | |
611cb4a5 DJ |
153 | /* Read memory from the inferior process. This should generally be |
154 | called through read_inferior_memory, which handles breakpoint shadowing. | |
ce3a066d | 155 | |
c3e735a6 DJ |
156 | Read LEN bytes at MEMADDR into a buffer at MYADDR. |
157 | ||
158 | Returns 0 on success and errno on failure. */ | |
ce3a066d | 159 | |
f450004a | 160 | int (*read_memory) (CORE_ADDR memaddr, unsigned char *myaddr, int len); |
ce3a066d | 161 | |
611cb4a5 DJ |
162 | /* Write memory to the inferior process. This should generally be |
163 | called through write_inferior_memory, which handles breakpoint shadowing. | |
ce3a066d DJ |
164 | |
165 | Write LEN bytes from the buffer at MYADDR to MEMADDR. | |
166 | ||
167 | Returns 0 on success and errno on failure. */ | |
168 | ||
f450004a DJ |
169 | int (*write_memory) (CORE_ADDR memaddr, const unsigned char *myaddr, |
170 | int len); | |
2f2893d9 DJ |
171 | |
172 | /* Query GDB for the values of any symbols we're interested in. | |
173 | This function is called whenever we receive a "qSymbols::" | |
174 | query, which corresponds to every time more symbols (might) | |
611cb4a5 DJ |
175 | become available. NULL if we aren't interested in any |
176 | symbols. */ | |
2f2893d9 DJ |
177 | |
178 | void (*look_up_symbols) (void); | |
e5379b03 | 179 | |
ef57601b PA |
180 | /* Send an interrupt request to the inferior process, |
181 | however is appropriate. */ | |
182 | ||
183 | void (*request_interrupt) (void); | |
aa691b87 RM |
184 | |
185 | /* Read auxiliary vector data from the inferior process. | |
186 | ||
187 | Read LEN bytes at OFFSET into a buffer at MYADDR. */ | |
188 | ||
f450004a DJ |
189 | int (*read_auxv) (CORE_ADDR offset, unsigned char *myaddr, |
190 | unsigned int len); | |
e013ee27 | 191 | |
802e8e6d PA |
192 | /* Returns true if GDB Z breakpoint type TYPE is supported, false |
193 | otherwise. The type is coded as follows: | |
c6314022 AR |
194 | '0' - software-breakpoint |
195 | '1' - hardware-breakpoint | |
196 | '2' - write watchpoint | |
197 | '3' - read watchpoint | |
802e8e6d PA |
198 | '4' - access watchpoint |
199 | */ | |
200 | int (*supports_z_point_type) (char z_type); | |
201 | ||
202 | /* Insert and remove a break or watchpoint. | |
203 | Returns 0 on success, -1 on failure and 1 on unsupported. */ | |
e013ee27 | 204 | |
802e8e6d PA |
205 | int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr, |
206 | int size, struct raw_breakpoint *bp); | |
207 | int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr, | |
208 | int size, struct raw_breakpoint *bp); | |
e013ee27 | 209 | |
1ec68e26 PA |
210 | /* Returns 1 if the target stopped because it executed a software |
211 | breakpoint instruction, 0 otherwise. */ | |
212 | int (*stopped_by_sw_breakpoint) (void); | |
213 | ||
214 | /* Returns true if the target knows whether a trap was caused by a | |
215 | SW breakpoint triggering. */ | |
216 | int (*supports_stopped_by_sw_breakpoint) (void); | |
217 | ||
218 | /* Returns 1 if the target stopped for a hardware breakpoint. */ | |
219 | int (*stopped_by_hw_breakpoint) (void); | |
220 | ||
221 | /* Returns true if the target knows whether a trap was caused by a | |
222 | HW breakpoint triggering. */ | |
223 | int (*supports_stopped_by_hw_breakpoint) (void); | |
224 | ||
45614f15 YQ |
225 | /* Returns true if the target can evaluate conditions of |
226 | breakpoints. */ | |
227 | int (*supports_conditional_breakpoints) (void); | |
228 | ||
e013ee27 OF |
229 | /* Returns 1 if target was stopped due to a watchpoint hit, 0 otherwise. */ |
230 | ||
231 | int (*stopped_by_watchpoint) (void); | |
232 | ||
1b3f6016 | 233 | /* Returns the address associated with the watchpoint that hit, if any; |
e013ee27 OF |
234 | returns 0 otherwise. */ |
235 | ||
236 | CORE_ADDR (*stopped_data_address) (void); | |
237 | ||
52fb6437 NS |
238 | /* Reports the text, data offsets of the executable. This is |
239 | needed for uclinux where the executable is relocated during load | |
240 | time. */ | |
1b3f6016 | 241 | |
52fb6437 | 242 | int (*read_offsets) (CORE_ADDR *text, CORE_ADDR *data); |
dae5f5cf DJ |
243 | |
244 | /* Fetch the address associated with a specific thread local storage | |
245 | area, determined by the specified THREAD, OFFSET, and LOAD_MODULE. | |
246 | Stores it in *ADDRESS and returns zero on success; otherwise returns | |
247 | an error code. A return value of -1 means this system does not | |
248 | support the operation. */ | |
249 | ||
250 | int (*get_tls_address) (struct thread_info *thread, CORE_ADDR offset, | |
251 | CORE_ADDR load_module, CORE_ADDR *address); | |
23181151 | 252 | |
0e7f50da UW |
253 | /* Read/Write from/to spufs using qXfer packets. */ |
254 | int (*qxfer_spu) (const char *annex, unsigned char *readbuf, | |
255 | unsigned const char *writebuf, CORE_ADDR offset, int len); | |
59a016f0 PA |
256 | |
257 | /* Fill BUF with an hostio error packet representing the last hostio | |
258 | error. */ | |
259 | void (*hostio_last_error) (char *buf); | |
07e059b5 VP |
260 | |
261 | /* Read/Write OS data using qXfer packets. */ | |
262 | int (*qxfer_osdata) (const char *annex, unsigned char *readbuf, | |
1b3f6016 | 263 | unsigned const char *writebuf, CORE_ADDR offset, |
07e059b5 | 264 | int len); |
4aa995e1 PA |
265 | |
266 | /* Read/Write extra signal info. */ | |
267 | int (*qxfer_siginfo) (const char *annex, unsigned char *readbuf, | |
268 | unsigned const char *writebuf, | |
269 | CORE_ADDR offset, int len); | |
bd99dc85 PA |
270 | |
271 | int (*supports_non_stop) (void); | |
272 | ||
273 | /* Enables async target events. Returns the previous enable | |
274 | state. */ | |
275 | int (*async) (int enable); | |
276 | ||
277 | /* Switch to non-stop (1) or all-stop (0) mode. Return 0 on | |
278 | success, -1 otherwise. */ | |
279 | int (*start_non_stop) (int); | |
cf8fd78b PA |
280 | |
281 | /* Returns true if the target supports multi-process debugging. */ | |
282 | int (*supports_multi_process) (void); | |
cdbfd419 | 283 | |
89245bc0 DB |
284 | /* Returns true if fork events are supported. */ |
285 | int (*supports_fork_events) (void); | |
286 | ||
287 | /* Returns true if vfork events are supported. */ | |
288 | int (*supports_vfork_events) (void); | |
289 | ||
de0d863e DB |
290 | /* Allows target to re-initialize connection-specific settings. */ |
291 | void (*handle_new_gdb_connection) (void); | |
292 | ||
cdbfd419 PP |
293 | /* If not NULL, target-specific routine to process monitor command. |
294 | Returns 1 if handled, or 0 to perform default processing. */ | |
295 | int (*handle_monitor_command) (char *); | |
dc146f7c VP |
296 | |
297 | /* Returns the core given a thread, or -1 if not known. */ | |
298 | int (*core_of_thread) (ptid_t); | |
1570b33e | 299 | |
78d85199 YQ |
300 | /* Read loadmaps. Read LEN bytes at OFFSET into a buffer at MYADDR. */ |
301 | int (*read_loadmap) (const char *annex, CORE_ADDR offset, | |
881127c9 | 302 | unsigned char *myaddr, unsigned int len); |
78d85199 | 303 | |
1570b33e L |
304 | /* Target specific qSupported support. */ |
305 | void (*process_qsupported) (const char *); | |
219f2f23 PA |
306 | |
307 | /* Return 1 if the target supports tracepoints, 0 (or leave the | |
308 | callback NULL) otherwise. */ | |
309 | int (*supports_tracepoints) (void); | |
310 | ||
311 | /* Read PC from REGCACHE. */ | |
312 | CORE_ADDR (*read_pc) (struct regcache *regcache); | |
313 | ||
314 | /* Write PC to REGCACHE. */ | |
315 | void (*write_pc) (struct regcache *regcache, CORE_ADDR pc); | |
8336d594 PA |
316 | |
317 | /* Return true if THREAD is known to be stopped now. */ | |
318 | int (*thread_stopped) (struct thread_info *thread); | |
319 | ||
711e434b PM |
320 | /* Read Thread Information Block address. */ |
321 | int (*get_tib_address) (ptid_t ptid, CORE_ADDR *address); | |
7984d532 | 322 | |
609086b1 | 323 | /* Pause all threads. If FREEZE, arrange for any resume attempt to |
7984d532 PA |
324 | be ignored until an unpause_all call unfreezes threads again. |
325 | There can be nested calls to pause_all, so a freeze counter | |
326 | should be maintained. */ | |
327 | void (*pause_all) (int freeze); | |
328 | ||
329 | /* Unpause all threads. Threads that hadn't been resumed by the | |
330 | client should be left stopped. Basically a pause/unpause call | |
331 | pair should not end up resuming threads that were stopped before | |
332 | the pause call. */ | |
333 | void (*unpause_all) (int unfreeze); | |
334 | ||
fa593d66 PA |
335 | /* Stabilize all threads. That is, force them out of jump pads. */ |
336 | void (*stabilize_threads) (void); | |
337 | ||
338 | /* Install a fast tracepoint jump pad. TPOINT is the address of the | |
339 | tracepoint internal object as used by the IPA agent. TPADDR is | |
340 | the address of tracepoint. COLLECTOR is address of the function | |
341 | the jump pad redirects to. LOCKADDR is the address of the jump | |
342 | pad lock object. ORIG_SIZE is the size in bytes of the | |
343 | instruction at TPADDR. JUMP_ENTRY points to the address of the | |
344 | jump pad entry, and on return holds the address past the end of | |
405f8e94 SS |
345 | the created jump pad. If a trampoline is created by the function, |
346 | then TRAMPOLINE and TRAMPOLINE_SIZE return the address and size of | |
347 | the trampoline, else they remain unchanged. JJUMP_PAD_INSN is a | |
348 | buffer containing a copy of the instruction at TPADDR. | |
349 | ADJUST_INSN_ADDR and ADJUST_INSN_ADDR_END are output parameters that | |
350 | return the address range where the instruction at TPADDR was relocated | |
351 | to. If an error occurs, the ERR may be used to pass on an error | |
352 | message. */ | |
fa593d66 PA |
353 | int (*install_fast_tracepoint_jump_pad) (CORE_ADDR tpoint, CORE_ADDR tpaddr, |
354 | CORE_ADDR collector, | |
355 | CORE_ADDR lockaddr, | |
356 | ULONGEST orig_size, | |
357 | CORE_ADDR *jump_entry, | |
405f8e94 SS |
358 | CORE_ADDR *trampoline, |
359 | ULONGEST *trampoline_size, | |
fa593d66 PA |
360 | unsigned char *jjump_pad_insn, |
361 | ULONGEST *jjump_pad_insn_size, | |
362 | CORE_ADDR *adjusted_insn_addr, | |
405f8e94 SS |
363 | CORE_ADDR *adjusted_insn_addr_end, |
364 | char *err); | |
6a271cae PA |
365 | |
366 | /* Return the bytecode operations vector for the current inferior. | |
367 | Returns NULL if bytecode compilation is not supported. */ | |
368 | struct emit_ops *(*emit_ops) (void); | |
03583c20 UW |
369 | |
370 | /* Returns true if the target supports disabling randomization. */ | |
371 | int (*supports_disable_randomization) (void); | |
405f8e94 SS |
372 | |
373 | /* Return the minimum length of an instruction that can be safely overwritten | |
374 | for use as a fast tracepoint. */ | |
375 | int (*get_min_fast_tracepoint_insn_len) (void); | |
2268b414 JK |
376 | |
377 | /* Read solib info on SVR4 platforms. */ | |
378 | int (*qxfer_libraries_svr4) (const char *annex, unsigned char *readbuf, | |
379 | unsigned const char *writebuf, | |
380 | CORE_ADDR offset, int len); | |
d1feda86 YQ |
381 | |
382 | /* Return true if target supports debugging agent. */ | |
383 | int (*supports_agent) (void); | |
9accd112 MM |
384 | |
385 | /* Check whether the target supports branch tracing. */ | |
043c3577 | 386 | int (*supports_btrace) (struct target_ops *, enum btrace_format); |
9accd112 | 387 | |
f4abbc16 MM |
388 | /* Enable branch tracing for PTID based on CONF and allocate a branch trace |
389 | target information struct for reading and for disabling branch trace. */ | |
390 | struct btrace_target_info *(*enable_btrace) | |
391 | (ptid_t ptid, const struct btrace_config *conf); | |
9accd112 | 392 | |
969c39fb MM |
393 | /* Disable branch tracing. |
394 | Returns zero on success, non-zero otherwise. */ | |
9accd112 MM |
395 | int (*disable_btrace) (struct btrace_target_info *tinfo); |
396 | ||
397 | /* Read branch trace data into buffer. We use an int to specify the type | |
969c39fb MM |
398 | to break a cyclic dependency. |
399 | Return 0 on success; print an error message into BUFFER and return -1, | |
400 | otherwise. */ | |
401 | int (*read_btrace) (struct btrace_target_info *, struct buffer *, int type); | |
9accd112 | 402 | |
f4abbc16 MM |
403 | /* Read the branch trace configuration into BUFFER. |
404 | Return 0 on success; print an error message into BUFFER and return -1 | |
405 | otherwise. */ | |
406 | int (*read_btrace_conf) (const struct btrace_target_info *, struct buffer *); | |
407 | ||
c2d6af84 PA |
408 | /* Return true if target supports range stepping. */ |
409 | int (*supports_range_stepping) (void); | |
e57f1de3 GB |
410 | |
411 | /* Return the full absolute name of the executable file that was | |
412 | run to create the process PID. If the executable file cannot | |
413 | be determined, NULL is returned. Otherwise, a pointer to a | |
414 | character string containing the pathname is returned. This | |
415 | string should be copied into a buffer by the client if the string | |
416 | will not be immediately used, or if it must persist. */ | |
417 | char *(*pid_to_exec_file) (int pid); | |
ce3a066d DJ |
418 | }; |
419 | ||
420 | extern struct target_ops *the_target; | |
421 | ||
422 | void set_target_ops (struct target_ops *); | |
423 | ||
424 | #define create_inferior(program, args) \ | |
425 | (*the_target->create_inferior) (program, args) | |
426 | ||
427 | #define myattach(pid) \ | |
428 | (*the_target->attach) (pid) | |
429 | ||
7255706c | 430 | int kill_inferior (int); |
ce3a066d | 431 | |
89245bc0 DB |
432 | #define target_supports_fork_events() \ |
433 | (the_target->supports_fork_events ? \ | |
434 | (*the_target->supports_fork_events) () : 0) | |
435 | ||
436 | #define target_supports_vfork_events() \ | |
437 | (the_target->supports_vfork_events ? \ | |
438 | (*the_target->supports_vfork_events) () : 0) | |
439 | ||
de0d863e DB |
440 | #define target_handle_new_gdb_connection() \ |
441 | (the_target->handle_new_gdb_connection ? \ | |
442 | (*the_target->handle_new_gdb_connection) () : 0) | |
443 | ||
95954743 PA |
444 | #define detach_inferior(pid) \ |
445 | (*the_target->detach) (pid) | |
6ad8ae5c | 446 | |
8336d594 PA |
447 | #define mourn_inferior(PROC) \ |
448 | (*the_target->mourn) (PROC) | |
449 | ||
ce3a066d DJ |
450 | #define mythread_alive(pid) \ |
451 | (*the_target->thread_alive) (pid) | |
452 | ||
442ea881 PA |
453 | #define fetch_inferior_registers(regcache, regno) \ |
454 | (*the_target->fetch_registers) (regcache, regno) | |
ce3a066d | 455 | |
442ea881 PA |
456 | #define store_inferior_registers(regcache, regno) \ |
457 | (*the_target->store_registers) (regcache, regno) | |
ce3a066d | 458 | |
95954743 PA |
459 | #define join_inferior(pid) \ |
460 | (*the_target->join) (pid) | |
444d6139 | 461 | |
bd99dc85 PA |
462 | #define target_supports_non_stop() \ |
463 | (the_target->supports_non_stop ? (*the_target->supports_non_stop ) () : 0) | |
464 | ||
465 | #define target_async(enable) \ | |
466 | (the_target->async ? (*the_target->async) (enable) : 0) | |
467 | ||
cf8fd78b PA |
468 | #define target_supports_multi_process() \ |
469 | (the_target->supports_multi_process ? \ | |
470 | (*the_target->supports_multi_process) () : 0) | |
471 | ||
8336d594 PA |
472 | #define target_process_qsupported(query) \ |
473 | do \ | |
474 | { \ | |
475 | if (the_target->process_qsupported) \ | |
476 | the_target->process_qsupported (query); \ | |
477 | } while (0) | |
1570b33e | 478 | |
219f2f23 PA |
479 | #define target_supports_tracepoints() \ |
480 | (the_target->supports_tracepoints \ | |
481 | ? (*the_target->supports_tracepoints) () : 0) | |
482 | ||
fa593d66 PA |
483 | #define target_supports_fast_tracepoints() \ |
484 | (the_target->install_fast_tracepoint_jump_pad != NULL) | |
485 | ||
405f8e94 SS |
486 | #define target_get_min_fast_tracepoint_insn_len() \ |
487 | (the_target->get_min_fast_tracepoint_insn_len \ | |
488 | ? (*the_target->get_min_fast_tracepoint_insn_len) () : 0) | |
489 | ||
8336d594 PA |
490 | #define thread_stopped(thread) \ |
491 | (*the_target->thread_stopped) (thread) | |
492 | ||
7984d532 PA |
493 | #define pause_all(freeze) \ |
494 | do \ | |
495 | { \ | |
496 | if (the_target->pause_all) \ | |
497 | (*the_target->pause_all) (freeze); \ | |
498 | } while (0) | |
499 | ||
500 | #define unpause_all(unfreeze) \ | |
501 | do \ | |
502 | { \ | |
503 | if (the_target->unpause_all) \ | |
504 | (*the_target->unpause_all) (unfreeze); \ | |
505 | } while (0) | |
506 | ||
fa593d66 PA |
507 | #define stabilize_threads() \ |
508 | do \ | |
509 | { \ | |
510 | if (the_target->stabilize_threads) \ | |
511 | (*the_target->stabilize_threads) (); \ | |
512 | } while (0) | |
513 | ||
514 | #define install_fast_tracepoint_jump_pad(tpoint, tpaddr, \ | |
515 | collector, lockaddr, \ | |
516 | orig_size, \ | |
405f8e94 SS |
517 | jump_entry, \ |
518 | trampoline, trampoline_size, \ | |
519 | jjump_pad_insn, \ | |
fa593d66 PA |
520 | jjump_pad_insn_size, \ |
521 | adjusted_insn_addr, \ | |
405f8e94 SS |
522 | adjusted_insn_addr_end, \ |
523 | err) \ | |
fa593d66 PA |
524 | (*the_target->install_fast_tracepoint_jump_pad) (tpoint, tpaddr, \ |
525 | collector,lockaddr, \ | |
526 | orig_size, jump_entry, \ | |
405f8e94 SS |
527 | trampoline, \ |
528 | trampoline_size, \ | |
fa593d66 PA |
529 | jjump_pad_insn, \ |
530 | jjump_pad_insn_size, \ | |
531 | adjusted_insn_addr, \ | |
405f8e94 SS |
532 | adjusted_insn_addr_end, \ |
533 | err) | |
fa593d66 | 534 | |
6a271cae PA |
535 | #define target_emit_ops() \ |
536 | (the_target->emit_ops ? (*the_target->emit_ops) () : NULL) | |
537 | ||
03583c20 UW |
538 | #define target_supports_disable_randomization() \ |
539 | (the_target->supports_disable_randomization ? \ | |
540 | (*the_target->supports_disable_randomization) () : 0) | |
541 | ||
d1feda86 YQ |
542 | #define target_supports_agent() \ |
543 | (the_target->supports_agent ? \ | |
544 | (*the_target->supports_agent) () : 0) | |
545 | ||
043c3577 | 546 | #define target_supports_btrace(format) \ |
46917d26 | 547 | (the_target->supports_btrace \ |
043c3577 | 548 | ? (*the_target->supports_btrace) (the_target, format) : 0) |
9accd112 | 549 | |
f4abbc16 MM |
550 | #define target_enable_btrace(ptid, conf) \ |
551 | (*the_target->enable_btrace) (ptid, conf) | |
9accd112 MM |
552 | |
553 | #define target_disable_btrace(tinfo) \ | |
554 | (*the_target->disable_btrace) (tinfo) | |
555 | ||
556 | #define target_read_btrace(tinfo, buffer, type) \ | |
557 | (*the_target->read_btrace) (tinfo, buffer, type) | |
558 | ||
f4abbc16 MM |
559 | #define target_read_btrace_conf(tinfo, buffer) \ |
560 | (*the_target->read_btrace_conf) (tinfo, buffer) | |
561 | ||
c2d6af84 PA |
562 | #define target_supports_range_stepping() \ |
563 | (the_target->supports_range_stepping ? \ | |
564 | (*the_target->supports_range_stepping) () : 0) | |
565 | ||
1ec68e26 PA |
566 | #define target_supports_stopped_by_sw_breakpoint() \ |
567 | (the_target->supports_stopped_by_sw_breakpoint ? \ | |
568 | (*the_target->supports_stopped_by_sw_breakpoint) () : 0) | |
569 | ||
570 | #define target_stopped_by_sw_breakpoint() \ | |
571 | (the_target->stopped_by_sw_breakpoint ? \ | |
572 | (*the_target->stopped_by_sw_breakpoint) () : 0) | |
573 | ||
574 | #define target_supports_stopped_by_hw_breakpoint() \ | |
575 | (the_target->supports_stopped_by_hw_breakpoint ? \ | |
576 | (*the_target->supports_stopped_by_hw_breakpoint) () : 0) | |
577 | ||
45614f15 YQ |
578 | #define target_supports_conditional_breakpoints() \ |
579 | (the_target->supports_conditional_breakpoints ? \ | |
580 | (*the_target->supports_conditional_breakpoints) () : 0) | |
581 | ||
1ec68e26 PA |
582 | #define target_stopped_by_hw_breakpoint() \ |
583 | (the_target->stopped_by_hw_breakpoint ? \ | |
584 | (*the_target->stopped_by_hw_breakpoint) () : 0) | |
585 | ||
bd99dc85 PA |
586 | /* Start non-stop mode, returns 0 on success, -1 on failure. */ |
587 | ||
588 | int start_non_stop (int nonstop); | |
589 | ||
95954743 PA |
590 | ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options, |
591 | int connected_wait); | |
0d62e5e8 | 592 | |
90d74c30 PA |
593 | #define prepare_to_access_memory() \ |
594 | (the_target->prepare_to_access_memory \ | |
595 | ? (*the_target->prepare_to_access_memory) () \ | |
596 | : 0) | |
597 | ||
0146f85b | 598 | #define done_accessing_memory() \ |
90d74c30 PA |
599 | do \ |
600 | { \ | |
0146f85b PA |
601 | if (the_target->done_accessing_memory) \ |
602 | (*the_target->done_accessing_memory) (); \ | |
90d74c30 PA |
603 | } while (0) |
604 | ||
3e10640f YQ |
605 | #define target_core_of_thread(ptid) \ |
606 | (the_target->core_of_thread ? (*the_target->core_of_thread) (ptid) \ | |
607 | : -1) | |
608 | ||
f450004a | 609 | int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len); |
ce3a066d | 610 | |
f450004a DJ |
611 | int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, |
612 | int len); | |
0d62e5e8 | 613 | |
0bfdf32f | 614 | void set_desired_thread (int id); |
ce3a066d | 615 | |
95954743 PA |
616 | const char *target_pid_to_str (ptid_t); |
617 | ||
ce3a066d | 618 | #endif /* TARGET_H */ |