Various cleanups in target read/write code
[deliverable/binutils-gdb.git] / gdb / target.h
1 /* Interface between GDB and target environments, including files and processes
2
3 Copyright (C) 1990-2015 Free Software Foundation, Inc.
4
5 Contributed by Cygnus Support. Written by John Gilmore.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #if !defined (TARGET_H)
23 #define TARGET_H
24
25 struct objfile;
26 struct ui_file;
27 struct mem_attrib;
28 struct target_ops;
29 struct bp_location;
30 struct bp_target_info;
31 struct regcache;
32 struct target_section_table;
33 struct trace_state_variable;
34 struct trace_status;
35 struct uploaded_tsv;
36 struct uploaded_tp;
37 struct static_tracepoint_marker;
38 struct traceframe_info;
39 struct expression;
40 struct dcache_struct;
41 struct inferior;
42
43 #include "infrun.h" /* For enum exec_direction_kind. */
44
45 /* This include file defines the interface between the main part
46 of the debugger, and the part which is target-specific, or
47 specific to the communications interface between us and the
48 target.
49
50 A TARGET is an interface between the debugger and a particular
51 kind of file or process. Targets can be STACKED in STRATA,
52 so that more than one target can potentially respond to a request.
53 In particular, memory accesses will walk down the stack of targets
54 until they find a target that is interested in handling that particular
55 address. STRATA are artificial boundaries on the stack, within
56 which particular kinds of targets live. Strata exist so that
57 people don't get confused by pushing e.g. a process target and then
58 a file target, and wondering why they can't see the current values
59 of variables any more (the file target is handling them and they
60 never get to the process target). So when you push a file target,
61 it goes into the file stratum, which is always below the process
62 stratum. */
63
64 #include "target/target.h"
65 #include "target/resume.h"
66 #include "target/wait.h"
67 #include "target/waitstatus.h"
68 #include "bfd.h"
69 #include "symtab.h"
70 #include "memattr.h"
71 #include "vec.h"
72 #include "gdb_signals.h"
73 #include "btrace.h"
74 #include "command.h"
75
76 enum strata
77 {
78 dummy_stratum, /* The lowest of the low */
79 file_stratum, /* Executable files, etc */
80 process_stratum, /* Executing processes or core dump files */
81 thread_stratum, /* Executing threads */
82 record_stratum, /* Support record debugging */
83 arch_stratum /* Architecture overrides */
84 };
85
86 enum thread_control_capabilities
87 {
88 tc_none = 0, /* Default: can't control thread execution. */
89 tc_schedlock = 1, /* Can lock the thread scheduler. */
90 };
91
92 /* The structure below stores information about a system call.
93 It is basically used in the "catch syscall" command, and in
94 every function that gives information about a system call.
95
96 It's also good to mention that its fields represent everything
97 that we currently know about a syscall in GDB. */
98 struct syscall
99 {
100 /* The syscall number. */
101 int number;
102
103 /* The syscall name. */
104 const char *name;
105 };
106
107 /* Return a pretty printed form of target_waitstatus.
108 Space for the result is malloc'd, caller must free. */
109 extern char *target_waitstatus_to_string (const struct target_waitstatus *);
110
111 /* Return a pretty printed form of TARGET_OPTIONS.
112 Space for the result is malloc'd, caller must free. */
113 extern char *target_options_to_string (int target_options);
114
115 /* Possible types of events that the inferior handler will have to
116 deal with. */
117 enum inferior_event_type
118 {
119 /* Process a normal inferior event which will result in target_wait
120 being called. */
121 INF_REG_EVENT,
122 /* We are called because a timer went off. */
123 INF_TIMER,
124 /* We are called to do stuff after the inferior stops. */
125 INF_EXEC_COMPLETE,
126 /* We are called to do some stuff after the inferior stops, but we
127 are expected to reenter the proceed() and
128 handle_inferior_event() functions. This is used only in case of
129 'step n' like commands. */
130 INF_EXEC_CONTINUE
131 };
132 \f
133 /* Target objects which can be transfered using target_read,
134 target_write, et cetera. */
135
136 enum target_object
137 {
138 /* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */
139 TARGET_OBJECT_AVR,
140 /* SPU target specific transfer. See "spu-tdep.c". */
141 TARGET_OBJECT_SPU,
142 /* Transfer up-to LEN bytes of memory starting at OFFSET. */
143 TARGET_OBJECT_MEMORY,
144 /* Memory, avoiding GDB's data cache and trusting the executable.
145 Target implementations of to_xfer_partial never need to handle
146 this object, and most callers should not use it. */
147 TARGET_OBJECT_RAW_MEMORY,
148 /* Memory known to be part of the target's stack. This is cached even
149 if it is not in a region marked as such, since it is known to be
150 "normal" RAM. */
151 TARGET_OBJECT_STACK_MEMORY,
152 /* Memory known to be part of the target code. This is cached even
153 if it is not in a region marked as such. */
154 TARGET_OBJECT_CODE_MEMORY,
155 /* Kernel Unwind Table. See "ia64-tdep.c". */
156 TARGET_OBJECT_UNWIND_TABLE,
157 /* Transfer auxilliary vector. */
158 TARGET_OBJECT_AUXV,
159 /* StackGhost cookie. See "sparc-tdep.c". */
160 TARGET_OBJECT_WCOOKIE,
161 /* Target memory map in XML format. */
162 TARGET_OBJECT_MEMORY_MAP,
163 /* Flash memory. This object can be used to write contents to
164 a previously erased flash memory. Using it without erasing
165 flash can have unexpected results. Addresses are physical
166 address on target, and not relative to flash start. */
167 TARGET_OBJECT_FLASH,
168 /* Available target-specific features, e.g. registers and coprocessors.
169 See "target-descriptions.c". ANNEX should never be empty. */
170 TARGET_OBJECT_AVAILABLE_FEATURES,
171 /* Currently loaded libraries, in XML format. */
172 TARGET_OBJECT_LIBRARIES,
173 /* Currently loaded libraries specific for SVR4 systems, in XML format. */
174 TARGET_OBJECT_LIBRARIES_SVR4,
175 /* Currently loaded libraries specific to AIX systems, in XML format. */
176 TARGET_OBJECT_LIBRARIES_AIX,
177 /* Get OS specific data. The ANNEX specifies the type (running
178 processes, etc.). The data being transfered is expected to follow
179 the DTD specified in features/osdata.dtd. */
180 TARGET_OBJECT_OSDATA,
181 /* Extra signal info. Usually the contents of `siginfo_t' on unix
182 platforms. */
183 TARGET_OBJECT_SIGNAL_INFO,
184 /* The list of threads that are being debugged. */
185 TARGET_OBJECT_THREADS,
186 /* Collected static trace data. */
187 TARGET_OBJECT_STATIC_TRACE_DATA,
188 /* The HP-UX registers (those that can be obtained or modified by using
189 the TT_LWP_RUREGS/TT_LWP_WUREGS ttrace requests). */
190 TARGET_OBJECT_HPUX_UREGS,
191 /* The HP-UX shared library linkage pointer. ANNEX should be a string
192 image of the code address whose linkage pointer we are looking for.
193
194 The size of the data transfered is always 8 bytes (the size of an
195 address on ia64). */
196 TARGET_OBJECT_HPUX_SOLIB_GOT,
197 /* Traceframe info, in XML format. */
198 TARGET_OBJECT_TRACEFRAME_INFO,
199 /* Load maps for FDPIC systems. */
200 TARGET_OBJECT_FDPIC,
201 /* Darwin dynamic linker info data. */
202 TARGET_OBJECT_DARWIN_DYLD_INFO,
203 /* OpenVMS Unwind Information Block. */
204 TARGET_OBJECT_OPENVMS_UIB,
205 /* Branch trace data, in XML format. */
206 TARGET_OBJECT_BTRACE,
207 /* Branch trace configuration, in XML format. */
208 TARGET_OBJECT_BTRACE_CONF,
209 /* The pathname of the executable file that was run to create
210 a specified process. ANNEX should be a string representation
211 of the process ID of the process in question, in hexadecimal
212 format. */
213 TARGET_OBJECT_EXEC_FILE,
214 /* Possible future objects: TARGET_OBJECT_FILE, ... */
215 };
216
217 /* Possible values returned by target_xfer_partial, etc. */
218
219 enum target_xfer_status
220 {
221 /* Some bytes are transferred. */
222 TARGET_XFER_OK = 1,
223
224 /* No further transfer is possible. */
225 TARGET_XFER_EOF = 0,
226
227 /* The piece of the object requested is unavailable. */
228 TARGET_XFER_UNAVAILABLE = 2,
229
230 /* Generic I/O error. Note that it's important that this is '-1',
231 as we still have target_xfer-related code returning hardcoded
232 '-1' on error. */
233 TARGET_XFER_E_IO = -1,
234
235 /* Keep list in sync with target_xfer_status_to_string. */
236 };
237
238 /* Return the string form of STATUS. */
239
240 extern const char *
241 target_xfer_status_to_string (enum target_xfer_status status);
242
243 /* Enumeration of the kinds of traceframe searches that a target may
244 be able to perform. */
245
246 enum trace_find_type
247 {
248 tfind_number,
249 tfind_pc,
250 tfind_tp,
251 tfind_range,
252 tfind_outside,
253 };
254
255 typedef struct static_tracepoint_marker *static_tracepoint_marker_p;
256 DEF_VEC_P(static_tracepoint_marker_p);
257
258 typedef enum target_xfer_status
259 target_xfer_partial_ftype (struct target_ops *ops,
260 enum target_object object,
261 const char *annex,
262 gdb_byte *readbuf,
263 const gdb_byte *writebuf,
264 ULONGEST offset,
265 ULONGEST len,
266 ULONGEST *xfered_len);
267
268 /* Request that OPS transfer up to LEN 8-bit bytes of the target's
269 OBJECT. The OFFSET, for a seekable object, specifies the
270 starting point. The ANNEX can be used to provide additional
271 data-specific information to the target.
272
273 Return the number of bytes actually transfered, or a negative error
274 code (an 'enum target_xfer_error' value) if the transfer is not
275 supported or otherwise fails. Return of a positive value less than
276 LEN indicates that no further transfer is possible. Unlike the raw
277 to_xfer_partial interface, callers of these functions do not need
278 to retry partial transfers. */
279
280 extern LONGEST target_read (struct target_ops *ops,
281 enum target_object object,
282 const char *annex, gdb_byte *buf,
283 ULONGEST offset, LONGEST len);
284
285 struct memory_read_result
286 {
287 /* First address that was read. */
288 ULONGEST begin;
289 /* Past-the-end address. */
290 ULONGEST end;
291 /* The data. */
292 gdb_byte *data;
293 };
294 typedef struct memory_read_result memory_read_result_s;
295 DEF_VEC_O(memory_read_result_s);
296
297 extern void free_memory_read_result_vector (void *);
298
299 extern VEC(memory_read_result_s)* read_memory_robust (struct target_ops *ops,
300 const ULONGEST offset,
301 const LONGEST len);
302
303 extern LONGEST target_write (struct target_ops *ops,
304 enum target_object object,
305 const char *annex, const gdb_byte *buf,
306 ULONGEST offset, LONGEST len);
307
308 /* Similar to target_write, except that it also calls PROGRESS with
309 the number of bytes written and the opaque BATON after every
310 successful partial write (and before the first write). This is
311 useful for progress reporting and user interaction while writing
312 data. To abort the transfer, the progress callback can throw an
313 exception. */
314
315 LONGEST target_write_with_progress (struct target_ops *ops,
316 enum target_object object,
317 const char *annex, const gdb_byte *buf,
318 ULONGEST offset, LONGEST len,
319 void (*progress) (ULONGEST, void *),
320 void *baton);
321
322 /* Wrapper to perform a full read of unknown size. OBJECT/ANNEX will
323 be read using OPS. The return value will be -1 if the transfer
324 fails or is not supported; 0 if the object is empty; or the length
325 of the object otherwise. If a positive value is returned, a
326 sufficiently large buffer will be allocated using xmalloc and
327 returned in *BUF_P containing the contents of the object.
328
329 This method should be used for objects sufficiently small to store
330 in a single xmalloc'd buffer, when no fixed bound on the object's
331 size is known in advance. Don't try to read TARGET_OBJECT_MEMORY
332 through this function. */
333
334 extern LONGEST target_read_alloc (struct target_ops *ops,
335 enum target_object object,
336 const char *annex, gdb_byte **buf_p);
337
338 /* Read OBJECT/ANNEX using OPS. The result is NUL-terminated and
339 returned as a string, allocated using xmalloc. If an error occurs
340 or the transfer is unsupported, NULL is returned. Empty objects
341 are returned as allocated but empty strings. A warning is issued
342 if the result contains any embedded NUL bytes. */
343
344 extern char *target_read_stralloc (struct target_ops *ops,
345 enum target_object object,
346 const char *annex);
347
348 /* See target_ops->to_xfer_partial. */
349 extern target_xfer_partial_ftype target_xfer_partial;
350
351 /* Wrappers to target read/write that perform memory transfers. They
352 throw an error if the memory transfer fails.
353
354 NOTE: cagney/2003-10-23: The naming schema is lifted from
355 "frame.h". The parameter order is lifted from get_frame_memory,
356 which in turn lifted it from read_memory. */
357
358 extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
359 gdb_byte *buf, LONGEST len);
360 extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
361 CORE_ADDR addr, int len,
362 enum bfd_endian byte_order);
363 \f
364 struct thread_info; /* fwd decl for parameter list below: */
365
366 /* The type of the callback to the to_async method. */
367
368 typedef void async_callback_ftype (enum inferior_event_type event_type,
369 void *context);
370
371 /* Normally target debug printing is purely type-based. However,
372 sometimes it is necessary to override the debug printing on a
373 per-argument basis. This macro can be used, attribute-style, to
374 name the target debug printing function for a particular method
375 argument. FUNC is the name of the function. The macro's
376 definition is empty because it is only used by the
377 make-target-delegates script. */
378
379 #define TARGET_DEBUG_PRINTER(FUNC)
380
381 /* These defines are used to mark target_ops methods. The script
382 make-target-delegates scans these and auto-generates the base
383 method implementations. There are four macros that can be used:
384
385 1. TARGET_DEFAULT_IGNORE. There is no argument. The base method
386 does nothing. This is only valid if the method return type is
387 'void'.
388
389 2. TARGET_DEFAULT_NORETURN. The argument is a function call, like
390 'tcomplain ()'. The base method simply makes this call, which is
391 assumed not to return.
392
393 3. TARGET_DEFAULT_RETURN. The argument is a C expression. The
394 base method returns this expression's value.
395
396 4. TARGET_DEFAULT_FUNC. The argument is the name of a function.
397 make-target-delegates does not generate a base method in this case,
398 but instead uses the argument function as the base method. */
399
400 #define TARGET_DEFAULT_IGNORE()
401 #define TARGET_DEFAULT_NORETURN(ARG)
402 #define TARGET_DEFAULT_RETURN(ARG)
403 #define TARGET_DEFAULT_FUNC(ARG)
404
405 struct target_ops
406 {
407 struct target_ops *beneath; /* To the target under this one. */
408 const char *to_shortname; /* Name this target type */
409 const char *to_longname; /* Name for printing */
410 const char *to_doc; /* Documentation. Does not include trailing
411 newline, and starts with a one-line descrip-
412 tion (probably similar to to_longname). */
413 /* Per-target scratch pad. */
414 void *to_data;
415 /* The open routine takes the rest of the parameters from the
416 command, and (if successful) pushes a new target onto the
417 stack. Targets should supply this routine, if only to provide
418 an error message. */
419 void (*to_open) (const char *, int);
420 /* Old targets with a static target vector provide "to_close".
421 New re-entrant targets provide "to_xclose" and that is expected
422 to xfree everything (including the "struct target_ops"). */
423 void (*to_xclose) (struct target_ops *targ);
424 void (*to_close) (struct target_ops *);
425 /* Attaches to a process on the target side. Arguments are as
426 passed to the `attach' command by the user. This routine can
427 be called when the target is not on the target-stack, if the
428 target_can_run routine returns 1; in that case, it must push
429 itself onto the stack. Upon exit, the target should be ready
430 for normal operations, and should be ready to deliver the
431 status of the process immediately (without waiting) to an
432 upcoming target_wait call. */
433 void (*to_attach) (struct target_ops *ops, const char *, int);
434 void (*to_post_attach) (struct target_ops *, int)
435 TARGET_DEFAULT_IGNORE ();
436 void (*to_detach) (struct target_ops *ops, const char *, int)
437 TARGET_DEFAULT_IGNORE ();
438 void (*to_disconnect) (struct target_ops *, const char *, int)
439 TARGET_DEFAULT_NORETURN (tcomplain ());
440 void (*to_resume) (struct target_ops *, ptid_t,
441 int TARGET_DEBUG_PRINTER (target_debug_print_step),
442 enum gdb_signal)
443 TARGET_DEFAULT_NORETURN (noprocess ());
444 ptid_t (*to_wait) (struct target_ops *,
445 ptid_t, struct target_waitstatus *,
446 int TARGET_DEBUG_PRINTER (target_debug_print_options))
447 TARGET_DEFAULT_NORETURN (noprocess ());
448 void (*to_fetch_registers) (struct target_ops *, struct regcache *, int)
449 TARGET_DEFAULT_IGNORE ();
450 void (*to_store_registers) (struct target_ops *, struct regcache *, int)
451 TARGET_DEFAULT_NORETURN (noprocess ());
452 void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
453 TARGET_DEFAULT_NORETURN (noprocess ());
454
455 void (*to_files_info) (struct target_ops *)
456 TARGET_DEFAULT_IGNORE ();
457 int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
458 struct bp_target_info *)
459 TARGET_DEFAULT_FUNC (memory_insert_breakpoint);
460 int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
461 struct bp_target_info *)
462 TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
463
464 /* Returns true if the target stopped because it executed a
465 software breakpoint. This is necessary for correct background
466 execution / non-stop mode operation, and for correct PC
467 adjustment on targets where the PC needs to be adjusted when a
468 software breakpoint triggers. In these modes, by the time GDB
469 processes a breakpoint event, the breakpoint may already be
470 done from the target, so GDB needs to be able to tell whether
471 it should ignore the event and whether it should adjust the PC.
472 See adjust_pc_after_break. */
473 int (*to_stopped_by_sw_breakpoint) (struct target_ops *)
474 TARGET_DEFAULT_RETURN (0);
475 /* Returns true if the above method is supported. */
476 int (*to_supports_stopped_by_sw_breakpoint) (struct target_ops *)
477 TARGET_DEFAULT_RETURN (0);
478
479 /* Returns true if the target stopped for a hardware breakpoint.
480 Likewise, if the target supports hardware breakpoints, this
481 method is necessary for correct background execution / non-stop
482 mode operation. Even though hardware breakpoints do not
483 require PC adjustment, GDB needs to be able to tell whether the
484 hardware breakpoint event is a delayed event for a breakpoint
485 that is already gone and should thus be ignored. */
486 int (*to_stopped_by_hw_breakpoint) (struct target_ops *)
487 TARGET_DEFAULT_RETURN (0);
488 /* Returns true if the above method is supported. */
489 int (*to_supports_stopped_by_hw_breakpoint) (struct target_ops *)
490 TARGET_DEFAULT_RETURN (0);
491
492 int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int)
493 TARGET_DEFAULT_RETURN (0);
494 int (*to_ranged_break_num_registers) (struct target_ops *)
495 TARGET_DEFAULT_RETURN (-1);
496 int (*to_insert_hw_breakpoint) (struct target_ops *,
497 struct gdbarch *, struct bp_target_info *)
498 TARGET_DEFAULT_RETURN (-1);
499 int (*to_remove_hw_breakpoint) (struct target_ops *,
500 struct gdbarch *, struct bp_target_info *)
501 TARGET_DEFAULT_RETURN (-1);
502
503 /* Documentation of what the two routines below are expected to do is
504 provided with the corresponding target_* macros. */
505 int (*to_remove_watchpoint) (struct target_ops *,
506 CORE_ADDR, int, int, struct expression *)
507 TARGET_DEFAULT_RETURN (-1);
508 int (*to_insert_watchpoint) (struct target_ops *,
509 CORE_ADDR, int, int, struct expression *)
510 TARGET_DEFAULT_RETURN (-1);
511
512 int (*to_insert_mask_watchpoint) (struct target_ops *,
513 CORE_ADDR, CORE_ADDR, int)
514 TARGET_DEFAULT_RETURN (1);
515 int (*to_remove_mask_watchpoint) (struct target_ops *,
516 CORE_ADDR, CORE_ADDR, int)
517 TARGET_DEFAULT_RETURN (1);
518 int (*to_stopped_by_watchpoint) (struct target_ops *)
519 TARGET_DEFAULT_RETURN (0);
520 int to_have_steppable_watchpoint;
521 int to_have_continuable_watchpoint;
522 int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
523 TARGET_DEFAULT_RETURN (0);
524 int (*to_watchpoint_addr_within_range) (struct target_ops *,
525 CORE_ADDR, CORE_ADDR, int)
526 TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
527
528 /* Documentation of this routine is provided with the corresponding
529 target_* macro. */
530 int (*to_region_ok_for_hw_watchpoint) (struct target_ops *,
531 CORE_ADDR, int)
532 TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
533
534 int (*to_can_accel_watchpoint_condition) (struct target_ops *,
535 CORE_ADDR, int, int,
536 struct expression *)
537 TARGET_DEFAULT_RETURN (0);
538 int (*to_masked_watch_num_registers) (struct target_ops *,
539 CORE_ADDR, CORE_ADDR)
540 TARGET_DEFAULT_RETURN (-1);
541 void (*to_terminal_init) (struct target_ops *)
542 TARGET_DEFAULT_IGNORE ();
543 void (*to_terminal_inferior) (struct target_ops *)
544 TARGET_DEFAULT_IGNORE ();
545 void (*to_terminal_ours_for_output) (struct target_ops *)
546 TARGET_DEFAULT_IGNORE ();
547 void (*to_terminal_ours) (struct target_ops *)
548 TARGET_DEFAULT_IGNORE ();
549 void (*to_terminal_info) (struct target_ops *, const char *, int)
550 TARGET_DEFAULT_FUNC (default_terminal_info);
551 void (*to_kill) (struct target_ops *)
552 TARGET_DEFAULT_NORETURN (noprocess ());
553 void (*to_load) (struct target_ops *, const char *, int)
554 TARGET_DEFAULT_NORETURN (tcomplain ());
555 /* Start an inferior process and set inferior_ptid to its pid.
556 EXEC_FILE is the file to run.
557 ALLARGS is a string containing the arguments to the program.
558 ENV is the environment vector to pass. Errors reported with error().
559 On VxWorks and various standalone systems, we ignore exec_file. */
560 void (*to_create_inferior) (struct target_ops *,
561 char *, char *, char **, int);
562 void (*to_post_startup_inferior) (struct target_ops *, ptid_t)
563 TARGET_DEFAULT_IGNORE ();
564 int (*to_insert_fork_catchpoint) (struct target_ops *, int)
565 TARGET_DEFAULT_RETURN (1);
566 int (*to_remove_fork_catchpoint) (struct target_ops *, int)
567 TARGET_DEFAULT_RETURN (1);
568 int (*to_insert_vfork_catchpoint) (struct target_ops *, int)
569 TARGET_DEFAULT_RETURN (1);
570 int (*to_remove_vfork_catchpoint) (struct target_ops *, int)
571 TARGET_DEFAULT_RETURN (1);
572 int (*to_follow_fork) (struct target_ops *, int, int)
573 TARGET_DEFAULT_FUNC (default_follow_fork);
574 int (*to_insert_exec_catchpoint) (struct target_ops *, int)
575 TARGET_DEFAULT_RETURN (1);
576 int (*to_remove_exec_catchpoint) (struct target_ops *, int)
577 TARGET_DEFAULT_RETURN (1);
578 int (*to_set_syscall_catchpoint) (struct target_ops *,
579 int, int, int, int, int *)
580 TARGET_DEFAULT_RETURN (1);
581 int (*to_has_exited) (struct target_ops *, int, int, int *)
582 TARGET_DEFAULT_RETURN (0);
583 void (*to_mourn_inferior) (struct target_ops *)
584 TARGET_DEFAULT_FUNC (default_mourn_inferior);
585 /* Note that to_can_run is special and can be invoked on an
586 unpushed target. Targets defining this method must also define
587 to_can_async_p and to_supports_non_stop. */
588 int (*to_can_run) (struct target_ops *)
589 TARGET_DEFAULT_RETURN (0);
590
591 /* Documentation of this routine is provided with the corresponding
592 target_* macro. */
593 void (*to_pass_signals) (struct target_ops *, int,
594 unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
595 TARGET_DEFAULT_IGNORE ();
596
597 /* Documentation of this routine is provided with the
598 corresponding target_* function. */
599 void (*to_program_signals) (struct target_ops *, int,
600 unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
601 TARGET_DEFAULT_IGNORE ();
602
603 int (*to_thread_alive) (struct target_ops *, ptid_t ptid)
604 TARGET_DEFAULT_RETURN (0);
605 void (*to_update_thread_list) (struct target_ops *)
606 TARGET_DEFAULT_IGNORE ();
607 char *(*to_pid_to_str) (struct target_ops *, ptid_t)
608 TARGET_DEFAULT_FUNC (default_pid_to_str);
609 char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
610 TARGET_DEFAULT_RETURN (NULL);
611 char *(*to_thread_name) (struct target_ops *, struct thread_info *)
612 TARGET_DEFAULT_RETURN (NULL);
613 void (*to_stop) (struct target_ops *, ptid_t)
614 TARGET_DEFAULT_IGNORE ();
615 void (*to_rcmd) (struct target_ops *,
616 const char *command, struct ui_file *output)
617 TARGET_DEFAULT_FUNC (default_rcmd);
618 char *(*to_pid_to_exec_file) (struct target_ops *, int pid)
619 TARGET_DEFAULT_RETURN (NULL);
620 void (*to_log_command) (struct target_ops *, const char *)
621 TARGET_DEFAULT_IGNORE ();
622 struct target_section_table *(*to_get_section_table) (struct target_ops *)
623 TARGET_DEFAULT_RETURN (NULL);
624 enum strata to_stratum;
625 int (*to_has_all_memory) (struct target_ops *);
626 int (*to_has_memory) (struct target_ops *);
627 int (*to_has_stack) (struct target_ops *);
628 int (*to_has_registers) (struct target_ops *);
629 int (*to_has_execution) (struct target_ops *, ptid_t);
630 int to_has_thread_control; /* control thread execution */
631 int to_attach_no_wait;
632 /* This method must be implemented in some situations. See the
633 comment on 'to_can_run'. */
634 int (*to_can_async_p) (struct target_ops *)
635 TARGET_DEFAULT_RETURN (0);
636 int (*to_is_async_p) (struct target_ops *)
637 TARGET_DEFAULT_RETURN (0);
638 void (*to_async) (struct target_ops *, int)
639 TARGET_DEFAULT_NORETURN (tcomplain ());
640 /* This method must be implemented in some situations. See the
641 comment on 'to_can_run'. */
642 int (*to_supports_non_stop) (struct target_ops *)
643 TARGET_DEFAULT_RETURN (0);
644 /* find_memory_regions support method for gcore */
645 int (*to_find_memory_regions) (struct target_ops *,
646 find_memory_region_ftype func, void *data)
647 TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
648 /* make_corefile_notes support method for gcore */
649 char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
650 TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
651 /* get_bookmark support method for bookmarks */
652 gdb_byte * (*to_get_bookmark) (struct target_ops *, const char *, int)
653 TARGET_DEFAULT_NORETURN (tcomplain ());
654 /* goto_bookmark support method for bookmarks */
655 void (*to_goto_bookmark) (struct target_ops *, const gdb_byte *, int)
656 TARGET_DEFAULT_NORETURN (tcomplain ());
657 /* Return the thread-local address at OFFSET in the
658 thread-local storage for the thread PTID and the shared library
659 or executable file given by OBJFILE. If that block of
660 thread-local storage hasn't been allocated yet, this function
661 may return an error. LOAD_MODULE_ADDR may be zero for statically
662 linked multithreaded inferiors. */
663 CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
664 ptid_t ptid,
665 CORE_ADDR load_module_addr,
666 CORE_ADDR offset)
667 TARGET_DEFAULT_NORETURN (generic_tls_error ());
668
669 /* Request that OPS transfer up to LEN 8-bit bytes of the target's
670 OBJECT. The OFFSET, for a seekable object, specifies the
671 starting point. The ANNEX can be used to provide additional
672 data-specific information to the target.
673
674 Return the transferred status, error or OK (an
675 'enum target_xfer_status' value). Save the number of bytes
676 actually transferred in *XFERED_LEN if transfer is successful
677 (TARGET_XFER_OK) or the number unavailable bytes if the requested
678 data is unavailable (TARGET_XFER_UNAVAILABLE). *XFERED_LEN
679 smaller than LEN does not indicate the end of the object, only
680 the end of the transfer; higher level code should continue
681 transferring if desired. This is handled in target.c.
682
683 The interface does not support a "retry" mechanism. Instead it
684 assumes that at least one byte will be transfered on each
685 successful call.
686
687 NOTE: cagney/2003-10-17: The current interface can lead to
688 fragmented transfers. Lower target levels should not implement
689 hacks, such as enlarging the transfer, in an attempt to
690 compensate for this. Instead, the target stack should be
691 extended so that it implements supply/collect methods and a
692 look-aside object cache. With that available, the lowest
693 target can safely and freely "push" data up the stack.
694
695 See target_read and target_write for more information. One,
696 and only one, of readbuf or writebuf must be non-NULL. */
697
698 enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
699 enum target_object object,
700 const char *annex,
701 gdb_byte *readbuf,
702 const gdb_byte *writebuf,
703 ULONGEST offset, ULONGEST len,
704 ULONGEST *xfered_len)
705 TARGET_DEFAULT_RETURN (TARGET_XFER_E_IO);
706
707 /* Returns the memory map for the target. A return value of NULL
708 means that no memory map is available. If a memory address
709 does not fall within any returned regions, it's assumed to be
710 RAM. The returned memory regions should not overlap.
711
712 The order of regions does not matter; target_memory_map will
713 sort regions by starting address. For that reason, this
714 function should not be called directly except via
715 target_memory_map.
716
717 This method should not cache data; if the memory map could
718 change unexpectedly, it should be invalidated, and higher
719 layers will re-fetch it. */
720 VEC(mem_region_s) *(*to_memory_map) (struct target_ops *)
721 TARGET_DEFAULT_RETURN (NULL);
722
723 /* Erases the region of flash memory starting at ADDRESS, of
724 length LENGTH.
725
726 Precondition: both ADDRESS and ADDRESS+LENGTH should be aligned
727 on flash block boundaries, as reported by 'to_memory_map'. */
728 void (*to_flash_erase) (struct target_ops *,
729 ULONGEST address, LONGEST length)
730 TARGET_DEFAULT_NORETURN (tcomplain ());
731
732 /* Finishes a flash memory write sequence. After this operation
733 all flash memory should be available for writing and the result
734 of reading from areas written by 'to_flash_write' should be
735 equal to what was written. */
736 void (*to_flash_done) (struct target_ops *)
737 TARGET_DEFAULT_NORETURN (tcomplain ());
738
739 /* Describe the architecture-specific features of this target. If
740 OPS doesn't have a description, this should delegate to the
741 "beneath" target. Returns the description found, or NULL if no
742 description was available. */
743 const struct target_desc *(*to_read_description) (struct target_ops *ops)
744 TARGET_DEFAULT_RETURN (NULL);
745
746 /* Build the PTID of the thread on which a given task is running,
747 based on LWP and THREAD. These values are extracted from the
748 task Private_Data section of the Ada Task Control Block, and
749 their interpretation depends on the target. */
750 ptid_t (*to_get_ada_task_ptid) (struct target_ops *,
751 long lwp, long thread)
752 TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);
753
754 /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
755 Return 0 if *READPTR is already at the end of the buffer.
756 Return -1 if there is insufficient buffer for a whole entry.
757 Return 1 if an entry was read into *TYPEP and *VALP. */
758 int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr,
759 gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
760 TARGET_DEFAULT_FUNC (default_auxv_parse);
761
762 /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
763 sequence of bytes in PATTERN with length PATTERN_LEN.
764
765 The result is 1 if found, 0 if not found, and -1 if there was an error
766 requiring halting of the search (e.g. memory read error).
767 If the pattern is found the address is recorded in FOUND_ADDRP. */
768 int (*to_search_memory) (struct target_ops *ops,
769 CORE_ADDR start_addr, ULONGEST search_space_len,
770 const gdb_byte *pattern, ULONGEST pattern_len,
771 CORE_ADDR *found_addrp)
772 TARGET_DEFAULT_FUNC (default_search_memory);
773
774 /* Can target execute in reverse? */
775 int (*to_can_execute_reverse) (struct target_ops *)
776 TARGET_DEFAULT_RETURN (0);
777
778 /* The direction the target is currently executing. Must be
779 implemented on targets that support reverse execution and async
780 mode. The default simply returns forward execution. */
781 enum exec_direction_kind (*to_execution_direction) (struct target_ops *)
782 TARGET_DEFAULT_FUNC (default_execution_direction);
783
784 /* Does this target support debugging multiple processes
785 simultaneously? */
786 int (*to_supports_multi_process) (struct target_ops *)
787 TARGET_DEFAULT_RETURN (0);
788
789 /* Does this target support enabling and disabling tracepoints while a trace
790 experiment is running? */
791 int (*to_supports_enable_disable_tracepoint) (struct target_ops *)
792 TARGET_DEFAULT_RETURN (0);
793
794 /* Does this target support disabling address space randomization? */
795 int (*to_supports_disable_randomization) (struct target_ops *);
796
797 /* Does this target support the tracenz bytecode for string collection? */
798 int (*to_supports_string_tracing) (struct target_ops *)
799 TARGET_DEFAULT_RETURN (0);
800
801 /* Does this target support evaluation of breakpoint conditions on its
802 end? */
803 int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *)
804 TARGET_DEFAULT_RETURN (0);
805
806 /* Does this target support evaluation of breakpoint commands on its
807 end? */
808 int (*to_can_run_breakpoint_commands) (struct target_ops *)
809 TARGET_DEFAULT_RETURN (0);
810
811 /* Determine current architecture of thread PTID.
812
813 The target is supposed to determine the architecture of the code where
814 the target is currently stopped at (on Cell, if a target is in spu_run,
815 to_thread_architecture would return SPU, otherwise PPC32 or PPC64).
816 This is architecture used to perform decr_pc_after_break adjustment,
817 and also determines the frame architecture of the innermost frame.
818 ptrace operations need to operate according to target_gdbarch ().
819
820 The default implementation always returns target_gdbarch (). */
821 struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t)
822 TARGET_DEFAULT_FUNC (default_thread_architecture);
823
824 /* Determine current address space of thread PTID.
825
826 The default implementation always returns the inferior's
827 address space. */
828 struct address_space *(*to_thread_address_space) (struct target_ops *,
829 ptid_t)
830 TARGET_DEFAULT_FUNC (default_thread_address_space);
831
832 /* Target file operations. */
833
834 /* Return nonzero if the filesystem seen by the current inferior
835 is the local filesystem, zero otherwise. */
836 int (*to_filesystem_is_local) (struct target_ops *)
837 TARGET_DEFAULT_RETURN (1);
838
839 /* Open FILENAME on the target, in the filesystem as seen by INF,
840 using FLAGS and MODE. If INF is NULL, use the filesystem seen
841 by the debugger (GDB or, for remote targets, the remote stub).
842 Return a target file descriptor, or -1 if an error occurs (and
843 set *TARGET_ERRNO). */
844 int (*to_fileio_open) (struct target_ops *,
845 struct inferior *inf, const char *filename,
846 int flags, int mode, int *target_errno);
847
848 /* Write up to LEN bytes from WRITE_BUF to FD on the target.
849 Return the number of bytes written, or -1 if an error occurs
850 (and set *TARGET_ERRNO). */
851 int (*to_fileio_pwrite) (struct target_ops *,
852 int fd, const gdb_byte *write_buf, int len,
853 ULONGEST offset, int *target_errno);
854
855 /* Read up to LEN bytes FD on the target into READ_BUF.
856 Return the number of bytes read, or -1 if an error occurs
857 (and set *TARGET_ERRNO). */
858 int (*to_fileio_pread) (struct target_ops *,
859 int fd, gdb_byte *read_buf, int len,
860 ULONGEST offset, int *target_errno);
861
862 /* Get information about the file opened as FD and put it in
863 SB. Return 0 on success, or -1 if an error occurs (and set
864 *TARGET_ERRNO). */
865 int (*to_fileio_fstat) (struct target_ops *,
866 int fd, struct stat *sb, int *target_errno);
867
868 /* Close FD on the target. Return 0, or -1 if an error occurs
869 (and set *TARGET_ERRNO). */
870 int (*to_fileio_close) (struct target_ops *, int fd, int *target_errno);
871
872 /* Unlink FILENAME on the target, in the filesystem as seen by
873 INF. If INF is NULL, use the filesystem seen by the debugger
874 (GDB or, for remote targets, the remote stub). Return 0, or
875 -1 if an error occurs (and set *TARGET_ERRNO). */
876 int (*to_fileio_unlink) (struct target_ops *,
877 struct inferior *inf,
878 const char *filename,
879 int *target_errno);
880
881 /* Read value of symbolic link FILENAME on the target, in the
882 filesystem as seen by INF. If INF is NULL, use the filesystem
883 seen by the debugger (GDB or, for remote targets, the remote
884 stub). Return a null-terminated string allocated via xmalloc,
885 or NULL if an error occurs (and set *TARGET_ERRNO). */
886 char *(*to_fileio_readlink) (struct target_ops *,
887 struct inferior *inf,
888 const char *filename,
889 int *target_errno);
890
891
892 /* Implement the "info proc" command. */
893 void (*to_info_proc) (struct target_ops *, const char *,
894 enum info_proc_what);
895
896 /* Tracepoint-related operations. */
897
898 /* Prepare the target for a tracing run. */
899 void (*to_trace_init) (struct target_ops *)
900 TARGET_DEFAULT_NORETURN (tcomplain ());
901
902 /* Send full details of a tracepoint location to the target. */
903 void (*to_download_tracepoint) (struct target_ops *,
904 struct bp_location *location)
905 TARGET_DEFAULT_NORETURN (tcomplain ());
906
907 /* Is the target able to download tracepoint locations in current
908 state? */
909 int (*to_can_download_tracepoint) (struct target_ops *)
910 TARGET_DEFAULT_RETURN (0);
911
912 /* Send full details of a trace state variable to the target. */
913 void (*to_download_trace_state_variable) (struct target_ops *,
914 struct trace_state_variable *tsv)
915 TARGET_DEFAULT_NORETURN (tcomplain ());
916
917 /* Enable a tracepoint on the target. */
918 void (*to_enable_tracepoint) (struct target_ops *,
919 struct bp_location *location)
920 TARGET_DEFAULT_NORETURN (tcomplain ());
921
922 /* Disable a tracepoint on the target. */
923 void (*to_disable_tracepoint) (struct target_ops *,
924 struct bp_location *location)
925 TARGET_DEFAULT_NORETURN (tcomplain ());
926
927 /* Inform the target info of memory regions that are readonly
928 (such as text sections), and so it should return data from
929 those rather than look in the trace buffer. */
930 void (*to_trace_set_readonly_regions) (struct target_ops *)
931 TARGET_DEFAULT_NORETURN (tcomplain ());
932
933 /* Start a trace run. */
934 void (*to_trace_start) (struct target_ops *)
935 TARGET_DEFAULT_NORETURN (tcomplain ());
936
937 /* Get the current status of a tracing run. */
938 int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts)
939 TARGET_DEFAULT_RETURN (-1);
940
941 void (*to_get_tracepoint_status) (struct target_ops *,
942 struct breakpoint *tp,
943 struct uploaded_tp *utp)
944 TARGET_DEFAULT_NORETURN (tcomplain ());
945
946 /* Stop a trace run. */
947 void (*to_trace_stop) (struct target_ops *)
948 TARGET_DEFAULT_NORETURN (tcomplain ());
949
950 /* Ask the target to find a trace frame of the given type TYPE,
951 using NUM, ADDR1, and ADDR2 as search parameters. Returns the
952 number of the trace frame, and also the tracepoint number at
953 TPP. If no trace frame matches, return -1. May throw if the
954 operation fails. */
955 int (*to_trace_find) (struct target_ops *,
956 enum trace_find_type type, int num,
957 CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
958 TARGET_DEFAULT_RETURN (-1);
959
960 /* Get the value of the trace state variable number TSV, returning
961 1 if the value is known and writing the value itself into the
962 location pointed to by VAL, else returning 0. */
963 int (*to_get_trace_state_variable_value) (struct target_ops *,
964 int tsv, LONGEST *val)
965 TARGET_DEFAULT_RETURN (0);
966
967 int (*to_save_trace_data) (struct target_ops *, const char *filename)
968 TARGET_DEFAULT_NORETURN (tcomplain ());
969
970 int (*to_upload_tracepoints) (struct target_ops *,
971 struct uploaded_tp **utpp)
972 TARGET_DEFAULT_RETURN (0);
973
974 int (*to_upload_trace_state_variables) (struct target_ops *,
975 struct uploaded_tsv **utsvp)
976 TARGET_DEFAULT_RETURN (0);
977
978 LONGEST (*to_get_raw_trace_data) (struct target_ops *, gdb_byte *buf,
979 ULONGEST offset, LONGEST len)
980 TARGET_DEFAULT_NORETURN (tcomplain ());
981
982 /* Get the minimum length of instruction on which a fast tracepoint
983 may be set on the target. If this operation is unsupported,
984 return -1. If for some reason the minimum length cannot be
985 determined, return 0. */
986 int (*to_get_min_fast_tracepoint_insn_len) (struct target_ops *)
987 TARGET_DEFAULT_RETURN (-1);
988
989 /* Set the target's tracing behavior in response to unexpected
990 disconnection - set VAL to 1 to keep tracing, 0 to stop. */
991 void (*to_set_disconnected_tracing) (struct target_ops *, int val)
992 TARGET_DEFAULT_IGNORE ();
993 void (*to_set_circular_trace_buffer) (struct target_ops *, int val)
994 TARGET_DEFAULT_IGNORE ();
995 /* Set the size of trace buffer in the target. */
996 void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val)
997 TARGET_DEFAULT_IGNORE ();
998
999 /* Add/change textual notes about the trace run, returning 1 if
1000 successful, 0 otherwise. */
1001 int (*to_set_trace_notes) (struct target_ops *,
1002 const char *user, const char *notes,
1003 const char *stopnotes)
1004 TARGET_DEFAULT_RETURN (0);
1005
1006 /* Return the processor core that thread PTID was last seen on.
1007 This information is updated only when:
1008 - update_thread_list is called
1009 - thread stops
1010 If the core cannot be determined -- either for the specified
1011 thread, or right now, or in this debug session, or for this
1012 target -- return -1. */
1013 int (*to_core_of_thread) (struct target_ops *, ptid_t ptid)
1014 TARGET_DEFAULT_RETURN (-1);
1015
1016 /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
1017 matches the contents of [DATA,DATA+SIZE). Returns 1 if there's
1018 a match, 0 if there's a mismatch, and -1 if an error is
1019 encountered while reading memory. */
1020 int (*to_verify_memory) (struct target_ops *, const gdb_byte *data,
1021 CORE_ADDR memaddr, ULONGEST size)
1022 TARGET_DEFAULT_FUNC (default_verify_memory);
1023
1024 /* Return the address of the start of the Thread Information Block
1025 a Windows OS specific feature. */
1026 int (*to_get_tib_address) (struct target_ops *,
1027 ptid_t ptid, CORE_ADDR *addr)
1028 TARGET_DEFAULT_NORETURN (tcomplain ());
1029
1030 /* Send the new settings of write permission variables. */
1031 void (*to_set_permissions) (struct target_ops *)
1032 TARGET_DEFAULT_IGNORE ();
1033
1034 /* Look for a static tracepoint marker at ADDR, and fill in MARKER
1035 with its details. Return 1 on success, 0 on failure. */
1036 int (*to_static_tracepoint_marker_at) (struct target_ops *, CORE_ADDR,
1037 struct static_tracepoint_marker *marker)
1038 TARGET_DEFAULT_RETURN (0);
1039
1040 /* Return a vector of all tracepoints markers string id ID, or all
1041 markers if ID is NULL. */
1042 VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid) (struct target_ops *, const char *id)
1043 TARGET_DEFAULT_NORETURN (tcomplain ());
1044
1045 /* Return a traceframe info object describing the current
1046 traceframe's contents. This method should not cache data;
1047 higher layers take care of caching, invalidating, and
1048 re-fetching when necessary. */
1049 struct traceframe_info *(*to_traceframe_info) (struct target_ops *)
1050 TARGET_DEFAULT_NORETURN (tcomplain ());
1051
1052 /* Ask the target to use or not to use agent according to USE. Return 1
1053 successful, 0 otherwise. */
1054 int (*to_use_agent) (struct target_ops *, int use)
1055 TARGET_DEFAULT_NORETURN (tcomplain ());
1056
1057 /* Is the target able to use agent in current state? */
1058 int (*to_can_use_agent) (struct target_ops *)
1059 TARGET_DEFAULT_RETURN (0);
1060
1061 /* Check whether the target supports branch tracing. */
1062 int (*to_supports_btrace) (struct target_ops *, enum btrace_format)
1063 TARGET_DEFAULT_RETURN (0);
1064
1065 /* Enable branch tracing for PTID using CONF configuration.
1066 Return a branch trace target information struct for reading and for
1067 disabling branch trace. */
1068 struct btrace_target_info *(*to_enable_btrace) (struct target_ops *,
1069 ptid_t ptid,
1070 const struct btrace_config *conf)
1071 TARGET_DEFAULT_NORETURN (tcomplain ());
1072
1073 /* Disable branch tracing and deallocate TINFO. */
1074 void (*to_disable_btrace) (struct target_ops *,
1075 struct btrace_target_info *tinfo)
1076 TARGET_DEFAULT_NORETURN (tcomplain ());
1077
1078 /* Disable branch tracing and deallocate TINFO. This function is similar
1079 to to_disable_btrace, except that it is called during teardown and is
1080 only allowed to perform actions that are safe. A counter-example would
1081 be attempting to talk to a remote target. */
1082 void (*to_teardown_btrace) (struct target_ops *,
1083 struct btrace_target_info *tinfo)
1084 TARGET_DEFAULT_NORETURN (tcomplain ());
1085
1086 /* Read branch trace data for the thread indicated by BTINFO into DATA.
1087 DATA is cleared before new trace is added. */
1088 enum btrace_error (*to_read_btrace) (struct target_ops *self,
1089 struct btrace_data *data,
1090 struct btrace_target_info *btinfo,
1091 enum btrace_read_type type)
1092 TARGET_DEFAULT_NORETURN (tcomplain ());
1093
1094 /* Get the branch trace configuration. */
1095 const struct btrace_config *(*to_btrace_conf) (struct target_ops *self,
1096 const struct btrace_target_info *)
1097 TARGET_DEFAULT_RETURN (NULL);
1098
1099 /* Stop trace recording. */
1100 void (*to_stop_recording) (struct target_ops *)
1101 TARGET_DEFAULT_IGNORE ();
1102
1103 /* Print information about the recording. */
1104 void (*to_info_record) (struct target_ops *)
1105 TARGET_DEFAULT_IGNORE ();
1106
1107 /* Save the recorded execution trace into a file. */
1108 void (*to_save_record) (struct target_ops *, const char *filename)
1109 TARGET_DEFAULT_NORETURN (tcomplain ());
1110
1111 /* Delete the recorded execution trace from the current position
1112 onwards. */
1113 void (*to_delete_record) (struct target_ops *)
1114 TARGET_DEFAULT_NORETURN (tcomplain ());
1115
1116 /* Query if the record target is currently replaying. */
1117 int (*to_record_is_replaying) (struct target_ops *)
1118 TARGET_DEFAULT_RETURN (0);
1119
1120 /* Go to the begin of the execution trace. */
1121 void (*to_goto_record_begin) (struct target_ops *)
1122 TARGET_DEFAULT_NORETURN (tcomplain ());
1123
1124 /* Go to the end of the execution trace. */
1125 void (*to_goto_record_end) (struct target_ops *)
1126 TARGET_DEFAULT_NORETURN (tcomplain ());
1127
1128 /* Go to a specific location in the recorded execution trace. */
1129 void (*to_goto_record) (struct target_ops *, ULONGEST insn)
1130 TARGET_DEFAULT_NORETURN (tcomplain ());
1131
1132 /* Disassemble SIZE instructions in the recorded execution trace from
1133 the current position.
1134 If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
1135 disassemble SIZE succeeding instructions. */
1136 void (*to_insn_history) (struct target_ops *, int size, int flags)
1137 TARGET_DEFAULT_NORETURN (tcomplain ());
1138
1139 /* Disassemble SIZE instructions in the recorded execution trace around
1140 FROM.
1141 If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
1142 disassemble SIZE instructions after FROM. */
1143 void (*to_insn_history_from) (struct target_ops *,
1144 ULONGEST from, int size, int flags)
1145 TARGET_DEFAULT_NORETURN (tcomplain ());
1146
1147 /* Disassemble a section of the recorded execution trace from instruction
1148 BEGIN (inclusive) to instruction END (inclusive). */
1149 void (*to_insn_history_range) (struct target_ops *,
1150 ULONGEST begin, ULONGEST end, int flags)
1151 TARGET_DEFAULT_NORETURN (tcomplain ());
1152
1153 /* Print a function trace of the recorded execution trace.
1154 If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
1155 succeeding functions. */
1156 void (*to_call_history) (struct target_ops *, int size, int flags)
1157 TARGET_DEFAULT_NORETURN (tcomplain ());
1158
1159 /* Print a function trace of the recorded execution trace starting
1160 at function FROM.
1161 If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
1162 SIZE functions after FROM. */
1163 void (*to_call_history_from) (struct target_ops *,
1164 ULONGEST begin, int size, int flags)
1165 TARGET_DEFAULT_NORETURN (tcomplain ());
1166
1167 /* Print a function trace of an execution trace section from function BEGIN
1168 (inclusive) to function END (inclusive). */
1169 void (*to_call_history_range) (struct target_ops *,
1170 ULONGEST begin, ULONGEST end, int flags)
1171 TARGET_DEFAULT_NORETURN (tcomplain ());
1172
1173 /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
1174 non-empty annex. */
1175 int (*to_augmented_libraries_svr4_read) (struct target_ops *)
1176 TARGET_DEFAULT_RETURN (0);
1177
1178 /* Those unwinders are tried before any other arch unwinders. If
1179 SELF doesn't have unwinders, it should delegate to the
1180 "beneath" target. */
1181 const struct frame_unwind *(*to_get_unwinder) (struct target_ops *self)
1182 TARGET_DEFAULT_RETURN (NULL);
1183
1184 const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self)
1185 TARGET_DEFAULT_RETURN (NULL);
1186
1187 /* Prepare to generate a core file. */
1188 void (*to_prepare_to_generate_core) (struct target_ops *)
1189 TARGET_DEFAULT_IGNORE ();
1190
1191 /* Cleanup after generating a core file. */
1192 void (*to_done_generating_core) (struct target_ops *)
1193 TARGET_DEFAULT_IGNORE ();
1194
1195 int to_magic;
1196 /* Need sub-structure for target machine related rather than comm related?
1197 */
1198 };
1199
1200 /* Magic number for checking ops size. If a struct doesn't end with this
1201 number, somebody changed the declaration but didn't change all the
1202 places that initialize one. */
1203
1204 #define OPS_MAGIC 3840
1205
1206 /* The ops structure for our "current" target process. This should
1207 never be NULL. If there is no target, it points to the dummy_target. */
1208
1209 extern struct target_ops current_target;
1210
1211 /* Define easy words for doing these operations on our current target. */
1212
1213 #define target_shortname (current_target.to_shortname)
1214 #define target_longname (current_target.to_longname)
1215
1216 /* Does whatever cleanup is required for a target that we are no
1217 longer going to be calling. This routine is automatically always
1218 called after popping the target off the target stack - the target's
1219 own methods are no longer available through the target vector.
1220 Closing file descriptors and freeing all memory allocated memory are
1221 typical things it should do. */
1222
1223 void target_close (struct target_ops *targ);
1224
1225 /* Find the correct target to use for "attach". If a target on the
1226 current stack supports attaching, then it is returned. Otherwise,
1227 the default run target is returned. */
1228
1229 extern struct target_ops *find_attach_target (void);
1230
1231 /* Find the correct target to use for "run". If a target on the
1232 current stack supports creating a new inferior, then it is
1233 returned. Otherwise, the default run target is returned. */
1234
1235 extern struct target_ops *find_run_target (void);
1236
1237 /* Some targets don't generate traps when attaching to the inferior,
1238 or their target_attach implementation takes care of the waiting.
1239 These targets must set to_attach_no_wait. */
1240
1241 #define target_attach_no_wait \
1242 (current_target.to_attach_no_wait)
1243
1244 /* The target_attach operation places a process under debugger control,
1245 and stops the process.
1246
1247 This operation provides a target-specific hook that allows the
1248 necessary bookkeeping to be performed after an attach completes. */
1249 #define target_post_attach(pid) \
1250 (*current_target.to_post_attach) (&current_target, pid)
1251
1252 /* Takes a program previously attached to and detaches it.
1253 The program may resume execution (some targets do, some don't) and will
1254 no longer stop on signals, etc. We better not have left any breakpoints
1255 in the program or it'll die when it hits one. ARGS is arguments
1256 typed by the user (e.g. a signal to send the process). FROM_TTY
1257 says whether to be verbose or not. */
1258
1259 extern void target_detach (const char *, int);
1260
1261 /* Disconnect from the current target without resuming it (leaving it
1262 waiting for a debugger). */
1263
1264 extern void target_disconnect (const char *, int);
1265
1266 /* Resume execution of the target process PTID (or a group of
1267 threads). STEP says whether to single-step or to run free; SIGGNAL
1268 is the signal to be given to the target, or GDB_SIGNAL_0 for no
1269 signal. The caller may not pass GDB_SIGNAL_DEFAULT. A specific
1270 PTID means `step/resume only this process id'. A wildcard PTID
1271 (all threads, or all threads of process) means `step/resume
1272 INFERIOR_PTID, and let other threads (for which the wildcard PTID
1273 matches) resume with their 'thread->suspend.stop_signal' signal
1274 (usually GDB_SIGNAL_0) if it is in "pass" state, or with no signal
1275 if in "no pass" state. */
1276
1277 extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal);
1278
1279 /* Wait for process pid to do something. PTID = -1 to wait for any
1280 pid to do something. Return pid of child, or -1 in case of error;
1281 store status through argument pointer STATUS. Note that it is
1282 _NOT_ OK to throw_exception() out of target_wait() without popping
1283 the debugging target from the stack; GDB isn't prepared to get back
1284 to the prompt with a debugging target but without the frame cache,
1285 stop_pc, etc., set up. OPTIONS is a bitwise OR of TARGET_W*
1286 options. */
1287
1288 extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
1289 int options);
1290
1291 /* Fetch at least register REGNO, or all regs if regno == -1. No result. */
1292
1293 extern void target_fetch_registers (struct regcache *regcache, int regno);
1294
1295 /* Store at least register REGNO, or all regs if REGNO == -1.
1296 It can store as many registers as it wants to, so target_prepare_to_store
1297 must have been previously called. Calls error() if there are problems. */
1298
1299 extern void target_store_registers (struct regcache *regcache, int regs);
1300
1301 /* Get ready to modify the registers array. On machines which store
1302 individual registers, this doesn't need to do anything. On machines
1303 which store all the registers in one fell swoop, this makes sure
1304 that REGISTERS contains all the registers from the program being
1305 debugged. */
1306
1307 #define target_prepare_to_store(regcache) \
1308 (*current_target.to_prepare_to_store) (&current_target, regcache)
1309
1310 /* Determine current address space of thread PTID. */
1311
1312 struct address_space *target_thread_address_space (ptid_t);
1313
1314 /* Implement the "info proc" command. This returns one if the request
1315 was handled, and zero otherwise. It can also throw an exception if
1316 an error was encountered while attempting to handle the
1317 request. */
1318
1319 int target_info_proc (const char *, enum info_proc_what);
1320
1321 /* Returns true if this target can debug multiple processes
1322 simultaneously. */
1323
1324 #define target_supports_multi_process() \
1325 (*current_target.to_supports_multi_process) (&current_target)
1326
1327 /* Returns true if this target can disable address space randomization. */
1328
1329 int target_supports_disable_randomization (void);
1330
1331 /* Returns true if this target can enable and disable tracepoints
1332 while a trace experiment is running. */
1333
1334 #define target_supports_enable_disable_tracepoint() \
1335 (*current_target.to_supports_enable_disable_tracepoint) (&current_target)
1336
1337 #define target_supports_string_tracing() \
1338 (*current_target.to_supports_string_tracing) (&current_target)
1339
1340 /* Returns true if this target can handle breakpoint conditions
1341 on its end. */
1342
1343 #define target_supports_evaluation_of_breakpoint_conditions() \
1344 (*current_target.to_supports_evaluation_of_breakpoint_conditions) (&current_target)
1345
1346 /* Returns true if this target can handle breakpoint commands
1347 on its end. */
1348
1349 #define target_can_run_breakpoint_commands() \
1350 (*current_target.to_can_run_breakpoint_commands) (&current_target)
1351
1352 extern int target_read_string (CORE_ADDR, char **, int, int *);
1353
1354 /* For target_read_memory see target/target.h. */
1355
1356 extern int target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
1357 ssize_t len);
1358
1359 extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
1360
1361 extern int target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
1362
1363 /* For target_write_memory see target/target.h. */
1364
1365 extern int target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
1366 ssize_t len);
1367
1368 /* Fetches the target's memory map. If one is found it is sorted
1369 and returned, after some consistency checking. Otherwise, NULL
1370 is returned. */
1371 VEC(mem_region_s) *target_memory_map (void);
1372
1373 /* Erase the specified flash region. */
1374 void target_flash_erase (ULONGEST address, LONGEST length);
1375
1376 /* Finish a sequence of flash operations. */
1377 void target_flash_done (void);
1378
1379 /* Describes a request for a memory write operation. */
1380 struct memory_write_request
1381 {
1382 /* Begining address that must be written. */
1383 ULONGEST begin;
1384 /* Past-the-end address. */
1385 ULONGEST end;
1386 /* The data to write. */
1387 gdb_byte *data;
1388 /* A callback baton for progress reporting for this request. */
1389 void *baton;
1390 };
1391 typedef struct memory_write_request memory_write_request_s;
1392 DEF_VEC_O(memory_write_request_s);
1393
1394 /* Enumeration specifying different flash preservation behaviour. */
1395 enum flash_preserve_mode
1396 {
1397 flash_preserve,
1398 flash_discard
1399 };
1400
1401 /* Write several memory blocks at once. This version can be more
1402 efficient than making several calls to target_write_memory, in
1403 particular because it can optimize accesses to flash memory.
1404
1405 Moreover, this is currently the only memory access function in gdb
1406 that supports writing to flash memory, and it should be used for
1407 all cases where access to flash memory is desirable.
1408
1409 REQUESTS is the vector (see vec.h) of memory_write_request.
1410 PRESERVE_FLASH_P indicates what to do with blocks which must be
1411 erased, but not completely rewritten.
1412 PROGRESS_CB is a function that will be periodically called to provide
1413 feedback to user. It will be called with the baton corresponding
1414 to the request currently being written. It may also be called
1415 with a NULL baton, when preserved flash sectors are being rewritten.
1416
1417 The function returns 0 on success, and error otherwise. */
1418 int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
1419 enum flash_preserve_mode preserve_flash_p,
1420 void (*progress_cb) (ULONGEST, void *));
1421
1422 /* Print a line about the current target. */
1423
1424 #define target_files_info() \
1425 (*current_target.to_files_info) (&current_target)
1426
1427 /* Insert a breakpoint at address BP_TGT->placed_address in
1428 the target machine. Returns 0 for success, and returns non-zero or
1429 throws an error (with a detailed failure reason error code and
1430 message) otherwise. */
1431
1432 extern int target_insert_breakpoint (struct gdbarch *gdbarch,
1433 struct bp_target_info *bp_tgt);
1434
1435 /* Remove a breakpoint at address BP_TGT->placed_address in the target
1436 machine. Result is 0 for success, non-zero for error. */
1437
1438 extern int target_remove_breakpoint (struct gdbarch *gdbarch,
1439 struct bp_target_info *bp_tgt);
1440
1441 /* Returns true if the terminal settings of the inferior are in
1442 effect. */
1443
1444 extern int target_terminal_is_inferior (void);
1445
1446 /* Initialize the terminal settings we record for the inferior,
1447 before we actually run the inferior. */
1448
1449 extern void target_terminal_init (void);
1450
1451 /* Put the inferior's terminal settings into effect.
1452 This is preparation for starting or resuming the inferior. */
1453
1454 extern void target_terminal_inferior (void);
1455
1456 /* Put some of our terminal settings into effect, enough to get proper
1457 results from our output, but do not change into or out of RAW mode
1458 so that no input is discarded. This is a no-op if terminal_ours
1459 was most recently called. */
1460
1461 extern void target_terminal_ours_for_output (void);
1462
1463 /* Put our terminal settings into effect.
1464 First record the inferior's terminal settings
1465 so they can be restored properly later. */
1466
1467 extern void target_terminal_ours (void);
1468
1469 /* Return true if the target stack has a non-default
1470 "to_terminal_ours" method. */
1471
1472 extern int target_supports_terminal_ours (void);
1473
1474 /* Make a cleanup that restores the state of the terminal to the current
1475 state. */
1476 extern struct cleanup *make_cleanup_restore_target_terminal (void);
1477
1478 /* Print useful information about our terminal status, if such a thing
1479 exists. */
1480
1481 #define target_terminal_info(arg, from_tty) \
1482 (*current_target.to_terminal_info) (&current_target, arg, from_tty)
1483
1484 /* Kill the inferior process. Make it go away. */
1485
1486 extern void target_kill (void);
1487
1488 /* Load an executable file into the target process. This is expected
1489 to not only bring new code into the target process, but also to
1490 update GDB's symbol tables to match.
1491
1492 ARG contains command-line arguments, to be broken down with
1493 buildargv (). The first non-switch argument is the filename to
1494 load, FILE; the second is a number (as parsed by strtoul (..., ...,
1495 0)), which is an offset to apply to the load addresses of FILE's
1496 sections. The target may define switches, or other non-switch
1497 arguments, as it pleases. */
1498
1499 extern void target_load (const char *arg, int from_tty);
1500
1501 /* Some targets (such as ttrace-based HPUX) don't allow us to request
1502 notification of inferior events such as fork and vork immediately
1503 after the inferior is created. (This because of how gdb gets an
1504 inferior created via invoking a shell to do it. In such a scenario,
1505 if the shell init file has commands in it, the shell will fork and
1506 exec for each of those commands, and we will see each such fork
1507 event. Very bad.)
1508
1509 Such targets will supply an appropriate definition for this function. */
1510
1511 #define target_post_startup_inferior(ptid) \
1512 (*current_target.to_post_startup_inferior) (&current_target, ptid)
1513
1514 /* On some targets, we can catch an inferior fork or vfork event when
1515 it occurs. These functions insert/remove an already-created
1516 catchpoint for such events. They return 0 for success, 1 if the
1517 catchpoint type is not supported and -1 for failure. */
1518
1519 #define target_insert_fork_catchpoint(pid) \
1520 (*current_target.to_insert_fork_catchpoint) (&current_target, pid)
1521
1522 #define target_remove_fork_catchpoint(pid) \
1523 (*current_target.to_remove_fork_catchpoint) (&current_target, pid)
1524
1525 #define target_insert_vfork_catchpoint(pid) \
1526 (*current_target.to_insert_vfork_catchpoint) (&current_target, pid)
1527
1528 #define target_remove_vfork_catchpoint(pid) \
1529 (*current_target.to_remove_vfork_catchpoint) (&current_target, pid)
1530
1531 /* If the inferior forks or vforks, this function will be called at
1532 the next resume in order to perform any bookkeeping and fiddling
1533 necessary to continue debugging either the parent or child, as
1534 requested, and releasing the other. Information about the fork
1535 or vfork event is available via get_last_target_status ().
1536 This function returns 1 if the inferior should not be resumed
1537 (i.e. there is another event pending). */
1538
1539 int target_follow_fork (int follow_child, int detach_fork);
1540
1541 /* On some targets, we can catch an inferior exec event when it
1542 occurs. These functions insert/remove an already-created
1543 catchpoint for such events. They return 0 for success, 1 if the
1544 catchpoint type is not supported and -1 for failure. */
1545
1546 #define target_insert_exec_catchpoint(pid) \
1547 (*current_target.to_insert_exec_catchpoint) (&current_target, pid)
1548
1549 #define target_remove_exec_catchpoint(pid) \
1550 (*current_target.to_remove_exec_catchpoint) (&current_target, pid)
1551
1552 /* Syscall catch.
1553
1554 NEEDED is nonzero if any syscall catch (of any kind) is requested.
1555 If NEEDED is zero, it means the target can disable the mechanism to
1556 catch system calls because there are no more catchpoints of this type.
1557
1558 ANY_COUNT is nonzero if a generic (filter-less) syscall catch is
1559 being requested. In this case, both TABLE_SIZE and TABLE should
1560 be ignored.
1561
1562 TABLE_SIZE is the number of elements in TABLE. It only matters if
1563 ANY_COUNT is zero.
1564
1565 TABLE is an array of ints, indexed by syscall number. An element in
1566 this array is nonzero if that syscall should be caught. This argument
1567 only matters if ANY_COUNT is zero.
1568
1569 Return 0 for success, 1 if syscall catchpoints are not supported or -1
1570 for failure. */
1571
1572 #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \
1573 (*current_target.to_set_syscall_catchpoint) (&current_target, \
1574 pid, needed, any_count, \
1575 table_size, table)
1576
1577 /* Returns TRUE if PID has exited. And, also sets EXIT_STATUS to the
1578 exit code of PID, if any. */
1579
1580 #define target_has_exited(pid,wait_status,exit_status) \
1581 (*current_target.to_has_exited) (&current_target, \
1582 pid,wait_status,exit_status)
1583
1584 /* The debugger has completed a blocking wait() call. There is now
1585 some process event that must be processed. This function should
1586 be defined by those targets that require the debugger to perform
1587 cleanup or internal state changes in response to the process event. */
1588
1589 /* The inferior process has died. Do what is right. */
1590
1591 void target_mourn_inferior (void);
1592
1593 /* Does target have enough data to do a run or attach command? */
1594
1595 #define target_can_run(t) \
1596 ((t)->to_can_run) (t)
1597
1598 /* Set list of signals to be handled in the target.
1599
1600 PASS_SIGNALS is an array of size NSIG, indexed by target signal number
1601 (enum gdb_signal). For every signal whose entry in this array is
1602 non-zero, the target is allowed -but not required- to skip reporting
1603 arrival of the signal to the GDB core by returning from target_wait,
1604 and to pass the signal directly to the inferior instead.
1605
1606 However, if the target is hardware single-stepping a thread that is
1607 about to receive a signal, it needs to be reported in any case, even
1608 if mentioned in a previous target_pass_signals call. */
1609
1610 extern void target_pass_signals (int nsig, unsigned char *pass_signals);
1611
1612 /* Set list of signals the target may pass to the inferior. This
1613 directly maps to the "handle SIGNAL pass/nopass" setting.
1614
1615 PROGRAM_SIGNALS is an array of size NSIG, indexed by target signal
1616 number (enum gdb_signal). For every signal whose entry in this
1617 array is non-zero, the target is allowed to pass the signal to the
1618 inferior. Signals not present in the array shall be silently
1619 discarded. This does not influence whether to pass signals to the
1620 inferior as a result of a target_resume call. This is useful in
1621 scenarios where the target needs to decide whether to pass or not a
1622 signal to the inferior without GDB core involvement, such as for
1623 example, when detaching (as threads may have been suspended with
1624 pending signals not reported to GDB). */
1625
1626 extern void target_program_signals (int nsig, unsigned char *program_signals);
1627
1628 /* Check to see if a thread is still alive. */
1629
1630 extern int target_thread_alive (ptid_t ptid);
1631
1632 /* Sync the target's threads with GDB's thread list. */
1633
1634 extern void target_update_thread_list (void);
1635
1636 /* Make target stop in a continuable fashion. (For instance, under
1637 Unix, this should act like SIGSTOP). Note that this function is
1638 asynchronous: it does not wait for the target to become stopped
1639 before returning. If this is the behavior you want please use
1640 target_stop_and_wait. */
1641
1642 extern void target_stop (ptid_t ptid);
1643
1644 /* Send the specified COMMAND to the target's monitor
1645 (shell,interpreter) for execution. The result of the query is
1646 placed in OUTBUF. */
1647
1648 #define target_rcmd(command, outbuf) \
1649 (*current_target.to_rcmd) (&current_target, command, outbuf)
1650
1651
1652 /* Does the target include all of memory, or only part of it? This
1653 determines whether we look up the target chain for other parts of
1654 memory if this target can't satisfy a request. */
1655
1656 extern int target_has_all_memory_1 (void);
1657 #define target_has_all_memory target_has_all_memory_1 ()
1658
1659 /* Does the target include memory? (Dummy targets don't.) */
1660
1661 extern int target_has_memory_1 (void);
1662 #define target_has_memory target_has_memory_1 ()
1663
1664 /* Does the target have a stack? (Exec files don't, VxWorks doesn't, until
1665 we start a process.) */
1666
1667 extern int target_has_stack_1 (void);
1668 #define target_has_stack target_has_stack_1 ()
1669
1670 /* Does the target have registers? (Exec files don't.) */
1671
1672 extern int target_has_registers_1 (void);
1673 #define target_has_registers target_has_registers_1 ()
1674
1675 /* Does the target have execution? Can we make it jump (through
1676 hoops), or pop its stack a few times? This means that the current
1677 target is currently executing; for some targets, that's the same as
1678 whether or not the target is capable of execution, but there are
1679 also targets which can be current while not executing. In that
1680 case this will become true after to_create_inferior or
1681 to_attach. */
1682
1683 extern int target_has_execution_1 (ptid_t);
1684
1685 /* Like target_has_execution_1, but always passes inferior_ptid. */
1686
1687 extern int target_has_execution_current (void);
1688
1689 #define target_has_execution target_has_execution_current ()
1690
1691 /* Default implementations for process_stratum targets. Return true
1692 if there's a selected inferior, false otherwise. */
1693
1694 extern int default_child_has_all_memory (struct target_ops *ops);
1695 extern int default_child_has_memory (struct target_ops *ops);
1696 extern int default_child_has_stack (struct target_ops *ops);
1697 extern int default_child_has_registers (struct target_ops *ops);
1698 extern int default_child_has_execution (struct target_ops *ops,
1699 ptid_t the_ptid);
1700
1701 /* Can the target support the debugger control of thread execution?
1702 Can it lock the thread scheduler? */
1703
1704 #define target_can_lock_scheduler \
1705 (current_target.to_has_thread_control & tc_schedlock)
1706
1707 /* Controls whether async mode is permitted. */
1708 extern int target_async_permitted;
1709
1710 /* Can the target support asynchronous execution? */
1711 #define target_can_async_p() (current_target.to_can_async_p (&current_target))
1712
1713 /* Is the target in asynchronous execution mode? */
1714 #define target_is_async_p() (current_target.to_is_async_p (&current_target))
1715
1716 /* Enables/disabled async target events. */
1717 #define target_async(ENABLE) \
1718 (current_target.to_async (&current_target, (ENABLE)))
1719
1720 #define target_execution_direction() \
1721 (current_target.to_execution_direction (&current_target))
1722
1723 /* Converts a process id to a string. Usually, the string just contains
1724 `process xyz', but on some systems it may contain
1725 `process xyz thread abc'. */
1726
1727 extern char *target_pid_to_str (ptid_t ptid);
1728
1729 extern char *normal_pid_to_str (ptid_t ptid);
1730
1731 /* Return a short string describing extra information about PID,
1732 e.g. "sleeping", "runnable", "running on LWP 3". Null return value
1733 is okay. */
1734
1735 #define target_extra_thread_info(TP) \
1736 (current_target.to_extra_thread_info (&current_target, TP))
1737
1738 /* Return the thread's name. A NULL result means that the target
1739 could not determine this thread's name. */
1740
1741 extern char *target_thread_name (struct thread_info *);
1742
1743 /* Attempts to find the pathname of the executable file
1744 that was run to create a specified process.
1745
1746 The process PID must be stopped when this operation is used.
1747
1748 If the executable file cannot be determined, NULL is returned.
1749
1750 Else, a pointer to a character string containing the pathname
1751 is returned. This string should be copied into a buffer by
1752 the client if the string will not be immediately used, or if
1753 it must persist. */
1754
1755 #define target_pid_to_exec_file(pid) \
1756 (current_target.to_pid_to_exec_file) (&current_target, pid)
1757
1758 /* See the to_thread_architecture description in struct target_ops. */
1759
1760 #define target_thread_architecture(ptid) \
1761 (current_target.to_thread_architecture (&current_target, ptid))
1762
1763 /*
1764 * Iterator function for target memory regions.
1765 * Calls a callback function once for each memory region 'mapped'
1766 * in the child process. Defined as a simple macro rather than
1767 * as a function macro so that it can be tested for nullity.
1768 */
1769
1770 #define target_find_memory_regions(FUNC, DATA) \
1771 (current_target.to_find_memory_regions) (&current_target, FUNC, DATA)
1772
1773 /*
1774 * Compose corefile .note section.
1775 */
1776
1777 #define target_make_corefile_notes(BFD, SIZE_P) \
1778 (current_target.to_make_corefile_notes) (&current_target, BFD, SIZE_P)
1779
1780 /* Bookmark interfaces. */
1781 #define target_get_bookmark(ARGS, FROM_TTY) \
1782 (current_target.to_get_bookmark) (&current_target, ARGS, FROM_TTY)
1783
1784 #define target_goto_bookmark(ARG, FROM_TTY) \
1785 (current_target.to_goto_bookmark) (&current_target, ARG, FROM_TTY)
1786
1787 /* Hardware watchpoint interfaces. */
1788
1789 /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
1790 write). Only the INFERIOR_PTID task is being queried. */
1791
1792 #define target_stopped_by_watchpoint() \
1793 ((*current_target.to_stopped_by_watchpoint) (&current_target))
1794
1795 /* Returns non-zero if the target stopped because it executed a
1796 software breakpoint instruction. */
1797
1798 #define target_stopped_by_sw_breakpoint() \
1799 ((*current_target.to_stopped_by_sw_breakpoint) (&current_target))
1800
1801 #define target_supports_stopped_by_sw_breakpoint() \
1802 ((*current_target.to_supports_stopped_by_sw_breakpoint) (&current_target))
1803
1804 #define target_stopped_by_hw_breakpoint() \
1805 ((*current_target.to_stopped_by_hw_breakpoint) (&current_target))
1806
1807 #define target_supports_stopped_by_hw_breakpoint() \
1808 ((*current_target.to_supports_stopped_by_hw_breakpoint) (&current_target))
1809
1810 /* Non-zero if we have steppable watchpoints */
1811
1812 #define target_have_steppable_watchpoint \
1813 (current_target.to_have_steppable_watchpoint)
1814
1815 /* Non-zero if we have continuable watchpoints */
1816
1817 #define target_have_continuable_watchpoint \
1818 (current_target.to_have_continuable_watchpoint)
1819
1820 /* Provide defaults for hardware watchpoint functions. */
1821
1822 /* If the *_hw_beakpoint functions have not been defined
1823 elsewhere use the definitions in the target vector. */
1824
1825 /* Returns positive if we can set a hardware watchpoint of type TYPE.
1826 Returns negative if the target doesn't have enough hardware debug
1827 registers available. Return zero if hardware watchpoint of type
1828 TYPE isn't supported. TYPE is one of bp_hardware_watchpoint,
1829 bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
1830 CNT is the number of such watchpoints used so far, including this
1831 one. OTHERTYPE is who knows what... */
1832
1833 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
1834 (*current_target.to_can_use_hw_breakpoint) (&current_target, \
1835 TYPE, CNT, OTHERTYPE)
1836
1837 /* Returns the number of debug registers needed to watch the given
1838 memory region, or zero if not supported. */
1839
1840 #define target_region_ok_for_hw_watchpoint(addr, len) \
1841 (*current_target.to_region_ok_for_hw_watchpoint) (&current_target, \
1842 addr, len)
1843
1844
1845 /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
1846 TYPE is 0 for write, 1 for read, and 2 for read/write accesses.
1847 COND is the expression for its condition, or NULL if there's none.
1848 Returns 0 for success, 1 if the watchpoint type is not supported,
1849 -1 for failure. */
1850
1851 #define target_insert_watchpoint(addr, len, type, cond) \
1852 (*current_target.to_insert_watchpoint) (&current_target, \
1853 addr, len, type, cond)
1854
1855 #define target_remove_watchpoint(addr, len, type, cond) \
1856 (*current_target.to_remove_watchpoint) (&current_target, \
1857 addr, len, type, cond)
1858
1859 /* Insert a new masked watchpoint at ADDR using the mask MASK.
1860 RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
1861 or hw_access for an access watchpoint. Returns 0 for success, 1 if
1862 masked watchpoints are not supported, -1 for failure. */
1863
1864 extern int target_insert_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
1865
1866 /* Remove a masked watchpoint at ADDR with the mask MASK.
1867 RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
1868 or hw_access for an access watchpoint. Returns 0 for success, non-zero
1869 for failure. */
1870
1871 extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
1872
1873 /* Insert a hardware breakpoint at address BP_TGT->placed_address in
1874 the target machine. Returns 0 for success, and returns non-zero or
1875 throws an error (with a detailed failure reason error code and
1876 message) otherwise. */
1877
1878 #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
1879 (*current_target.to_insert_hw_breakpoint) (&current_target, \
1880 gdbarch, bp_tgt)
1881
1882 #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
1883 (*current_target.to_remove_hw_breakpoint) (&current_target, \
1884 gdbarch, bp_tgt)
1885
1886 /* Return number of debug registers needed for a ranged breakpoint,
1887 or -1 if ranged breakpoints are not supported. */
1888
1889 extern int target_ranged_break_num_registers (void);
1890
1891 /* Return non-zero if target knows the data address which triggered this
1892 target_stopped_by_watchpoint, in such case place it to *ADDR_P. Only the
1893 INFERIOR_PTID task is being queried. */
1894 #define target_stopped_data_address(target, addr_p) \
1895 (*(target)->to_stopped_data_address) (target, addr_p)
1896
1897 /* Return non-zero if ADDR is within the range of a watchpoint spanning
1898 LENGTH bytes beginning at START. */
1899 #define target_watchpoint_addr_within_range(target, addr, start, length) \
1900 (*(target)->to_watchpoint_addr_within_range) (target, addr, start, length)
1901
1902 /* Return non-zero if the target is capable of using hardware to evaluate
1903 the condition expression. In this case, if the condition is false when
1904 the watched memory location changes, execution may continue without the
1905 debugger being notified.
1906
1907 Due to limitations in the hardware implementation, it may be capable of
1908 avoiding triggering the watchpoint in some cases where the condition
1909 expression is false, but may report some false positives as well.
1910 For this reason, GDB will still evaluate the condition expression when
1911 the watchpoint triggers. */
1912 #define target_can_accel_watchpoint_condition(addr, len, type, cond) \
1913 (*current_target.to_can_accel_watchpoint_condition) (&current_target, \
1914 addr, len, type, cond)
1915
1916 /* Return number of debug registers needed for a masked watchpoint,
1917 -1 if masked watchpoints are not supported or -2 if the given address
1918 and mask combination cannot be used. */
1919
1920 extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask);
1921
1922 /* Target can execute in reverse? */
1923 #define target_can_execute_reverse \
1924 current_target.to_can_execute_reverse (&current_target)
1925
1926 extern const struct target_desc *target_read_description (struct target_ops *);
1927
1928 #define target_get_ada_task_ptid(lwp, tid) \
1929 (*current_target.to_get_ada_task_ptid) (&current_target, lwp,tid)
1930
1931 /* Utility implementation of searching memory. */
1932 extern int simple_search_memory (struct target_ops* ops,
1933 CORE_ADDR start_addr,
1934 ULONGEST search_space_len,
1935 const gdb_byte *pattern,
1936 ULONGEST pattern_len,
1937 CORE_ADDR *found_addrp);
1938
1939 /* Main entry point for searching memory. */
1940 extern int target_search_memory (CORE_ADDR start_addr,
1941 ULONGEST search_space_len,
1942 const gdb_byte *pattern,
1943 ULONGEST pattern_len,
1944 CORE_ADDR *found_addrp);
1945
1946 /* Target file operations. */
1947
1948 /* Return nonzero if the filesystem seen by the current inferior
1949 is the local filesystem, zero otherwise. */
1950 #define target_filesystem_is_local() \
1951 current_target.to_filesystem_is_local (&current_target)
1952
1953 /* Open FILENAME on the target, in the filesystem as seen by INF,
1954 using FLAGS and MODE. If INF is NULL, use the filesystem seen
1955 by the debugger (GDB or, for remote targets, the remote stub).
1956 Return a target file descriptor, or -1 if an error occurs (and
1957 set *TARGET_ERRNO). */
1958 extern int target_fileio_open (struct inferior *inf,
1959 const char *filename, int flags,
1960 int mode, int *target_errno);
1961
1962 /* Write up to LEN bytes from WRITE_BUF to FD on the target.
1963 Return the number of bytes written, or -1 if an error occurs
1964 (and set *TARGET_ERRNO). */
1965 extern int target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
1966 ULONGEST offset, int *target_errno);
1967
1968 /* Read up to LEN bytes FD on the target into READ_BUF.
1969 Return the number of bytes read, or -1 if an error occurs
1970 (and set *TARGET_ERRNO). */
1971 extern int target_fileio_pread (int fd, gdb_byte *read_buf, int len,
1972 ULONGEST offset, int *target_errno);
1973
1974 /* Get information about the file opened as FD on the target
1975 and put it in SB. Return 0 on success, or -1 if an error
1976 occurs (and set *TARGET_ERRNO). */
1977 extern int target_fileio_fstat (int fd, struct stat *sb,
1978 int *target_errno);
1979
1980 /* Close FD on the target. Return 0, or -1 if an error occurs
1981 (and set *TARGET_ERRNO). */
1982 extern int target_fileio_close (int fd, int *target_errno);
1983
1984 /* Unlink FILENAME on the target, in the filesystem as seen by INF.
1985 If INF is NULL, use the filesystem seen by the debugger (GDB or,
1986 for remote targets, the remote stub). Return 0, or -1 if an error
1987 occurs (and set *TARGET_ERRNO). */
1988 extern int target_fileio_unlink (struct inferior *inf,
1989 const char *filename,
1990 int *target_errno);
1991
1992 /* Read value of symbolic link FILENAME on the target, in the
1993 filesystem as seen by INF. If INF is NULL, use the filesystem seen
1994 by the debugger (GDB or, for remote targets, the remote stub).
1995 Return a null-terminated string allocated via xmalloc, or NULL if
1996 an error occurs (and set *TARGET_ERRNO). */
1997 extern char *target_fileio_readlink (struct inferior *inf,
1998 const char *filename,
1999 int *target_errno);
2000
2001 /* Read target file FILENAME, in the filesystem as seen by INF. If
2002 INF is NULL, use the filesystem seen by the debugger (GDB or, for
2003 remote targets, the remote stub). The return value will be -1 if
2004 the transfer fails or is not supported; 0 if the object is empty;
2005 or the length of the object otherwise. If a positive value is
2006 returned, a sufficiently large buffer will be allocated using
2007 xmalloc and returned in *BUF_P containing the contents of the
2008 object.
2009
2010 This method should be used for objects sufficiently small to store
2011 in a single xmalloc'd buffer, when no fixed bound on the object's
2012 size is known in advance. */
2013 extern LONGEST target_fileio_read_alloc (struct inferior *inf,
2014 const char *filename,
2015 gdb_byte **buf_p);
2016
2017 /* Read target file FILENAME, in the filesystem as seen by INF. If
2018 INF is NULL, use the filesystem seen by the debugger (GDB or, for
2019 remote targets, the remote stub). The result is NUL-terminated and
2020 returned as a string, allocated using xmalloc. If an error occurs
2021 or the transfer is unsupported, NULL is returned. Empty objects
2022 are returned as allocated but empty strings. A warning is issued
2023 if the result contains any embedded NUL bytes. */
2024 extern char *target_fileio_read_stralloc (struct inferior *inf,
2025 const char *filename);
2026
2027
2028 /* Tracepoint-related operations. */
2029
2030 #define target_trace_init() \
2031 (*current_target.to_trace_init) (&current_target)
2032
2033 #define target_download_tracepoint(t) \
2034 (*current_target.to_download_tracepoint) (&current_target, t)
2035
2036 #define target_can_download_tracepoint() \
2037 (*current_target.to_can_download_tracepoint) (&current_target)
2038
2039 #define target_download_trace_state_variable(tsv) \
2040 (*current_target.to_download_trace_state_variable) (&current_target, tsv)
2041
2042 #define target_enable_tracepoint(loc) \
2043 (*current_target.to_enable_tracepoint) (&current_target, loc)
2044
2045 #define target_disable_tracepoint(loc) \
2046 (*current_target.to_disable_tracepoint) (&current_target, loc)
2047
2048 #define target_trace_start() \
2049 (*current_target.to_trace_start) (&current_target)
2050
2051 #define target_trace_set_readonly_regions() \
2052 (*current_target.to_trace_set_readonly_regions) (&current_target)
2053
2054 #define target_get_trace_status(ts) \
2055 (*current_target.to_get_trace_status) (&current_target, ts)
2056
2057 #define target_get_tracepoint_status(tp,utp) \
2058 (*current_target.to_get_tracepoint_status) (&current_target, tp, utp)
2059
2060 #define target_trace_stop() \
2061 (*current_target.to_trace_stop) (&current_target)
2062
2063 #define target_trace_find(type,num,addr1,addr2,tpp) \
2064 (*current_target.to_trace_find) (&current_target, \
2065 (type), (num), (addr1), (addr2), (tpp))
2066
2067 #define target_get_trace_state_variable_value(tsv,val) \
2068 (*current_target.to_get_trace_state_variable_value) (&current_target, \
2069 (tsv), (val))
2070
2071 #define target_save_trace_data(filename) \
2072 (*current_target.to_save_trace_data) (&current_target, filename)
2073
2074 #define target_upload_tracepoints(utpp) \
2075 (*current_target.to_upload_tracepoints) (&current_target, utpp)
2076
2077 #define target_upload_trace_state_variables(utsvp) \
2078 (*current_target.to_upload_trace_state_variables) (&current_target, utsvp)
2079
2080 #define target_get_raw_trace_data(buf,offset,len) \
2081 (*current_target.to_get_raw_trace_data) (&current_target, \
2082 (buf), (offset), (len))
2083
2084 #define target_get_min_fast_tracepoint_insn_len() \
2085 (*current_target.to_get_min_fast_tracepoint_insn_len) (&current_target)
2086
2087 #define target_set_disconnected_tracing(val) \
2088 (*current_target.to_set_disconnected_tracing) (&current_target, val)
2089
2090 #define target_set_circular_trace_buffer(val) \
2091 (*current_target.to_set_circular_trace_buffer) (&current_target, val)
2092
2093 #define target_set_trace_buffer_size(val) \
2094 (*current_target.to_set_trace_buffer_size) (&current_target, val)
2095
2096 #define target_set_trace_notes(user,notes,stopnotes) \
2097 (*current_target.to_set_trace_notes) (&current_target, \
2098 (user), (notes), (stopnotes))
2099
2100 #define target_get_tib_address(ptid, addr) \
2101 (*current_target.to_get_tib_address) (&current_target, (ptid), (addr))
2102
2103 #define target_set_permissions() \
2104 (*current_target.to_set_permissions) (&current_target)
2105
2106 #define target_static_tracepoint_marker_at(addr, marker) \
2107 (*current_target.to_static_tracepoint_marker_at) (&current_target, \
2108 addr, marker)
2109
2110 #define target_static_tracepoint_markers_by_strid(marker_id) \
2111 (*current_target.to_static_tracepoint_markers_by_strid) (&current_target, \
2112 marker_id)
2113
2114 #define target_traceframe_info() \
2115 (*current_target.to_traceframe_info) (&current_target)
2116
2117 #define target_use_agent(use) \
2118 (*current_target.to_use_agent) (&current_target, use)
2119
2120 #define target_can_use_agent() \
2121 (*current_target.to_can_use_agent) (&current_target)
2122
2123 #define target_augmented_libraries_svr4_read() \
2124 (*current_target.to_augmented_libraries_svr4_read) (&current_target)
2125
2126 /* Command logging facility. */
2127
2128 #define target_log_command(p) \
2129 (*current_target.to_log_command) (&current_target, p)
2130
2131
2132 extern int target_core_of_thread (ptid_t ptid);
2133
2134 /* See to_get_unwinder in struct target_ops. */
2135 extern const struct frame_unwind *target_get_unwinder (void);
2136
2137 /* See to_get_tailcall_unwinder in struct target_ops. */
2138 extern const struct frame_unwind *target_get_tailcall_unwinder (void);
2139
2140 /* This implements basic memory verification, reading target memory
2141 and performing the comparison here (as opposed to accelerated
2142 verification making use of the qCRC packet, for example). */
2143
2144 extern int simple_verify_memory (struct target_ops* ops,
2145 const gdb_byte *data,
2146 CORE_ADDR memaddr, ULONGEST size);
2147
2148 /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range matches
2149 the contents of [DATA,DATA+SIZE). Returns 1 if there's a match, 0
2150 if there's a mismatch, and -1 if an error is encountered while
2151 reading memory. Throws an error if the functionality is found not
2152 to be supported by the current target. */
2153 int target_verify_memory (const gdb_byte *data,
2154 CORE_ADDR memaddr, ULONGEST size);
2155
2156 /* Routines for maintenance of the target structures...
2157
2158 complete_target_initialization: Finalize a target_ops by filling in
2159 any fields needed by the target implementation. Unnecessary for
2160 targets which are registered via add_target, as this part gets
2161 taken care of then.
2162
2163 add_target: Add a target to the list of all possible targets.
2164 This only makes sense for targets that should be activated using
2165 the "target TARGET_NAME ..." command.
2166
2167 push_target: Make this target the top of the stack of currently used
2168 targets, within its particular stratum of the stack. Result
2169 is 0 if now atop the stack, nonzero if not on top (maybe
2170 should warn user).
2171
2172 unpush_target: Remove this from the stack of currently used targets,
2173 no matter where it is on the list. Returns 0 if no
2174 change, 1 if removed from stack. */
2175
2176 extern void add_target (struct target_ops *);
2177
2178 extern void add_target_with_completer (struct target_ops *t,
2179 completer_ftype *completer);
2180
2181 extern void complete_target_initialization (struct target_ops *t);
2182
2183 /* Adds a command ALIAS for target T and marks it deprecated. This is useful
2184 for maintaining backwards compatibility when renaming targets. */
2185
2186 extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
2187
2188 extern void push_target (struct target_ops *);
2189
2190 extern int unpush_target (struct target_ops *);
2191
2192 extern void target_pre_inferior (int);
2193
2194 extern void target_preopen (int);
2195
2196 /* Does whatever cleanup is required to get rid of all pushed targets. */
2197 extern void pop_all_targets (void);
2198
2199 /* Like pop_all_targets, but pops only targets whose stratum is
2200 strictly above ABOVE_STRATUM. */
2201 extern void pop_all_targets_above (enum strata above_stratum);
2202
2203 extern int target_is_pushed (struct target_ops *t);
2204
2205 extern CORE_ADDR target_translate_tls_address (struct objfile *objfile,
2206 CORE_ADDR offset);
2207
2208 /* Struct target_section maps address ranges to file sections. It is
2209 mostly used with BFD files, but can be used without (e.g. for handling
2210 raw disks, or files not in formats handled by BFD). */
2211
2212 struct target_section
2213 {
2214 CORE_ADDR addr; /* Lowest address in section */
2215 CORE_ADDR endaddr; /* 1+highest address in section */
2216
2217 struct bfd_section *the_bfd_section;
2218
2219 /* The "owner" of the section.
2220 It can be any unique value. It is set by add_target_sections
2221 and used by remove_target_sections.
2222 For example, for executables it is a pointer to exec_bfd and
2223 for shlibs it is the so_list pointer. */
2224 void *owner;
2225 };
2226
2227 /* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */
2228
2229 struct target_section_table
2230 {
2231 struct target_section *sections;
2232 struct target_section *sections_end;
2233 };
2234
2235 /* Return the "section" containing the specified address. */
2236 struct target_section *target_section_by_addr (struct target_ops *target,
2237 CORE_ADDR addr);
2238
2239 /* Return the target section table this target (or the targets
2240 beneath) currently manipulate. */
2241
2242 extern struct target_section_table *target_get_section_table
2243 (struct target_ops *target);
2244
2245 /* From mem-break.c */
2246
2247 extern int memory_remove_breakpoint (struct target_ops *, struct gdbarch *,
2248 struct bp_target_info *);
2249
2250 extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *,
2251 struct bp_target_info *);
2252
2253 /* Check whether the memory at the breakpoint's placed address still
2254 contains the expected breakpoint instruction. */
2255
2256 extern int memory_validate_breakpoint (struct gdbarch *gdbarch,
2257 struct bp_target_info *bp_tgt);
2258
2259 extern int default_memory_remove_breakpoint (struct gdbarch *,
2260 struct bp_target_info *);
2261
2262 extern int default_memory_insert_breakpoint (struct gdbarch *,
2263 struct bp_target_info *);
2264
2265
2266 /* From target.c */
2267
2268 extern void initialize_targets (void);
2269
2270 extern void noprocess (void) ATTRIBUTE_NORETURN;
2271
2272 extern void target_require_runnable (void);
2273
2274 extern struct target_ops *find_target_beneath (struct target_ops *);
2275
2276 /* Find the target at STRATUM. If no target is at that stratum,
2277 return NULL. */
2278
2279 struct target_ops *find_target_at (enum strata stratum);
2280
2281 /* Read OS data object of type TYPE from the target, and return it in
2282 XML format. The result is NUL-terminated and returned as a string,
2283 allocated using xmalloc. If an error occurs or the transfer is
2284 unsupported, NULL is returned. Empty objects are returned as
2285 allocated but empty strings. */
2286
2287 extern char *target_get_osdata (const char *type);
2288
2289 \f
2290 /* Stuff that should be shared among the various remote targets. */
2291
2292 /* Debugging level. 0 is off, and non-zero values mean to print some debug
2293 information (higher values, more information). */
2294 extern int remote_debug;
2295
2296 /* Speed in bits per second, or -1 which means don't mess with the speed. */
2297 extern int baud_rate;
2298
2299 /* Parity for serial port */
2300 extern int serial_parity;
2301
2302 /* Timeout limit for response from target. */
2303 extern int remote_timeout;
2304
2305 \f
2306
2307 /* Set the show memory breakpoints mode to show, and installs a cleanup
2308 to restore it back to the current value. */
2309 extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);
2310
2311 extern int may_write_registers;
2312 extern int may_write_memory;
2313 extern int may_insert_breakpoints;
2314 extern int may_insert_tracepoints;
2315 extern int may_insert_fast_tracepoints;
2316 extern int may_stop;
2317
2318 extern void update_target_permissions (void);
2319
2320 \f
2321 /* Imported from machine dependent code. */
2322
2323 /* See to_supports_btrace in struct target_ops. */
2324 extern int target_supports_btrace (enum btrace_format);
2325
2326 /* See to_enable_btrace in struct target_ops. */
2327 extern struct btrace_target_info *
2328 target_enable_btrace (ptid_t ptid, const struct btrace_config *);
2329
2330 /* See to_disable_btrace in struct target_ops. */
2331 extern void target_disable_btrace (struct btrace_target_info *btinfo);
2332
2333 /* See to_teardown_btrace in struct target_ops. */
2334 extern void target_teardown_btrace (struct btrace_target_info *btinfo);
2335
2336 /* See to_read_btrace in struct target_ops. */
2337 extern enum btrace_error target_read_btrace (struct btrace_data *,
2338 struct btrace_target_info *,
2339 enum btrace_read_type);
2340
2341 /* See to_btrace_conf in struct target_ops. */
2342 extern const struct btrace_config *
2343 target_btrace_conf (const struct btrace_target_info *);
2344
2345 /* See to_stop_recording in struct target_ops. */
2346 extern void target_stop_recording (void);
2347
2348 /* See to_save_record in struct target_ops. */
2349 extern void target_save_record (const char *filename);
2350
2351 /* Query if the target supports deleting the execution log. */
2352 extern int target_supports_delete_record (void);
2353
2354 /* See to_delete_record in struct target_ops. */
2355 extern void target_delete_record (void);
2356
2357 /* See to_record_is_replaying in struct target_ops. */
2358 extern int target_record_is_replaying (void);
2359
2360 /* See to_goto_record_begin in struct target_ops. */
2361 extern void target_goto_record_begin (void);
2362
2363 /* See to_goto_record_end in struct target_ops. */
2364 extern void target_goto_record_end (void);
2365
2366 /* See to_goto_record in struct target_ops. */
2367 extern void target_goto_record (ULONGEST insn);
2368
2369 /* See to_insn_history. */
2370 extern void target_insn_history (int size, int flags);
2371
2372 /* See to_insn_history_from. */
2373 extern void target_insn_history_from (ULONGEST from, int size, int flags);
2374
2375 /* See to_insn_history_range. */
2376 extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags);
2377
2378 /* See to_call_history. */
2379 extern void target_call_history (int size, int flags);
2380
2381 /* See to_call_history_from. */
2382 extern void target_call_history_from (ULONGEST begin, int size, int flags);
2383
2384 /* See to_call_history_range. */
2385 extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags);
2386
2387 /* See to_prepare_to_generate_core. */
2388 extern void target_prepare_to_generate_core (void);
2389
2390 /* See to_done_generating_core. */
2391 extern void target_done_generating_core (void);
2392
2393 #endif /* !defined (TARGET_H) */
This page took 0.128156 seconds and 5 git commands to generate.