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