xref: /dragonfly/contrib/gdb-7/gdb/target.h (revision ef5ccd6c)
15796c8dcSSimon Schubert /* Interface between GDB and target environments, including files and processes
25796c8dcSSimon Schubert 
3*ef5ccd6cSJohn Marino    Copyright (C) 1990-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert    Contributed by Cygnus Support.  Written by John Gilmore.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This file is part of GDB.
85796c8dcSSimon Schubert 
95796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
105796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
115796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
125796c8dcSSimon Schubert    (at your option) any later version.
135796c8dcSSimon Schubert 
145796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
155796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
165796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
175796c8dcSSimon Schubert    GNU General Public License for more details.
185796c8dcSSimon Schubert 
195796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
205796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
215796c8dcSSimon Schubert 
225796c8dcSSimon Schubert #if !defined (TARGET_H)
235796c8dcSSimon Schubert #define TARGET_H
245796c8dcSSimon Schubert 
255796c8dcSSimon Schubert struct objfile;
265796c8dcSSimon Schubert struct ui_file;
275796c8dcSSimon Schubert struct mem_attrib;
285796c8dcSSimon Schubert struct target_ops;
29a45ae5f8SJohn Marino struct bp_location;
305796c8dcSSimon Schubert struct bp_target_info;
315796c8dcSSimon Schubert struct regcache;
325796c8dcSSimon Schubert struct target_section_table;
33cf7f2e2dSJohn Marino struct trace_state_variable;
34cf7f2e2dSJohn Marino struct trace_status;
35cf7f2e2dSJohn Marino struct uploaded_tsv;
36cf7f2e2dSJohn Marino struct uploaded_tp;
37cf7f2e2dSJohn Marino struct static_tracepoint_marker;
38c50c785cSJohn Marino struct traceframe_info;
39cf7f2e2dSJohn Marino struct expression;
405796c8dcSSimon Schubert 
415796c8dcSSimon Schubert /* This include file defines the interface between the main part
425796c8dcSSimon Schubert    of the debugger, and the part which is target-specific, or
435796c8dcSSimon Schubert    specific to the communications interface between us and the
445796c8dcSSimon Schubert    target.
455796c8dcSSimon Schubert 
465796c8dcSSimon Schubert    A TARGET is an interface between the debugger and a particular
475796c8dcSSimon Schubert    kind of file or process.  Targets can be STACKED in STRATA,
485796c8dcSSimon Schubert    so that more than one target can potentially respond to a request.
495796c8dcSSimon Schubert    In particular, memory accesses will walk down the stack of targets
505796c8dcSSimon Schubert    until they find a target that is interested in handling that particular
515796c8dcSSimon Schubert    address.  STRATA are artificial boundaries on the stack, within
525796c8dcSSimon Schubert    which particular kinds of targets live.  Strata exist so that
535796c8dcSSimon Schubert    people don't get confused by pushing e.g. a process target and then
545796c8dcSSimon Schubert    a file target, and wondering why they can't see the current values
555796c8dcSSimon Schubert    of variables any more (the file target is handling them and they
565796c8dcSSimon Schubert    never get to the process target).  So when you push a file target,
575796c8dcSSimon Schubert    it goes into the file stratum, which is always below the process
585796c8dcSSimon Schubert    stratum.  */
595796c8dcSSimon Schubert 
605796c8dcSSimon Schubert #include "bfd.h"
615796c8dcSSimon Schubert #include "symtab.h"
625796c8dcSSimon Schubert #include "memattr.h"
635796c8dcSSimon Schubert #include "vec.h"
645796c8dcSSimon Schubert #include "gdb_signals.h"
65*ef5ccd6cSJohn Marino #include "btrace.h"
665796c8dcSSimon Schubert 
675796c8dcSSimon Schubert enum strata
685796c8dcSSimon Schubert   {
695796c8dcSSimon Schubert     dummy_stratum,		/* The lowest of the low */
705796c8dcSSimon Schubert     file_stratum,		/* Executable files, etc */
71c50c785cSJohn Marino     process_stratum,		/* Executing processes or core dump files */
725796c8dcSSimon Schubert     thread_stratum,		/* Executing threads */
735796c8dcSSimon Schubert     record_stratum,		/* Support record debugging */
745796c8dcSSimon Schubert     arch_stratum		/* Architecture overrides */
755796c8dcSSimon Schubert   };
765796c8dcSSimon Schubert 
775796c8dcSSimon Schubert enum thread_control_capabilities
785796c8dcSSimon Schubert   {
795796c8dcSSimon Schubert     tc_none = 0,		/* Default: can't control thread execution.  */
805796c8dcSSimon Schubert     tc_schedlock = 1,		/* Can lock the thread scheduler.  */
815796c8dcSSimon Schubert   };
825796c8dcSSimon Schubert 
835796c8dcSSimon Schubert /* Stuff for target_wait.  */
845796c8dcSSimon Schubert 
855796c8dcSSimon Schubert /* Generally, what has the program done?  */
865796c8dcSSimon Schubert enum target_waitkind
875796c8dcSSimon Schubert   {
885796c8dcSSimon Schubert     /* The program has exited.  The exit status is in value.integer.  */
895796c8dcSSimon Schubert     TARGET_WAITKIND_EXITED,
905796c8dcSSimon Schubert 
915796c8dcSSimon Schubert     /* The program has stopped with a signal.  Which signal is in
925796c8dcSSimon Schubert        value.sig.  */
935796c8dcSSimon Schubert     TARGET_WAITKIND_STOPPED,
945796c8dcSSimon Schubert 
955796c8dcSSimon Schubert     /* The program has terminated with a signal.  Which signal is in
965796c8dcSSimon Schubert        value.sig.  */
975796c8dcSSimon Schubert     TARGET_WAITKIND_SIGNALLED,
985796c8dcSSimon Schubert 
995796c8dcSSimon Schubert     /* The program is letting us know that it dynamically loaded something
1005796c8dcSSimon Schubert        (e.g. it called load(2) on AIX).  */
1015796c8dcSSimon Schubert     TARGET_WAITKIND_LOADED,
1025796c8dcSSimon Schubert 
1035796c8dcSSimon Schubert     /* The program has forked.  A "related" process' PTID is in
1045796c8dcSSimon Schubert        value.related_pid.  I.e., if the child forks, value.related_pid
1055796c8dcSSimon Schubert        is the parent's ID.  */
1065796c8dcSSimon Schubert 
1075796c8dcSSimon Schubert     TARGET_WAITKIND_FORKED,
1085796c8dcSSimon Schubert 
1095796c8dcSSimon Schubert     /* The program has vforked.  A "related" process's PTID is in
1105796c8dcSSimon Schubert        value.related_pid.  */
1115796c8dcSSimon Schubert 
1125796c8dcSSimon Schubert     TARGET_WAITKIND_VFORKED,
1135796c8dcSSimon Schubert 
1145796c8dcSSimon Schubert     /* The program has exec'ed a new executable file.  The new file's
1155796c8dcSSimon Schubert        pathname is pointed to by value.execd_pathname.  */
1165796c8dcSSimon Schubert 
1175796c8dcSSimon Schubert     TARGET_WAITKIND_EXECD,
1185796c8dcSSimon Schubert 
119cf7f2e2dSJohn Marino     /* The program had previously vforked, and now the child is done
120cf7f2e2dSJohn Marino        with the shared memory region, because it exec'ed or exited.
121cf7f2e2dSJohn Marino        Note that the event is reported to the vfork parent.  This is
122cf7f2e2dSJohn Marino        only used if GDB did not stay attached to the vfork child,
123cf7f2e2dSJohn Marino        otherwise, a TARGET_WAITKIND_EXECD or
124cf7f2e2dSJohn Marino        TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
125cf7f2e2dSJohn Marino        has the same effect.  */
126cf7f2e2dSJohn Marino     TARGET_WAITKIND_VFORK_DONE,
127cf7f2e2dSJohn Marino 
1285796c8dcSSimon Schubert     /* The program has entered or returned from a system call.  On
1295796c8dcSSimon Schubert        HP-UX, this is used in the hardware watchpoint implementation.
130c50c785cSJohn Marino        The syscall's unique integer ID number is in value.syscall_id.  */
1315796c8dcSSimon Schubert 
1325796c8dcSSimon Schubert     TARGET_WAITKIND_SYSCALL_ENTRY,
1335796c8dcSSimon Schubert     TARGET_WAITKIND_SYSCALL_RETURN,
1345796c8dcSSimon Schubert 
1355796c8dcSSimon Schubert     /* Nothing happened, but we stopped anyway.  This perhaps should be handled
1365796c8dcSSimon Schubert        within target_wait, but I'm not sure target_wait should be resuming the
1375796c8dcSSimon Schubert        inferior.  */
1385796c8dcSSimon Schubert     TARGET_WAITKIND_SPURIOUS,
1395796c8dcSSimon Schubert 
1405796c8dcSSimon Schubert     /* An event has occured, but we should wait again.
1415796c8dcSSimon Schubert        Remote_async_wait() returns this when there is an event
1425796c8dcSSimon Schubert        on the inferior, but the rest of the world is not interested in
1435796c8dcSSimon Schubert        it.  The inferior has not stopped, but has just sent some output
1445796c8dcSSimon Schubert        to the console, for instance.  In this case, we want to go back
1455796c8dcSSimon Schubert        to the event loop and wait there for another event from the
1465796c8dcSSimon Schubert        inferior, rather than being stuck in the remote_async_wait()
147c50c785cSJohn Marino        function. sThis way the event loop is responsive to other events,
1485796c8dcSSimon Schubert        like for instance the user typing.  */
1495796c8dcSSimon Schubert     TARGET_WAITKIND_IGNORE,
1505796c8dcSSimon Schubert 
1515796c8dcSSimon Schubert     /* The target has run out of history information,
1525796c8dcSSimon Schubert        and cannot run backward any further.  */
153a45ae5f8SJohn Marino     TARGET_WAITKIND_NO_HISTORY,
154a45ae5f8SJohn Marino 
155a45ae5f8SJohn Marino     /* There are no resumed children left in the program.  */
156a45ae5f8SJohn Marino     TARGET_WAITKIND_NO_RESUMED
1575796c8dcSSimon Schubert   };
1585796c8dcSSimon Schubert 
1595796c8dcSSimon Schubert struct target_waitstatus
1605796c8dcSSimon Schubert   {
1615796c8dcSSimon Schubert     enum target_waitkind kind;
1625796c8dcSSimon Schubert 
1635796c8dcSSimon Schubert     /* Forked child pid, execd pathname, exit status, signal number or
1645796c8dcSSimon Schubert        syscall number.  */
1655796c8dcSSimon Schubert     union
1665796c8dcSSimon Schubert       {
1675796c8dcSSimon Schubert 	int integer;
168*ef5ccd6cSJohn Marino 	enum gdb_signal sig;
1695796c8dcSSimon Schubert 	ptid_t related_pid;
1705796c8dcSSimon Schubert 	char *execd_pathname;
1715796c8dcSSimon Schubert 	int syscall_number;
1725796c8dcSSimon Schubert       }
1735796c8dcSSimon Schubert     value;
1745796c8dcSSimon Schubert   };
1755796c8dcSSimon Schubert 
1765796c8dcSSimon Schubert /* Options that can be passed to target_wait.  */
1775796c8dcSSimon Schubert 
1785796c8dcSSimon Schubert /* Return immediately if there's no event already queued.  If this
1795796c8dcSSimon Schubert    options is not requested, target_wait blocks waiting for an
1805796c8dcSSimon Schubert    event.  */
1815796c8dcSSimon Schubert #define TARGET_WNOHANG 1
1825796c8dcSSimon Schubert 
1835796c8dcSSimon Schubert /* The structure below stores information about a system call.
1845796c8dcSSimon Schubert    It is basically used in the "catch syscall" command, and in
1855796c8dcSSimon Schubert    every function that gives information about a system call.
1865796c8dcSSimon Schubert 
1875796c8dcSSimon Schubert    It's also good to mention that its fields represent everything
1885796c8dcSSimon Schubert    that we currently know about a syscall in GDB.  */
1895796c8dcSSimon Schubert struct syscall
1905796c8dcSSimon Schubert   {
1915796c8dcSSimon Schubert     /* The syscall number.  */
1925796c8dcSSimon Schubert     int number;
1935796c8dcSSimon Schubert 
1945796c8dcSSimon Schubert     /* The syscall name.  */
1955796c8dcSSimon Schubert     const char *name;
1965796c8dcSSimon Schubert   };
1975796c8dcSSimon Schubert 
1985796c8dcSSimon Schubert /* Return a pretty printed form of target_waitstatus.
1995796c8dcSSimon Schubert    Space for the result is malloc'd, caller must free.  */
2005796c8dcSSimon Schubert extern char *target_waitstatus_to_string (const struct target_waitstatus *);
2015796c8dcSSimon Schubert 
202*ef5ccd6cSJohn Marino /* Return a pretty printed form of TARGET_OPTIONS.
203*ef5ccd6cSJohn Marino    Space for the result is malloc'd, caller must free.  */
204*ef5ccd6cSJohn Marino extern char *target_options_to_string (int target_options);
205*ef5ccd6cSJohn Marino 
2065796c8dcSSimon Schubert /* Possible types of events that the inferior handler will have to
2075796c8dcSSimon Schubert    deal with.  */
2085796c8dcSSimon Schubert enum inferior_event_type
2095796c8dcSSimon Schubert   {
2105796c8dcSSimon Schubert     /* Process a normal inferior event which will result in target_wait
2115796c8dcSSimon Schubert        being called.  */
2125796c8dcSSimon Schubert     INF_REG_EVENT,
2135796c8dcSSimon Schubert     /* We are called because a timer went off.  */
2145796c8dcSSimon Schubert     INF_TIMER,
2155796c8dcSSimon Schubert     /* We are called to do stuff after the inferior stops.  */
2165796c8dcSSimon Schubert     INF_EXEC_COMPLETE,
2175796c8dcSSimon Schubert     /* We are called to do some stuff after the inferior stops, but we
2185796c8dcSSimon Schubert        are expected to reenter the proceed() and
2195796c8dcSSimon Schubert        handle_inferior_event() functions.  This is used only in case of
2205796c8dcSSimon Schubert        'step n' like commands.  */
2215796c8dcSSimon Schubert     INF_EXEC_CONTINUE
2225796c8dcSSimon Schubert   };
2235796c8dcSSimon Schubert 
2245796c8dcSSimon Schubert /* Target objects which can be transfered using target_read,
2255796c8dcSSimon Schubert    target_write, et cetera.  */
2265796c8dcSSimon Schubert 
2275796c8dcSSimon Schubert enum target_object
2285796c8dcSSimon Schubert {
2295796c8dcSSimon Schubert   /* AVR target specific transfer.  See "avr-tdep.c" and "remote.c".  */
2305796c8dcSSimon Schubert   TARGET_OBJECT_AVR,
2315796c8dcSSimon Schubert   /* SPU target specific transfer.  See "spu-tdep.c".  */
2325796c8dcSSimon Schubert   TARGET_OBJECT_SPU,
2335796c8dcSSimon Schubert   /* Transfer up-to LEN bytes of memory starting at OFFSET.  */
2345796c8dcSSimon Schubert   TARGET_OBJECT_MEMORY,
2355796c8dcSSimon Schubert   /* Memory, avoiding GDB's data cache and trusting the executable.
2365796c8dcSSimon Schubert      Target implementations of to_xfer_partial never need to handle
2375796c8dcSSimon Schubert      this object, and most callers should not use it.  */
2385796c8dcSSimon Schubert   TARGET_OBJECT_RAW_MEMORY,
2395796c8dcSSimon Schubert   /* Memory known to be part of the target's stack.  This is cached even
2405796c8dcSSimon Schubert      if it is not in a region marked as such, since it is known to be
2415796c8dcSSimon Schubert      "normal" RAM.  */
2425796c8dcSSimon Schubert   TARGET_OBJECT_STACK_MEMORY,
2435796c8dcSSimon Schubert   /* Kernel Unwind Table.  See "ia64-tdep.c".  */
2445796c8dcSSimon Schubert   TARGET_OBJECT_UNWIND_TABLE,
2455796c8dcSSimon Schubert   /* Transfer auxilliary vector.  */
2465796c8dcSSimon Schubert   TARGET_OBJECT_AUXV,
2475796c8dcSSimon Schubert   /* StackGhost cookie.  See "sparc-tdep.c".  */
2485796c8dcSSimon Schubert   TARGET_OBJECT_WCOOKIE,
2495796c8dcSSimon Schubert   /* Target memory map in XML format.  */
2505796c8dcSSimon Schubert   TARGET_OBJECT_MEMORY_MAP,
2515796c8dcSSimon Schubert   /* Flash memory.  This object can be used to write contents to
2525796c8dcSSimon Schubert      a previously erased flash memory.  Using it without erasing
2535796c8dcSSimon Schubert      flash can have unexpected results.  Addresses are physical
2545796c8dcSSimon Schubert      address on target, and not relative to flash start.  */
2555796c8dcSSimon Schubert   TARGET_OBJECT_FLASH,
2565796c8dcSSimon Schubert   /* Available target-specific features, e.g. registers and coprocessors.
2575796c8dcSSimon Schubert      See "target-descriptions.c".  ANNEX should never be empty.  */
2585796c8dcSSimon Schubert   TARGET_OBJECT_AVAILABLE_FEATURES,
2595796c8dcSSimon Schubert   /* Currently loaded libraries, in XML format.  */
2605796c8dcSSimon Schubert   TARGET_OBJECT_LIBRARIES,
261a45ae5f8SJohn Marino   /* Currently loaded libraries specific for SVR4 systems, in XML format.  */
262a45ae5f8SJohn Marino   TARGET_OBJECT_LIBRARIES_SVR4,
2635796c8dcSSimon Schubert   /* Get OS specific data.  The ANNEX specifies the type (running
264c50c785cSJohn Marino      processes, etc.).  The data being transfered is expected to follow
265c50c785cSJohn Marino      the DTD specified in features/osdata.dtd.  */
2665796c8dcSSimon Schubert   TARGET_OBJECT_OSDATA,
2675796c8dcSSimon Schubert   /* Extra signal info.  Usually the contents of `siginfo_t' on unix
2685796c8dcSSimon Schubert      platforms.  */
2695796c8dcSSimon Schubert   TARGET_OBJECT_SIGNAL_INFO,
270cf7f2e2dSJohn Marino   /* The list of threads that are being debugged.  */
271cf7f2e2dSJohn Marino   TARGET_OBJECT_THREADS,
272cf7f2e2dSJohn Marino   /* Collected static trace data.  */
273cf7f2e2dSJohn Marino   TARGET_OBJECT_STATIC_TRACE_DATA,
274c50c785cSJohn Marino   /* The HP-UX registers (those that can be obtained or modified by using
275c50c785cSJohn Marino      the TT_LWP_RUREGS/TT_LWP_WUREGS ttrace requests).  */
276c50c785cSJohn Marino   TARGET_OBJECT_HPUX_UREGS,
277c50c785cSJohn Marino   /* The HP-UX shared library linkage pointer.  ANNEX should be a string
278c50c785cSJohn Marino      image of the code address whose linkage pointer we are looking for.
279c50c785cSJohn Marino 
280c50c785cSJohn Marino      The size of the data transfered is always 8 bytes (the size of an
281c50c785cSJohn Marino      address on ia64).  */
282c50c785cSJohn Marino   TARGET_OBJECT_HPUX_SOLIB_GOT,
283c50c785cSJohn Marino   /* Traceframe info, in XML format.  */
284c50c785cSJohn Marino   TARGET_OBJECT_TRACEFRAME_INFO,
285a45ae5f8SJohn Marino   /* Load maps for FDPIC systems.  */
286a45ae5f8SJohn Marino   TARGET_OBJECT_FDPIC,
287a45ae5f8SJohn Marino   /* Darwin dynamic linker info data.  */
288*ef5ccd6cSJohn Marino   TARGET_OBJECT_DARWIN_DYLD_INFO,
289*ef5ccd6cSJohn Marino   /* OpenVMS Unwind Information Block.  */
290*ef5ccd6cSJohn Marino   TARGET_OBJECT_OPENVMS_UIB,
291*ef5ccd6cSJohn Marino   /* Branch trace data, in XML format.  */
292*ef5ccd6cSJohn Marino   TARGET_OBJECT_BTRACE
2935796c8dcSSimon Schubert   /* Possible future objects: TARGET_OBJECT_FILE, ...  */
2945796c8dcSSimon Schubert };
2955796c8dcSSimon Schubert 
296cf7f2e2dSJohn Marino /* Enumeration of the kinds of traceframe searches that a target may
297cf7f2e2dSJohn Marino    be able to perform.  */
298cf7f2e2dSJohn Marino 
299cf7f2e2dSJohn Marino enum trace_find_type
300cf7f2e2dSJohn Marino   {
301cf7f2e2dSJohn Marino     tfind_number,
302cf7f2e2dSJohn Marino     tfind_pc,
303cf7f2e2dSJohn Marino     tfind_tp,
304cf7f2e2dSJohn Marino     tfind_range,
305cf7f2e2dSJohn Marino     tfind_outside,
306cf7f2e2dSJohn Marino   };
307cf7f2e2dSJohn Marino 
308cf7f2e2dSJohn Marino typedef struct static_tracepoint_marker *static_tracepoint_marker_p;
309cf7f2e2dSJohn Marino DEF_VEC_P(static_tracepoint_marker_p);
310cf7f2e2dSJohn Marino 
3115796c8dcSSimon Schubert /* Request that OPS transfer up to LEN 8-bit bytes of the target's
3125796c8dcSSimon Schubert    OBJECT.  The OFFSET, for a seekable object, specifies the
3135796c8dcSSimon Schubert    starting point.  The ANNEX can be used to provide additional
3145796c8dcSSimon Schubert    data-specific information to the target.
3155796c8dcSSimon Schubert 
3165796c8dcSSimon Schubert    Return the number of bytes actually transfered, or -1 if the
3175796c8dcSSimon Schubert    transfer is not supported or otherwise fails.  Return of a positive
3185796c8dcSSimon Schubert    value less than LEN indicates that no further transfer is possible.
3195796c8dcSSimon Schubert    Unlike the raw to_xfer_partial interface, callers of these
3205796c8dcSSimon Schubert    functions do not need to retry partial transfers.  */
3215796c8dcSSimon Schubert 
3225796c8dcSSimon Schubert extern LONGEST target_read (struct target_ops *ops,
3235796c8dcSSimon Schubert 			    enum target_object object,
3245796c8dcSSimon Schubert 			    const char *annex, gdb_byte *buf,
3255796c8dcSSimon Schubert 			    ULONGEST offset, LONGEST len);
3265796c8dcSSimon Schubert 
327c50c785cSJohn Marino struct memory_read_result
328c50c785cSJohn Marino   {
329c50c785cSJohn Marino     /* First address that was read.  */
330c50c785cSJohn Marino     ULONGEST begin;
331c50c785cSJohn Marino     /* Past-the-end address.  */
332c50c785cSJohn Marino     ULONGEST end;
333c50c785cSJohn Marino     /* The data.  */
334c50c785cSJohn Marino     gdb_byte *data;
335c50c785cSJohn Marino };
336c50c785cSJohn Marino typedef struct memory_read_result memory_read_result_s;
337c50c785cSJohn Marino DEF_VEC_O(memory_read_result_s);
338c50c785cSJohn Marino 
339c50c785cSJohn Marino extern void free_memory_read_result_vector (void *);
340c50c785cSJohn Marino 
341c50c785cSJohn Marino extern VEC(memory_read_result_s)* read_memory_robust (struct target_ops *ops,
342c50c785cSJohn Marino 						      ULONGEST offset,
343c50c785cSJohn Marino 						      LONGEST len);
3445796c8dcSSimon Schubert 
3455796c8dcSSimon Schubert extern LONGEST target_write (struct target_ops *ops,
3465796c8dcSSimon Schubert 			     enum target_object object,
3475796c8dcSSimon Schubert 			     const char *annex, const gdb_byte *buf,
3485796c8dcSSimon Schubert 			     ULONGEST offset, LONGEST len);
3495796c8dcSSimon Schubert 
3505796c8dcSSimon Schubert /* Similar to target_write, except that it also calls PROGRESS with
3515796c8dcSSimon Schubert    the number of bytes written and the opaque BATON after every
3525796c8dcSSimon Schubert    successful partial write (and before the first write).  This is
3535796c8dcSSimon Schubert    useful for progress reporting and user interaction while writing
3545796c8dcSSimon Schubert    data.  To abort the transfer, the progress callback can throw an
3555796c8dcSSimon Schubert    exception.  */
3565796c8dcSSimon Schubert 
3575796c8dcSSimon Schubert LONGEST target_write_with_progress (struct target_ops *ops,
3585796c8dcSSimon Schubert 				    enum target_object object,
3595796c8dcSSimon Schubert 				    const char *annex, const gdb_byte *buf,
3605796c8dcSSimon Schubert 				    ULONGEST offset, LONGEST len,
3615796c8dcSSimon Schubert 				    void (*progress) (ULONGEST, void *),
3625796c8dcSSimon Schubert 				    void *baton);
3635796c8dcSSimon Schubert 
3645796c8dcSSimon Schubert /* Wrapper to perform a full read of unknown size.  OBJECT/ANNEX will
3655796c8dcSSimon Schubert    be read using OPS.  The return value will be -1 if the transfer
3665796c8dcSSimon Schubert    fails or is not supported; 0 if the object is empty; or the length
3675796c8dcSSimon Schubert    of the object otherwise.  If a positive value is returned, a
3685796c8dcSSimon Schubert    sufficiently large buffer will be allocated using xmalloc and
3695796c8dcSSimon Schubert    returned in *BUF_P containing the contents of the object.
3705796c8dcSSimon Schubert 
3715796c8dcSSimon Schubert    This method should be used for objects sufficiently small to store
3725796c8dcSSimon Schubert    in a single xmalloc'd buffer, when no fixed bound on the object's
3735796c8dcSSimon Schubert    size is known in advance.  Don't try to read TARGET_OBJECT_MEMORY
3745796c8dcSSimon Schubert    through this function.  */
3755796c8dcSSimon Schubert 
3765796c8dcSSimon Schubert extern LONGEST target_read_alloc (struct target_ops *ops,
3775796c8dcSSimon Schubert 				  enum target_object object,
3785796c8dcSSimon Schubert 				  const char *annex, gdb_byte **buf_p);
3795796c8dcSSimon Schubert 
3805796c8dcSSimon Schubert /* Read OBJECT/ANNEX using OPS.  The result is NUL-terminated and
3815796c8dcSSimon Schubert    returned as a string, allocated using xmalloc.  If an error occurs
3825796c8dcSSimon Schubert    or the transfer is unsupported, NULL is returned.  Empty objects
3835796c8dcSSimon Schubert    are returned as allocated but empty strings.  A warning is issued
3845796c8dcSSimon Schubert    if the result contains any embedded NUL bytes.  */
3855796c8dcSSimon Schubert 
3865796c8dcSSimon Schubert extern char *target_read_stralloc (struct target_ops *ops,
3875796c8dcSSimon Schubert 				   enum target_object object,
3885796c8dcSSimon Schubert 				   const char *annex);
3895796c8dcSSimon Schubert 
3905796c8dcSSimon Schubert /* Wrappers to target read/write that perform memory transfers.  They
3915796c8dcSSimon Schubert    throw an error if the memory transfer fails.
3925796c8dcSSimon Schubert 
3935796c8dcSSimon Schubert    NOTE: cagney/2003-10-23: The naming schema is lifted from
3945796c8dcSSimon Schubert    "frame.h".  The parameter order is lifted from get_frame_memory,
3955796c8dcSSimon Schubert    which in turn lifted it from read_memory.  */
3965796c8dcSSimon Schubert 
3975796c8dcSSimon Schubert extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
3985796c8dcSSimon Schubert 			       gdb_byte *buf, LONGEST len);
3995796c8dcSSimon Schubert extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
4005796c8dcSSimon Schubert 					    CORE_ADDR addr, int len,
4015796c8dcSSimon Schubert 					    enum bfd_endian byte_order);
4025796c8dcSSimon Schubert 
4035796c8dcSSimon Schubert struct thread_info;		/* fwd decl for parameter list below: */
4045796c8dcSSimon Schubert 
4055796c8dcSSimon Schubert struct target_ops
4065796c8dcSSimon Schubert   {
4075796c8dcSSimon Schubert     struct target_ops *beneath;	/* To the target under this one.  */
4085796c8dcSSimon Schubert     char *to_shortname;		/* Name this target type */
4095796c8dcSSimon Schubert     char *to_longname;		/* Name for printing */
4105796c8dcSSimon Schubert     char *to_doc;		/* Documentation.  Does not include trailing
4115796c8dcSSimon Schubert 				   newline, and starts with a one-line descrip-
4125796c8dcSSimon Schubert 				   tion (probably similar to to_longname).  */
4135796c8dcSSimon Schubert     /* Per-target scratch pad.  */
4145796c8dcSSimon Schubert     void *to_data;
4155796c8dcSSimon Schubert     /* The open routine takes the rest of the parameters from the
4165796c8dcSSimon Schubert        command, and (if successful) pushes a new target onto the
4175796c8dcSSimon Schubert        stack.  Targets should supply this routine, if only to provide
4185796c8dcSSimon Schubert        an error message.  */
4195796c8dcSSimon Schubert     void (*to_open) (char *, int);
4205796c8dcSSimon Schubert     /* Old targets with a static target vector provide "to_close".
4215796c8dcSSimon Schubert        New re-entrant targets provide "to_xclose" and that is expected
4225796c8dcSSimon Schubert        to xfree everything (including the "struct target_ops").  */
4235796c8dcSSimon Schubert     void (*to_xclose) (struct target_ops *targ, int quitting);
4245796c8dcSSimon Schubert     void (*to_close) (int);
4255796c8dcSSimon Schubert     void (*to_attach) (struct target_ops *ops, char *, int);
4265796c8dcSSimon Schubert     void (*to_post_attach) (int);
4275796c8dcSSimon Schubert     void (*to_detach) (struct target_ops *ops, char *, int);
4285796c8dcSSimon Schubert     void (*to_disconnect) (struct target_ops *, char *, int);
429*ef5ccd6cSJohn Marino     void (*to_resume) (struct target_ops *, ptid_t, int, enum gdb_signal);
4305796c8dcSSimon Schubert     ptid_t (*to_wait) (struct target_ops *,
4315796c8dcSSimon Schubert 		       ptid_t, struct target_waitstatus *, int);
4325796c8dcSSimon Schubert     void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
4335796c8dcSSimon Schubert     void (*to_store_registers) (struct target_ops *, struct regcache *, int);
4345796c8dcSSimon Schubert     void (*to_prepare_to_store) (struct regcache *);
4355796c8dcSSimon Schubert 
4365796c8dcSSimon Schubert     /* Transfer LEN bytes of memory between GDB address MYADDR and
4375796c8dcSSimon Schubert        target address MEMADDR.  If WRITE, transfer them to the target, else
4385796c8dcSSimon Schubert        transfer them from the target.  TARGET is the target from which we
4395796c8dcSSimon Schubert        get this function.
4405796c8dcSSimon Schubert 
4415796c8dcSSimon Schubert        Return value, N, is one of the following:
4425796c8dcSSimon Schubert 
4435796c8dcSSimon Schubert        0 means that we can't handle this.  If errno has been set, it is the
4445796c8dcSSimon Schubert        error which prevented us from doing it (FIXME: What about bfd_error?).
4455796c8dcSSimon Schubert 
4465796c8dcSSimon Schubert        positive (call it N) means that we have transferred N bytes
4475796c8dcSSimon Schubert        starting at MEMADDR.  We might be able to handle more bytes
4485796c8dcSSimon Schubert        beyond this length, but no promises.
4495796c8dcSSimon Schubert 
4505796c8dcSSimon Schubert        negative (call its absolute value N) means that we cannot
4515796c8dcSSimon Schubert        transfer right at MEMADDR, but we could transfer at least
4525796c8dcSSimon Schubert        something at MEMADDR + N.
4535796c8dcSSimon Schubert 
4545796c8dcSSimon Schubert        NOTE: cagney/2004-10-01: This has been entirely superseeded by
4555796c8dcSSimon Schubert        to_xfer_partial and inferior inheritance.  */
4565796c8dcSSimon Schubert 
4575796c8dcSSimon Schubert     int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
4585796c8dcSSimon Schubert 				   int len, int write,
4595796c8dcSSimon Schubert 				   struct mem_attrib *attrib,
4605796c8dcSSimon Schubert 				   struct target_ops *target);
4615796c8dcSSimon Schubert 
4625796c8dcSSimon Schubert     void (*to_files_info) (struct target_ops *);
4635796c8dcSSimon Schubert     int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *);
4645796c8dcSSimon Schubert     int (*to_remove_breakpoint) (struct gdbarch *, struct bp_target_info *);
4655796c8dcSSimon Schubert     int (*to_can_use_hw_breakpoint) (int, int, int);
466c50c785cSJohn Marino     int (*to_ranged_break_num_registers) (struct target_ops *);
4675796c8dcSSimon Schubert     int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *);
4685796c8dcSSimon Schubert     int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *);
469cf7f2e2dSJohn Marino 
470cf7f2e2dSJohn Marino     /* Documentation of what the two routines below are expected to do is
471cf7f2e2dSJohn Marino        provided with the corresponding target_* macros.  */
472cf7f2e2dSJohn Marino     int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *);
473cf7f2e2dSJohn Marino     int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *);
474cf7f2e2dSJohn Marino 
475a45ae5f8SJohn Marino     int (*to_insert_mask_watchpoint) (struct target_ops *,
476a45ae5f8SJohn Marino 				      CORE_ADDR, CORE_ADDR, int);
477a45ae5f8SJohn Marino     int (*to_remove_mask_watchpoint) (struct target_ops *,
478a45ae5f8SJohn Marino 				      CORE_ADDR, CORE_ADDR, int);
4795796c8dcSSimon Schubert     int (*to_stopped_by_watchpoint) (void);
4805796c8dcSSimon Schubert     int to_have_steppable_watchpoint;
4815796c8dcSSimon Schubert     int to_have_continuable_watchpoint;
4825796c8dcSSimon Schubert     int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
4835796c8dcSSimon Schubert     int (*to_watchpoint_addr_within_range) (struct target_ops *,
4845796c8dcSSimon Schubert 					    CORE_ADDR, CORE_ADDR, int);
485c50c785cSJohn Marino 
486c50c785cSJohn Marino     /* Documentation of this routine is provided with the corresponding
487c50c785cSJohn Marino        target_* macro.  */
4885796c8dcSSimon Schubert     int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int);
489c50c785cSJohn Marino 
490cf7f2e2dSJohn Marino     int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int,
491cf7f2e2dSJohn Marino 					      struct expression *);
492a45ae5f8SJohn Marino     int (*to_masked_watch_num_registers) (struct target_ops *,
493a45ae5f8SJohn Marino 					  CORE_ADDR, CORE_ADDR);
4945796c8dcSSimon Schubert     void (*to_terminal_init) (void);
4955796c8dcSSimon Schubert     void (*to_terminal_inferior) (void);
4965796c8dcSSimon Schubert     void (*to_terminal_ours_for_output) (void);
4975796c8dcSSimon Schubert     void (*to_terminal_ours) (void);
4985796c8dcSSimon Schubert     void (*to_terminal_save_ours) (void);
4995796c8dcSSimon Schubert     void (*to_terminal_info) (char *, int);
5005796c8dcSSimon Schubert     void (*to_kill) (struct target_ops *);
5015796c8dcSSimon Schubert     void (*to_load) (char *, int);
5025796c8dcSSimon Schubert     void (*to_create_inferior) (struct target_ops *,
5035796c8dcSSimon Schubert 				char *, char *, char **, int);
5045796c8dcSSimon Schubert     void (*to_post_startup_inferior) (ptid_t);
505c50c785cSJohn Marino     int (*to_insert_fork_catchpoint) (int);
5065796c8dcSSimon Schubert     int (*to_remove_fork_catchpoint) (int);
507c50c785cSJohn Marino     int (*to_insert_vfork_catchpoint) (int);
5085796c8dcSSimon Schubert     int (*to_remove_vfork_catchpoint) (int);
5095796c8dcSSimon Schubert     int (*to_follow_fork) (struct target_ops *, int);
510c50c785cSJohn Marino     int (*to_insert_exec_catchpoint) (int);
5115796c8dcSSimon Schubert     int (*to_remove_exec_catchpoint) (int);
5125796c8dcSSimon Schubert     int (*to_set_syscall_catchpoint) (int, int, int, int, int *);
5135796c8dcSSimon Schubert     int (*to_has_exited) (int, int, int *);
5145796c8dcSSimon Schubert     void (*to_mourn_inferior) (struct target_ops *);
5155796c8dcSSimon Schubert     int (*to_can_run) (void);
516a45ae5f8SJohn Marino 
517a45ae5f8SJohn Marino     /* Documentation of this routine is provided with the corresponding
518a45ae5f8SJohn Marino        target_* macro.  */
519a45ae5f8SJohn Marino     void (*to_pass_signals) (int, unsigned char *);
520a45ae5f8SJohn Marino 
521*ef5ccd6cSJohn Marino     /* Documentation of this routine is provided with the
522*ef5ccd6cSJohn Marino        corresponding target_* function.  */
523*ef5ccd6cSJohn Marino     void (*to_program_signals) (int, unsigned char *);
524*ef5ccd6cSJohn Marino 
5255796c8dcSSimon Schubert     int (*to_thread_alive) (struct target_ops *, ptid_t ptid);
5265796c8dcSSimon Schubert     void (*to_find_new_threads) (struct target_ops *);
5275796c8dcSSimon Schubert     char *(*to_pid_to_str) (struct target_ops *, ptid_t);
5285796c8dcSSimon Schubert     char *(*to_extra_thread_info) (struct thread_info *);
529c50c785cSJohn Marino     char *(*to_thread_name) (struct thread_info *);
5305796c8dcSSimon Schubert     void (*to_stop) (ptid_t);
5315796c8dcSSimon Schubert     void (*to_rcmd) (char *command, struct ui_file *output);
5325796c8dcSSimon Schubert     char *(*to_pid_to_exec_file) (int pid);
5335796c8dcSSimon Schubert     void (*to_log_command) (const char *);
5345796c8dcSSimon Schubert     struct target_section_table *(*to_get_section_table) (struct target_ops *);
5355796c8dcSSimon Schubert     enum strata to_stratum;
5365796c8dcSSimon Schubert     int (*to_has_all_memory) (struct target_ops *);
5375796c8dcSSimon Schubert     int (*to_has_memory) (struct target_ops *);
5385796c8dcSSimon Schubert     int (*to_has_stack) (struct target_ops *);
5395796c8dcSSimon Schubert     int (*to_has_registers) (struct target_ops *);
540c50c785cSJohn Marino     int (*to_has_execution) (struct target_ops *, ptid_t);
5415796c8dcSSimon Schubert     int to_has_thread_control;	/* control thread execution */
5425796c8dcSSimon Schubert     int to_attach_no_wait;
5435796c8dcSSimon Schubert     /* ASYNC target controls */
5445796c8dcSSimon Schubert     int (*to_can_async_p) (void);
5455796c8dcSSimon Schubert     int (*to_is_async_p) (void);
5465796c8dcSSimon Schubert     void (*to_async) (void (*) (enum inferior_event_type, void *), void *);
5475796c8dcSSimon Schubert     int (*to_supports_non_stop) (void);
548cf7f2e2dSJohn Marino     /* find_memory_regions support method for gcore */
549c50c785cSJohn Marino     int (*to_find_memory_regions) (find_memory_region_ftype func, void *data);
550cf7f2e2dSJohn Marino     /* make_corefile_notes support method for gcore */
5515796c8dcSSimon Schubert     char * (*to_make_corefile_notes) (bfd *, int *);
552cf7f2e2dSJohn Marino     /* get_bookmark support method for bookmarks */
553cf7f2e2dSJohn Marino     gdb_byte * (*to_get_bookmark) (char *, int);
554cf7f2e2dSJohn Marino     /* goto_bookmark support method for bookmarks */
555cf7f2e2dSJohn Marino     void (*to_goto_bookmark) (gdb_byte *, int);
5565796c8dcSSimon Schubert     /* Return the thread-local address at OFFSET in the
5575796c8dcSSimon Schubert        thread-local storage for the thread PTID and the shared library
5585796c8dcSSimon Schubert        or executable file given by OBJFILE.  If that block of
5595796c8dcSSimon Schubert        thread-local storage hasn't been allocated yet, this function
5605796c8dcSSimon Schubert        may return an error.  */
5615796c8dcSSimon Schubert     CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
5625796c8dcSSimon Schubert 					      ptid_t ptid,
5635796c8dcSSimon Schubert 					      CORE_ADDR load_module_addr,
5645796c8dcSSimon Schubert 					      CORE_ADDR offset);
5655796c8dcSSimon Schubert 
5665796c8dcSSimon Schubert     /* Request that OPS transfer up to LEN 8-bit bytes of the target's
5675796c8dcSSimon Schubert        OBJECT.  The OFFSET, for a seekable object, specifies the
5685796c8dcSSimon Schubert        starting point.  The ANNEX can be used to provide additional
5695796c8dcSSimon Schubert        data-specific information to the target.
5705796c8dcSSimon Schubert 
5715796c8dcSSimon Schubert        Return the number of bytes actually transfered, zero when no
5725796c8dcSSimon Schubert        further transfer is possible, and -1 when the transfer is not
5735796c8dcSSimon Schubert        supported.  Return of a positive value smaller than LEN does
5745796c8dcSSimon Schubert        not indicate the end of the object, only the end of the
5755796c8dcSSimon Schubert        transfer; higher level code should continue transferring if
5765796c8dcSSimon Schubert        desired.  This is handled in target.c.
5775796c8dcSSimon Schubert 
5785796c8dcSSimon Schubert        The interface does not support a "retry" mechanism.  Instead it
5795796c8dcSSimon Schubert        assumes that at least one byte will be transfered on each
5805796c8dcSSimon Schubert        successful call.
5815796c8dcSSimon Schubert 
5825796c8dcSSimon Schubert        NOTE: cagney/2003-10-17: The current interface can lead to
5835796c8dcSSimon Schubert        fragmented transfers.  Lower target levels should not implement
5845796c8dcSSimon Schubert        hacks, such as enlarging the transfer, in an attempt to
5855796c8dcSSimon Schubert        compensate for this.  Instead, the target stack should be
5865796c8dcSSimon Schubert        extended so that it implements supply/collect methods and a
5875796c8dcSSimon Schubert        look-aside object cache.  With that available, the lowest
5885796c8dcSSimon Schubert        target can safely and freely "push" data up the stack.
5895796c8dcSSimon Schubert 
5905796c8dcSSimon Schubert        See target_read and target_write for more information.  One,
5915796c8dcSSimon Schubert        and only one, of readbuf or writebuf must be non-NULL.  */
5925796c8dcSSimon Schubert 
5935796c8dcSSimon Schubert     LONGEST (*to_xfer_partial) (struct target_ops *ops,
5945796c8dcSSimon Schubert 				enum target_object object, const char *annex,
5955796c8dcSSimon Schubert 				gdb_byte *readbuf, const gdb_byte *writebuf,
5965796c8dcSSimon Schubert 				ULONGEST offset, LONGEST len);
5975796c8dcSSimon Schubert 
5985796c8dcSSimon Schubert     /* Returns the memory map for the target.  A return value of NULL
5995796c8dcSSimon Schubert        means that no memory map is available.  If a memory address
6005796c8dcSSimon Schubert        does not fall within any returned regions, it's assumed to be
6015796c8dcSSimon Schubert        RAM.  The returned memory regions should not overlap.
6025796c8dcSSimon Schubert 
6035796c8dcSSimon Schubert        The order of regions does not matter; target_memory_map will
6045796c8dcSSimon Schubert        sort regions by starting address.  For that reason, this
6055796c8dcSSimon Schubert        function should not be called directly except via
6065796c8dcSSimon Schubert        target_memory_map.
6075796c8dcSSimon Schubert 
6085796c8dcSSimon Schubert        This method should not cache data; if the memory map could
6095796c8dcSSimon Schubert        change unexpectedly, it should be invalidated, and higher
6105796c8dcSSimon Schubert        layers will re-fetch it.  */
6115796c8dcSSimon Schubert     VEC(mem_region_s) *(*to_memory_map) (struct target_ops *);
6125796c8dcSSimon Schubert 
6135796c8dcSSimon Schubert     /* Erases the region of flash memory starting at ADDRESS, of
6145796c8dcSSimon Schubert        length LENGTH.
6155796c8dcSSimon Schubert 
6165796c8dcSSimon Schubert        Precondition: both ADDRESS and ADDRESS+LENGTH should be aligned
6175796c8dcSSimon Schubert        on flash block boundaries, as reported by 'to_memory_map'.  */
6185796c8dcSSimon Schubert     void (*to_flash_erase) (struct target_ops *,
6195796c8dcSSimon Schubert                            ULONGEST address, LONGEST length);
6205796c8dcSSimon Schubert 
6215796c8dcSSimon Schubert     /* Finishes a flash memory write sequence.  After this operation
6225796c8dcSSimon Schubert        all flash memory should be available for writing and the result
6235796c8dcSSimon Schubert        of reading from areas written by 'to_flash_write' should be
6245796c8dcSSimon Schubert        equal to what was written.  */
6255796c8dcSSimon Schubert     void (*to_flash_done) (struct target_ops *);
6265796c8dcSSimon Schubert 
6275796c8dcSSimon Schubert     /* Describe the architecture-specific features of this target.
6285796c8dcSSimon Schubert        Returns the description found, or NULL if no description
6295796c8dcSSimon Schubert        was available.  */
6305796c8dcSSimon Schubert     const struct target_desc *(*to_read_description) (struct target_ops *ops);
6315796c8dcSSimon Schubert 
6325796c8dcSSimon Schubert     /* Build the PTID of the thread on which a given task is running,
6335796c8dcSSimon Schubert        based on LWP and THREAD.  These values are extracted from the
6345796c8dcSSimon Schubert        task Private_Data section of the Ada Task Control Block, and
6355796c8dcSSimon Schubert        their interpretation depends on the target.  */
6365796c8dcSSimon Schubert     ptid_t (*to_get_ada_task_ptid) (long lwp, long thread);
6375796c8dcSSimon Schubert 
6385796c8dcSSimon Schubert     /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
6395796c8dcSSimon Schubert        Return 0 if *READPTR is already at the end of the buffer.
6405796c8dcSSimon Schubert        Return -1 if there is insufficient buffer for a whole entry.
6415796c8dcSSimon Schubert        Return 1 if an entry was read into *TYPEP and *VALP.  */
6425796c8dcSSimon Schubert     int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr,
6435796c8dcSSimon Schubert                          gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp);
6445796c8dcSSimon Schubert 
6455796c8dcSSimon Schubert     /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
6465796c8dcSSimon Schubert        sequence of bytes in PATTERN with length PATTERN_LEN.
6475796c8dcSSimon Schubert 
6485796c8dcSSimon Schubert        The result is 1 if found, 0 if not found, and -1 if there was an error
6495796c8dcSSimon Schubert        requiring halting of the search (e.g. memory read error).
6505796c8dcSSimon Schubert        If the pattern is found the address is recorded in FOUND_ADDRP.  */
6515796c8dcSSimon Schubert     int (*to_search_memory) (struct target_ops *ops,
6525796c8dcSSimon Schubert 			     CORE_ADDR start_addr, ULONGEST search_space_len,
6535796c8dcSSimon Schubert 			     const gdb_byte *pattern, ULONGEST pattern_len,
6545796c8dcSSimon Schubert 			     CORE_ADDR *found_addrp);
6555796c8dcSSimon Schubert 
6565796c8dcSSimon Schubert     /* Can target execute in reverse?  */
6575796c8dcSSimon Schubert     int (*to_can_execute_reverse) (void);
6585796c8dcSSimon Schubert 
659a45ae5f8SJohn Marino     /* The direction the target is currently executing.  Must be
660a45ae5f8SJohn Marino        implemented on targets that support reverse execution and async
661a45ae5f8SJohn Marino        mode.  The default simply returns forward execution.  */
662a45ae5f8SJohn Marino     enum exec_direction_kind (*to_execution_direction) (void);
663a45ae5f8SJohn Marino 
6645796c8dcSSimon Schubert     /* Does this target support debugging multiple processes
6655796c8dcSSimon Schubert        simultaneously?  */
6665796c8dcSSimon Schubert     int (*to_supports_multi_process) (void);
6675796c8dcSSimon Schubert 
668a45ae5f8SJohn Marino     /* Does this target support enabling and disabling tracepoints while a trace
669a45ae5f8SJohn Marino        experiment is running?  */
670a45ae5f8SJohn Marino     int (*to_supports_enable_disable_tracepoint) (void);
671a45ae5f8SJohn Marino 
672a45ae5f8SJohn Marino     /* Does this target support disabling address space randomization?  */
673a45ae5f8SJohn Marino     int (*to_supports_disable_randomization) (void);
674a45ae5f8SJohn Marino 
675a45ae5f8SJohn Marino     /* Does this target support the tracenz bytecode for string collection?  */
676a45ae5f8SJohn Marino     int (*to_supports_string_tracing) (void);
677a45ae5f8SJohn Marino 
678*ef5ccd6cSJohn Marino     /* Does this target support evaluation of breakpoint conditions on its
679*ef5ccd6cSJohn Marino        end?  */
680*ef5ccd6cSJohn Marino     int (*to_supports_evaluation_of_breakpoint_conditions) (void);
681*ef5ccd6cSJohn Marino 
682*ef5ccd6cSJohn Marino     /* Does this target support evaluation of breakpoint commands on its
683*ef5ccd6cSJohn Marino        end?  */
684*ef5ccd6cSJohn Marino     int (*to_can_run_breakpoint_commands) (void);
685*ef5ccd6cSJohn Marino 
6865796c8dcSSimon Schubert     /* Determine current architecture of thread PTID.
6875796c8dcSSimon Schubert 
6885796c8dcSSimon Schubert        The target is supposed to determine the architecture of the code where
6895796c8dcSSimon Schubert        the target is currently stopped at (on Cell, if a target is in spu_run,
6905796c8dcSSimon Schubert        to_thread_architecture would return SPU, otherwise PPC32 or PPC64).
6915796c8dcSSimon Schubert        This is architecture used to perform decr_pc_after_break adjustment,
6925796c8dcSSimon Schubert        and also determines the frame architecture of the innermost frame.
693*ef5ccd6cSJohn Marino        ptrace operations need to operate according to target_gdbarch ().
6945796c8dcSSimon Schubert 
695*ef5ccd6cSJohn Marino        The default implementation always returns target_gdbarch ().  */
6965796c8dcSSimon Schubert     struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t);
6975796c8dcSSimon Schubert 
698cf7f2e2dSJohn Marino     /* Determine current address space of thread PTID.
699cf7f2e2dSJohn Marino 
700cf7f2e2dSJohn Marino        The default implementation always returns the inferior's
701cf7f2e2dSJohn Marino        address space.  */
702cf7f2e2dSJohn Marino     struct address_space *(*to_thread_address_space) (struct target_ops *,
703cf7f2e2dSJohn Marino 						      ptid_t);
704cf7f2e2dSJohn Marino 
705*ef5ccd6cSJohn Marino     /* Target file operations.  */
706*ef5ccd6cSJohn Marino 
707*ef5ccd6cSJohn Marino     /* Open FILENAME on the target, using FLAGS and MODE.  Return a
708*ef5ccd6cSJohn Marino        target file descriptor, or -1 if an error occurs (and set
709*ef5ccd6cSJohn Marino        *TARGET_ERRNO).  */
710*ef5ccd6cSJohn Marino     int (*to_fileio_open) (const char *filename, int flags, int mode,
711*ef5ccd6cSJohn Marino 			   int *target_errno);
712*ef5ccd6cSJohn Marino 
713*ef5ccd6cSJohn Marino     /* Write up to LEN bytes from WRITE_BUF to FD on the target.
714*ef5ccd6cSJohn Marino        Return the number of bytes written, or -1 if an error occurs
715*ef5ccd6cSJohn Marino        (and set *TARGET_ERRNO).  */
716*ef5ccd6cSJohn Marino     int (*to_fileio_pwrite) (int fd, const gdb_byte *write_buf, int len,
717*ef5ccd6cSJohn Marino 			     ULONGEST offset, int *target_errno);
718*ef5ccd6cSJohn Marino 
719*ef5ccd6cSJohn Marino     /* Read up to LEN bytes FD on the target into READ_BUF.
720*ef5ccd6cSJohn Marino        Return the number of bytes read, or -1 if an error occurs
721*ef5ccd6cSJohn Marino        (and set *TARGET_ERRNO).  */
722*ef5ccd6cSJohn Marino     int (*to_fileio_pread) (int fd, gdb_byte *read_buf, int len,
723*ef5ccd6cSJohn Marino 			    ULONGEST offset, int *target_errno);
724*ef5ccd6cSJohn Marino 
725*ef5ccd6cSJohn Marino     /* Close FD on the target.  Return 0, or -1 if an error occurs
726*ef5ccd6cSJohn Marino        (and set *TARGET_ERRNO).  */
727*ef5ccd6cSJohn Marino     int (*to_fileio_close) (int fd, int *target_errno);
728*ef5ccd6cSJohn Marino 
729*ef5ccd6cSJohn Marino     /* Unlink FILENAME on the target.  Return 0, or -1 if an error
730*ef5ccd6cSJohn Marino        occurs (and set *TARGET_ERRNO).  */
731*ef5ccd6cSJohn Marino     int (*to_fileio_unlink) (const char *filename, int *target_errno);
732*ef5ccd6cSJohn Marino 
733*ef5ccd6cSJohn Marino     /* Read value of symbolic link FILENAME on the target.  Return a
734*ef5ccd6cSJohn Marino        null-terminated string allocated via xmalloc, or NULL if an error
735*ef5ccd6cSJohn Marino        occurs (and set *TARGET_ERRNO).  */
736*ef5ccd6cSJohn Marino     char *(*to_fileio_readlink) (const char *filename, int *target_errno);
737*ef5ccd6cSJohn Marino 
738*ef5ccd6cSJohn Marino 
739*ef5ccd6cSJohn Marino     /* Implement the "info proc" command.  */
740*ef5ccd6cSJohn Marino     void (*to_info_proc) (struct target_ops *, char *, enum info_proc_what);
741*ef5ccd6cSJohn Marino 
742cf7f2e2dSJohn Marino     /* Tracepoint-related operations.  */
743cf7f2e2dSJohn Marino 
744cf7f2e2dSJohn Marino     /* Prepare the target for a tracing run.  */
745cf7f2e2dSJohn Marino     void (*to_trace_init) (void);
746cf7f2e2dSJohn Marino 
747a45ae5f8SJohn Marino     /* Send full details of a tracepoint location to the target.  */
748a45ae5f8SJohn Marino     void (*to_download_tracepoint) (struct bp_location *location);
749a45ae5f8SJohn Marino 
750a45ae5f8SJohn Marino     /* Is the target able to download tracepoint locations in current
751a45ae5f8SJohn Marino        state?  */
752a45ae5f8SJohn Marino     int (*to_can_download_tracepoint) (void);
753cf7f2e2dSJohn Marino 
754cf7f2e2dSJohn Marino     /* Send full details of a trace state variable to the target.  */
755cf7f2e2dSJohn Marino     void (*to_download_trace_state_variable) (struct trace_state_variable *tsv);
756cf7f2e2dSJohn Marino 
757a45ae5f8SJohn Marino     /* Enable a tracepoint on the target.  */
758a45ae5f8SJohn Marino     void (*to_enable_tracepoint) (struct bp_location *location);
759a45ae5f8SJohn Marino 
760a45ae5f8SJohn Marino     /* Disable a tracepoint on the target.  */
761a45ae5f8SJohn Marino     void (*to_disable_tracepoint) (struct bp_location *location);
762a45ae5f8SJohn Marino 
763cf7f2e2dSJohn Marino     /* Inform the target info of memory regions that are readonly
764cf7f2e2dSJohn Marino        (such as text sections), and so it should return data from
765cf7f2e2dSJohn Marino        those rather than look in the trace buffer.  */
766cf7f2e2dSJohn Marino     void (*to_trace_set_readonly_regions) (void);
767cf7f2e2dSJohn Marino 
768cf7f2e2dSJohn Marino     /* Start a trace run.  */
769cf7f2e2dSJohn Marino     void (*to_trace_start) (void);
770cf7f2e2dSJohn Marino 
771cf7f2e2dSJohn Marino     /* Get the current status of a tracing run.  */
772cf7f2e2dSJohn Marino     int (*to_get_trace_status) (struct trace_status *ts);
773cf7f2e2dSJohn Marino 
774a45ae5f8SJohn Marino     void (*to_get_tracepoint_status) (struct breakpoint *tp,
775a45ae5f8SJohn Marino 				      struct uploaded_tp *utp);
776a45ae5f8SJohn Marino 
777cf7f2e2dSJohn Marino     /* Stop a trace run.  */
778cf7f2e2dSJohn Marino     void (*to_trace_stop) (void);
779cf7f2e2dSJohn Marino 
780cf7f2e2dSJohn Marino    /* Ask the target to find a trace frame of the given type TYPE,
781cf7f2e2dSJohn Marino       using NUM, ADDR1, and ADDR2 as search parameters.  Returns the
782cf7f2e2dSJohn Marino       number of the trace frame, and also the tracepoint number at
783cf7f2e2dSJohn Marino       TPP.  If no trace frame matches, return -1.  May throw if the
784cf7f2e2dSJohn Marino       operation fails.  */
785cf7f2e2dSJohn Marino     int (*to_trace_find) (enum trace_find_type type, int num,
786cf7f2e2dSJohn Marino 			  ULONGEST addr1, ULONGEST addr2, int *tpp);
787cf7f2e2dSJohn Marino 
788cf7f2e2dSJohn Marino     /* Get the value of the trace state variable number TSV, returning
789cf7f2e2dSJohn Marino        1 if the value is known and writing the value itself into the
790cf7f2e2dSJohn Marino        location pointed to by VAL, else returning 0.  */
791cf7f2e2dSJohn Marino     int (*to_get_trace_state_variable_value) (int tsv, LONGEST *val);
792cf7f2e2dSJohn Marino 
793cf7f2e2dSJohn Marino     int (*to_save_trace_data) (const char *filename);
794cf7f2e2dSJohn Marino 
795cf7f2e2dSJohn Marino     int (*to_upload_tracepoints) (struct uploaded_tp **utpp);
796cf7f2e2dSJohn Marino 
797cf7f2e2dSJohn Marino     int (*to_upload_trace_state_variables) (struct uploaded_tsv **utsvp);
798cf7f2e2dSJohn Marino 
799cf7f2e2dSJohn Marino     LONGEST (*to_get_raw_trace_data) (gdb_byte *buf,
800cf7f2e2dSJohn Marino 				      ULONGEST offset, LONGEST len);
801cf7f2e2dSJohn Marino 
802a45ae5f8SJohn Marino     /* Get the minimum length of instruction on which a fast tracepoint
803a45ae5f8SJohn Marino        may be set on the target.  If this operation is unsupported,
804a45ae5f8SJohn Marino        return -1.  If for some reason the minimum length cannot be
805a45ae5f8SJohn Marino        determined, return 0.  */
806a45ae5f8SJohn Marino     int (*to_get_min_fast_tracepoint_insn_len) (void);
807a45ae5f8SJohn Marino 
808cf7f2e2dSJohn Marino     /* Set the target's tracing behavior in response to unexpected
809cf7f2e2dSJohn Marino        disconnection - set VAL to 1 to keep tracing, 0 to stop.  */
810cf7f2e2dSJohn Marino     void (*to_set_disconnected_tracing) (int val);
811cf7f2e2dSJohn Marino     void (*to_set_circular_trace_buffer) (int val);
812*ef5ccd6cSJohn Marino     /* Set the size of trace buffer in the target.  */
813*ef5ccd6cSJohn Marino     void (*to_set_trace_buffer_size) (LONGEST val);
814cf7f2e2dSJohn Marino 
815a45ae5f8SJohn Marino     /* Add/change textual notes about the trace run, returning 1 if
816a45ae5f8SJohn Marino        successful, 0 otherwise.  */
817a45ae5f8SJohn Marino     int (*to_set_trace_notes) (char *user, char *notes, char* stopnotes);
818a45ae5f8SJohn Marino 
819cf7f2e2dSJohn Marino     /* Return the processor core that thread PTID was last seen on.
820cf7f2e2dSJohn Marino        This information is updated only when:
821cf7f2e2dSJohn Marino        - update_thread_list is called
822cf7f2e2dSJohn Marino        - thread stops
823c50c785cSJohn Marino        If the core cannot be determined -- either for the specified
824c50c785cSJohn Marino        thread, or right now, or in this debug session, or for this
825c50c785cSJohn Marino        target -- return -1.  */
826cf7f2e2dSJohn Marino     int (*to_core_of_thread) (struct target_ops *, ptid_t ptid);
827cf7f2e2dSJohn Marino 
828cf7f2e2dSJohn Marino     /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
829cf7f2e2dSJohn Marino        matches the contents of [DATA,DATA+SIZE).  Returns 1 if there's
830cf7f2e2dSJohn Marino        a match, 0 if there's a mismatch, and -1 if an error is
831cf7f2e2dSJohn Marino        encountered while reading memory.  */
832cf7f2e2dSJohn Marino     int (*to_verify_memory) (struct target_ops *, const gdb_byte *data,
833cf7f2e2dSJohn Marino 			     CORE_ADDR memaddr, ULONGEST size);
834cf7f2e2dSJohn Marino 
835cf7f2e2dSJohn Marino     /* Return the address of the start of the Thread Information Block
836cf7f2e2dSJohn Marino        a Windows OS specific feature.  */
837cf7f2e2dSJohn Marino     int (*to_get_tib_address) (ptid_t ptid, CORE_ADDR *addr);
838cf7f2e2dSJohn Marino 
839cf7f2e2dSJohn Marino     /* Send the new settings of write permission variables.  */
840cf7f2e2dSJohn Marino     void (*to_set_permissions) (void);
841cf7f2e2dSJohn Marino 
842cf7f2e2dSJohn Marino     /* Look for a static tracepoint marker at ADDR, and fill in MARKER
843cf7f2e2dSJohn Marino        with its details.  Return 1 on success, 0 on failure.  */
844cf7f2e2dSJohn Marino     int (*to_static_tracepoint_marker_at) (CORE_ADDR,
845cf7f2e2dSJohn Marino 					   struct static_tracepoint_marker *marker);
846cf7f2e2dSJohn Marino 
847cf7f2e2dSJohn Marino     /* Return a vector of all tracepoints markers string id ID, or all
848cf7f2e2dSJohn Marino        markers if ID is NULL.  */
849cf7f2e2dSJohn Marino     VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid)
850cf7f2e2dSJohn Marino       (const char *id);
851cf7f2e2dSJohn Marino 
852c50c785cSJohn Marino     /* Return a traceframe info object describing the current
853c50c785cSJohn Marino        traceframe's contents.  This method should not cache data;
854c50c785cSJohn Marino        higher layers take care of caching, invalidating, and
855c50c785cSJohn Marino        re-fetching when necessary.  */
856c50c785cSJohn Marino     struct traceframe_info *(*to_traceframe_info) (void);
857c50c785cSJohn Marino 
858*ef5ccd6cSJohn Marino     /* Ask the target to use or not to use agent according to USE.  Return 1
859*ef5ccd6cSJohn Marino        successful, 0 otherwise.  */
860*ef5ccd6cSJohn Marino     int (*to_use_agent) (int use);
861*ef5ccd6cSJohn Marino 
862*ef5ccd6cSJohn Marino     /* Is the target able to use agent in current state?  */
863*ef5ccd6cSJohn Marino     int (*to_can_use_agent) (void);
864*ef5ccd6cSJohn Marino 
865*ef5ccd6cSJohn Marino     /* Check whether the target supports branch tracing.  */
866*ef5ccd6cSJohn Marino     int (*to_supports_btrace) (void);
867*ef5ccd6cSJohn Marino 
868*ef5ccd6cSJohn Marino     /* Enable branch tracing for PTID and allocate a branch trace target
869*ef5ccd6cSJohn Marino        information struct for reading and for disabling branch trace.  */
870*ef5ccd6cSJohn Marino     struct btrace_target_info *(*to_enable_btrace) (ptid_t ptid);
871*ef5ccd6cSJohn Marino 
872*ef5ccd6cSJohn Marino     /* Disable branch tracing and deallocate TINFO.  */
873*ef5ccd6cSJohn Marino     void (*to_disable_btrace) (struct btrace_target_info *tinfo);
874*ef5ccd6cSJohn Marino 
875*ef5ccd6cSJohn Marino     /* Disable branch tracing and deallocate TINFO.  This function is similar
876*ef5ccd6cSJohn Marino        to to_disable_btrace, except that it is called during teardown and is
877*ef5ccd6cSJohn Marino        only allowed to perform actions that are safe.  A counter-example would
878*ef5ccd6cSJohn Marino        be attempting to talk to a remote target.  */
879*ef5ccd6cSJohn Marino     void (*to_teardown_btrace) (struct btrace_target_info *tinfo);
880*ef5ccd6cSJohn Marino 
881*ef5ccd6cSJohn Marino     /* Read branch trace data.  */
882*ef5ccd6cSJohn Marino     VEC (btrace_block_s) *(*to_read_btrace) (struct btrace_target_info *,
883*ef5ccd6cSJohn Marino 					     enum btrace_read_type);
884*ef5ccd6cSJohn Marino 
885*ef5ccd6cSJohn Marino     /* Stop trace recording.  */
886*ef5ccd6cSJohn Marino     void (*to_stop_recording) (void);
887*ef5ccd6cSJohn Marino 
888*ef5ccd6cSJohn Marino     /* Print information about the recording.  */
889*ef5ccd6cSJohn Marino     void (*to_info_record) (void);
890*ef5ccd6cSJohn Marino 
891*ef5ccd6cSJohn Marino     /* Save the recorded execution trace into a file.  */
892*ef5ccd6cSJohn Marino     void (*to_save_record) (char *filename);
893*ef5ccd6cSJohn Marino 
894*ef5ccd6cSJohn Marino     /* Delete the recorded execution trace from the current position onwards.  */
895*ef5ccd6cSJohn Marino     void (*to_delete_record) (void);
896*ef5ccd6cSJohn Marino 
897*ef5ccd6cSJohn Marino     /* Query if the record target is currently replaying.  */
898*ef5ccd6cSJohn Marino     int (*to_record_is_replaying) (void);
899*ef5ccd6cSJohn Marino 
900*ef5ccd6cSJohn Marino     /* Go to the begin of the execution trace.  */
901*ef5ccd6cSJohn Marino     void (*to_goto_record_begin) (void);
902*ef5ccd6cSJohn Marino 
903*ef5ccd6cSJohn Marino     /* Go to the end of the execution trace.  */
904*ef5ccd6cSJohn Marino     void (*to_goto_record_end) (void);
905*ef5ccd6cSJohn Marino 
906*ef5ccd6cSJohn Marino     /* Go to a specific location in the recorded execution trace.  */
907*ef5ccd6cSJohn Marino     void (*to_goto_record) (ULONGEST insn);
908*ef5ccd6cSJohn Marino 
909*ef5ccd6cSJohn Marino     /* Disassemble SIZE instructions in the recorded execution trace from
910*ef5ccd6cSJohn Marino        the current position.
911*ef5ccd6cSJohn Marino        If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
912*ef5ccd6cSJohn Marino        disassemble SIZE succeeding instructions.  */
913*ef5ccd6cSJohn Marino     void (*to_insn_history) (int size, int flags);
914*ef5ccd6cSJohn Marino 
915*ef5ccd6cSJohn Marino     /* Disassemble SIZE instructions in the recorded execution trace around
916*ef5ccd6cSJohn Marino        FROM.
917*ef5ccd6cSJohn Marino        If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
918*ef5ccd6cSJohn Marino        disassemble SIZE instructions after FROM.  */
919*ef5ccd6cSJohn Marino     void (*to_insn_history_from) (ULONGEST from, int size, int flags);
920*ef5ccd6cSJohn Marino 
921*ef5ccd6cSJohn Marino     /* Disassemble a section of the recorded execution trace from instruction
922*ef5ccd6cSJohn Marino        BEGIN (inclusive) to instruction END (exclusive).  */
923*ef5ccd6cSJohn Marino     void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags);
924*ef5ccd6cSJohn Marino 
925*ef5ccd6cSJohn Marino     /* Print a function trace of the recorded execution trace.
926*ef5ccd6cSJohn Marino        If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
927*ef5ccd6cSJohn Marino        succeeding functions.  */
928*ef5ccd6cSJohn Marino     void (*to_call_history) (int size, int flags);
929*ef5ccd6cSJohn Marino 
930*ef5ccd6cSJohn Marino     /* Print a function trace of the recorded execution trace starting
931*ef5ccd6cSJohn Marino        at function FROM.
932*ef5ccd6cSJohn Marino        If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
933*ef5ccd6cSJohn Marino        SIZE functions after FROM.  */
934*ef5ccd6cSJohn Marino     void (*to_call_history_from) (ULONGEST begin, int size, int flags);
935*ef5ccd6cSJohn Marino 
936*ef5ccd6cSJohn Marino     /* Print a function trace of an execution trace section from function BEGIN
937*ef5ccd6cSJohn Marino        (inclusive) to function END (exclusive).  */
938*ef5ccd6cSJohn Marino     void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
939*ef5ccd6cSJohn Marino 
9405796c8dcSSimon Schubert     int to_magic;
9415796c8dcSSimon Schubert     /* Need sub-structure for target machine related rather than comm related?
9425796c8dcSSimon Schubert      */
9435796c8dcSSimon Schubert   };
9445796c8dcSSimon Schubert 
9455796c8dcSSimon Schubert /* Magic number for checking ops size.  If a struct doesn't end with this
9465796c8dcSSimon Schubert    number, somebody changed the declaration but didn't change all the
9475796c8dcSSimon Schubert    places that initialize one.  */
9485796c8dcSSimon Schubert 
9495796c8dcSSimon Schubert #define	OPS_MAGIC	3840
9505796c8dcSSimon Schubert 
9515796c8dcSSimon Schubert /* The ops structure for our "current" target process.  This should
9525796c8dcSSimon Schubert    never be NULL.  If there is no target, it points to the dummy_target.  */
9535796c8dcSSimon Schubert 
9545796c8dcSSimon Schubert extern struct target_ops current_target;
9555796c8dcSSimon Schubert 
9565796c8dcSSimon Schubert /* Define easy words for doing these operations on our current target.  */
9575796c8dcSSimon Schubert 
9585796c8dcSSimon Schubert #define	target_shortname	(current_target.to_shortname)
9595796c8dcSSimon Schubert #define	target_longname		(current_target.to_longname)
9605796c8dcSSimon Schubert 
9615796c8dcSSimon Schubert /* Does whatever cleanup is required for a target that we are no
9625796c8dcSSimon Schubert    longer going to be calling.  QUITTING indicates that GDB is exiting
9635796c8dcSSimon Schubert    and should not get hung on an error (otherwise it is important to
9645796c8dcSSimon Schubert    perform clean termination, even if it takes a while).  This routine
965*ef5ccd6cSJohn Marino    is automatically always called after popping the target off the
966*ef5ccd6cSJohn Marino    target stack - the target's own methods are no longer available
967*ef5ccd6cSJohn Marino    through the target vector.  Closing file descriptors and freeing all
968*ef5ccd6cSJohn Marino    memory allocated memory are typical things it should do.  */
9695796c8dcSSimon Schubert 
9705796c8dcSSimon Schubert void target_close (struct target_ops *targ, int quitting);
9715796c8dcSSimon Schubert 
9725796c8dcSSimon Schubert /* Attaches to a process on the target side.  Arguments are as passed
9735796c8dcSSimon Schubert    to the `attach' command by the user.  This routine can be called
9745796c8dcSSimon Schubert    when the target is not on the target-stack, if the target_can_run
9755796c8dcSSimon Schubert    routine returns 1; in that case, it must push itself onto the stack.
9765796c8dcSSimon Schubert    Upon exit, the target should be ready for normal operations, and
9775796c8dcSSimon Schubert    should be ready to deliver the status of the process immediately
9785796c8dcSSimon Schubert    (without waiting) to an upcoming target_wait call.  */
9795796c8dcSSimon Schubert 
9805796c8dcSSimon Schubert void target_attach (char *, int);
9815796c8dcSSimon Schubert 
9825796c8dcSSimon Schubert /* Some targets don't generate traps when attaching to the inferior,
9835796c8dcSSimon Schubert    or their target_attach implementation takes care of the waiting.
9845796c8dcSSimon Schubert    These targets must set to_attach_no_wait.  */
9855796c8dcSSimon Schubert 
9865796c8dcSSimon Schubert #define target_attach_no_wait \
9875796c8dcSSimon Schubert      (current_target.to_attach_no_wait)
9885796c8dcSSimon Schubert 
9895796c8dcSSimon Schubert /* The target_attach operation places a process under debugger control,
9905796c8dcSSimon Schubert    and stops the process.
9915796c8dcSSimon Schubert 
9925796c8dcSSimon Schubert    This operation provides a target-specific hook that allows the
9935796c8dcSSimon Schubert    necessary bookkeeping to be performed after an attach completes.  */
9945796c8dcSSimon Schubert #define target_post_attach(pid) \
9955796c8dcSSimon Schubert      (*current_target.to_post_attach) (pid)
9965796c8dcSSimon Schubert 
9975796c8dcSSimon Schubert /* Takes a program previously attached to and detaches it.
9985796c8dcSSimon Schubert    The program may resume execution (some targets do, some don't) and will
9995796c8dcSSimon Schubert    no longer stop on signals, etc.  We better not have left any breakpoints
10005796c8dcSSimon Schubert    in the program or it'll die when it hits one.  ARGS is arguments
10015796c8dcSSimon Schubert    typed by the user (e.g. a signal to send the process).  FROM_TTY
10025796c8dcSSimon Schubert    says whether to be verbose or not.  */
10035796c8dcSSimon Schubert 
10045796c8dcSSimon Schubert extern void target_detach (char *, int);
10055796c8dcSSimon Schubert 
10065796c8dcSSimon Schubert /* Disconnect from the current target without resuming it (leaving it
10075796c8dcSSimon Schubert    waiting for a debugger).  */
10085796c8dcSSimon Schubert 
10095796c8dcSSimon Schubert extern void target_disconnect (char *, int);
10105796c8dcSSimon Schubert 
1011*ef5ccd6cSJohn Marino /* Resume execution of the target process PTID (or a group of
1012*ef5ccd6cSJohn Marino    threads).  STEP says whether to single-step or to run free; SIGGNAL
1013*ef5ccd6cSJohn Marino    is the signal to be given to the target, or GDB_SIGNAL_0 for no
1014*ef5ccd6cSJohn Marino    signal.  The caller may not pass GDB_SIGNAL_DEFAULT.  A specific
1015*ef5ccd6cSJohn Marino    PTID means `step/resume only this process id'.  A wildcard PTID
1016*ef5ccd6cSJohn Marino    (all threads, or all threads of process) means `step/resume
1017*ef5ccd6cSJohn Marino    INFERIOR_PTID, and let other threads (for which the wildcard PTID
1018*ef5ccd6cSJohn Marino    matches) resume with their 'thread->suspend.stop_signal' signal
1019*ef5ccd6cSJohn Marino    (usually GDB_SIGNAL_0) if it is in "pass" state, or with no signal
1020*ef5ccd6cSJohn Marino    if in "no pass" state.  */
10215796c8dcSSimon Schubert 
1022*ef5ccd6cSJohn Marino extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal);
10235796c8dcSSimon Schubert 
10245796c8dcSSimon Schubert /* Wait for process pid to do something.  PTID = -1 to wait for any
10255796c8dcSSimon Schubert    pid to do something.  Return pid of child, or -1 in case of error;
10265796c8dcSSimon Schubert    store status through argument pointer STATUS.  Note that it is
10275796c8dcSSimon Schubert    _NOT_ OK to throw_exception() out of target_wait() without popping
10285796c8dcSSimon Schubert    the debugging target from the stack; GDB isn't prepared to get back
10295796c8dcSSimon Schubert    to the prompt with a debugging target but without the frame cache,
10305796c8dcSSimon Schubert    stop_pc, etc., set up.  OPTIONS is a bitwise OR of TARGET_W*
10315796c8dcSSimon Schubert    options.  */
10325796c8dcSSimon Schubert 
10335796c8dcSSimon Schubert extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
10345796c8dcSSimon Schubert 			   int options);
10355796c8dcSSimon Schubert 
10365796c8dcSSimon Schubert /* Fetch at least register REGNO, or all regs if regno == -1.  No result.  */
10375796c8dcSSimon Schubert 
10385796c8dcSSimon Schubert extern void target_fetch_registers (struct regcache *regcache, int regno);
10395796c8dcSSimon Schubert 
10405796c8dcSSimon Schubert /* Store at least register REGNO, or all regs if REGNO == -1.
10415796c8dcSSimon Schubert    It can store as many registers as it wants to, so target_prepare_to_store
10425796c8dcSSimon Schubert    must have been previously called.  Calls error() if there are problems.  */
10435796c8dcSSimon Schubert 
10445796c8dcSSimon Schubert extern void target_store_registers (struct regcache *regcache, int regs);
10455796c8dcSSimon Schubert 
10465796c8dcSSimon Schubert /* Get ready to modify the registers array.  On machines which store
10475796c8dcSSimon Schubert    individual registers, this doesn't need to do anything.  On machines
10485796c8dcSSimon Schubert    which store all the registers in one fell swoop, this makes sure
10495796c8dcSSimon Schubert    that REGISTERS contains all the registers from the program being
10505796c8dcSSimon Schubert    debugged.  */
10515796c8dcSSimon Schubert 
10525796c8dcSSimon Schubert #define	target_prepare_to_store(regcache)	\
10535796c8dcSSimon Schubert      (*current_target.to_prepare_to_store) (regcache)
10545796c8dcSSimon Schubert 
1055cf7f2e2dSJohn Marino /* Determine current address space of thread PTID.  */
1056cf7f2e2dSJohn Marino 
1057cf7f2e2dSJohn Marino struct address_space *target_thread_address_space (ptid_t);
1058cf7f2e2dSJohn Marino 
1059*ef5ccd6cSJohn Marino /* Implement the "info proc" command.  This returns one if the request
1060*ef5ccd6cSJohn Marino    was handled, and zero otherwise.  It can also throw an exception if
1061*ef5ccd6cSJohn Marino    an error was encountered while attempting to handle the
1062*ef5ccd6cSJohn Marino    request.  */
1063*ef5ccd6cSJohn Marino 
1064*ef5ccd6cSJohn Marino int target_info_proc (char *, enum info_proc_what);
1065*ef5ccd6cSJohn Marino 
10665796c8dcSSimon Schubert /* Returns true if this target can debug multiple processes
10675796c8dcSSimon Schubert    simultaneously.  */
10685796c8dcSSimon Schubert 
10695796c8dcSSimon Schubert #define	target_supports_multi_process()	\
10705796c8dcSSimon Schubert      (*current_target.to_supports_multi_process) ()
10715796c8dcSSimon Schubert 
1072a45ae5f8SJohn Marino /* Returns true if this target can disable address space randomization.  */
1073a45ae5f8SJohn Marino 
1074a45ae5f8SJohn Marino int target_supports_disable_randomization (void);
1075a45ae5f8SJohn Marino 
1076a45ae5f8SJohn Marino /* Returns true if this target can enable and disable tracepoints
1077a45ae5f8SJohn Marino    while a trace experiment is running.  */
1078a45ae5f8SJohn Marino 
1079a45ae5f8SJohn Marino #define target_supports_enable_disable_tracepoint() \
1080a45ae5f8SJohn Marino   (*current_target.to_supports_enable_disable_tracepoint) ()
1081a45ae5f8SJohn Marino 
1082a45ae5f8SJohn Marino #define target_supports_string_tracing() \
1083a45ae5f8SJohn Marino   (*current_target.to_supports_string_tracing) ()
1084a45ae5f8SJohn Marino 
1085*ef5ccd6cSJohn Marino /* Returns true if this target can handle breakpoint conditions
1086*ef5ccd6cSJohn Marino    on its end.  */
1087*ef5ccd6cSJohn Marino 
1088*ef5ccd6cSJohn Marino #define target_supports_evaluation_of_breakpoint_conditions() \
1089*ef5ccd6cSJohn Marino   (*current_target.to_supports_evaluation_of_breakpoint_conditions) ()
1090*ef5ccd6cSJohn Marino 
1091*ef5ccd6cSJohn Marino /* Returns true if this target can handle breakpoint commands
1092*ef5ccd6cSJohn Marino    on its end.  */
1093*ef5ccd6cSJohn Marino 
1094*ef5ccd6cSJohn Marino #define target_can_run_breakpoint_commands() \
1095*ef5ccd6cSJohn Marino   (*current_target.to_can_run_breakpoint_commands) ()
1096*ef5ccd6cSJohn Marino 
10975796c8dcSSimon Schubert /* Invalidate all target dcaches.  */
10985796c8dcSSimon Schubert extern void target_dcache_invalidate (void);
10995796c8dcSSimon Schubert 
11005796c8dcSSimon Schubert extern int target_read_string (CORE_ADDR, char **, int, int *);
11015796c8dcSSimon Schubert 
1102*ef5ccd6cSJohn Marino extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
1103*ef5ccd6cSJohn Marino 			       ssize_t len);
11045796c8dcSSimon Schubert 
1105*ef5ccd6cSJohn Marino extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
11065796c8dcSSimon Schubert 
11075796c8dcSSimon Schubert extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
1108*ef5ccd6cSJohn Marino 				ssize_t len);
11095796c8dcSSimon Schubert 
1110a45ae5f8SJohn Marino extern int target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
1111*ef5ccd6cSJohn Marino 				    ssize_t len);
1112a45ae5f8SJohn Marino 
11135796c8dcSSimon Schubert /* Fetches the target's memory map.  If one is found it is sorted
11145796c8dcSSimon Schubert    and returned, after some consistency checking.  Otherwise, NULL
11155796c8dcSSimon Schubert    is returned.  */
11165796c8dcSSimon Schubert VEC(mem_region_s) *target_memory_map (void);
11175796c8dcSSimon Schubert 
11185796c8dcSSimon Schubert /* Erase the specified flash region.  */
11195796c8dcSSimon Schubert void target_flash_erase (ULONGEST address, LONGEST length);
11205796c8dcSSimon Schubert 
11215796c8dcSSimon Schubert /* Finish a sequence of flash operations.  */
11225796c8dcSSimon Schubert void target_flash_done (void);
11235796c8dcSSimon Schubert 
11245796c8dcSSimon Schubert /* Describes a request for a memory write operation.  */
11255796c8dcSSimon Schubert struct memory_write_request
11265796c8dcSSimon Schubert   {
11275796c8dcSSimon Schubert     /* Begining address that must be written.  */
11285796c8dcSSimon Schubert     ULONGEST begin;
11295796c8dcSSimon Schubert     /* Past-the-end address.  */
11305796c8dcSSimon Schubert     ULONGEST end;
11315796c8dcSSimon Schubert     /* The data to write.  */
11325796c8dcSSimon Schubert     gdb_byte *data;
11335796c8dcSSimon Schubert     /* A callback baton for progress reporting for this request.  */
11345796c8dcSSimon Schubert     void *baton;
11355796c8dcSSimon Schubert   };
11365796c8dcSSimon Schubert typedef struct memory_write_request memory_write_request_s;
11375796c8dcSSimon Schubert DEF_VEC_O(memory_write_request_s);
11385796c8dcSSimon Schubert 
11395796c8dcSSimon Schubert /* Enumeration specifying different flash preservation behaviour.  */
11405796c8dcSSimon Schubert enum flash_preserve_mode
11415796c8dcSSimon Schubert   {
11425796c8dcSSimon Schubert     flash_preserve,
11435796c8dcSSimon Schubert     flash_discard
11445796c8dcSSimon Schubert   };
11455796c8dcSSimon Schubert 
11465796c8dcSSimon Schubert /* Write several memory blocks at once.  This version can be more
11475796c8dcSSimon Schubert    efficient than making several calls to target_write_memory, in
11485796c8dcSSimon Schubert    particular because it can optimize accesses to flash memory.
11495796c8dcSSimon Schubert 
11505796c8dcSSimon Schubert    Moreover, this is currently the only memory access function in gdb
11515796c8dcSSimon Schubert    that supports writing to flash memory, and it should be used for
11525796c8dcSSimon Schubert    all cases where access to flash memory is desirable.
11535796c8dcSSimon Schubert 
11545796c8dcSSimon Schubert    REQUESTS is the vector (see vec.h) of memory_write_request.
11555796c8dcSSimon Schubert    PRESERVE_FLASH_P indicates what to do with blocks which must be
11565796c8dcSSimon Schubert      erased, but not completely rewritten.
11575796c8dcSSimon Schubert    PROGRESS_CB is a function that will be periodically called to provide
11585796c8dcSSimon Schubert      feedback to user.  It will be called with the baton corresponding
11595796c8dcSSimon Schubert      to the request currently being written.  It may also be called
11605796c8dcSSimon Schubert      with a NULL baton, when preserved flash sectors are being rewritten.
11615796c8dcSSimon Schubert 
11625796c8dcSSimon Schubert    The function returns 0 on success, and error otherwise.  */
11635796c8dcSSimon Schubert int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
11645796c8dcSSimon Schubert 				enum flash_preserve_mode preserve_flash_p,
11655796c8dcSSimon Schubert 				void (*progress_cb) (ULONGEST, void *));
11665796c8dcSSimon Schubert 
11675796c8dcSSimon Schubert /* Print a line about the current target.  */
11685796c8dcSSimon Schubert 
11695796c8dcSSimon Schubert #define	target_files_info()	\
11705796c8dcSSimon Schubert      (*current_target.to_files_info) (&current_target)
11715796c8dcSSimon Schubert 
11725796c8dcSSimon Schubert /* Insert a breakpoint at address BP_TGT->placed_address in the target
11735796c8dcSSimon Schubert    machine.  Result is 0 for success, or an errno value.  */
11745796c8dcSSimon Schubert 
1175cf7f2e2dSJohn Marino extern int target_insert_breakpoint (struct gdbarch *gdbarch,
1176cf7f2e2dSJohn Marino 				     struct bp_target_info *bp_tgt);
11775796c8dcSSimon Schubert 
11785796c8dcSSimon Schubert /* Remove a breakpoint at address BP_TGT->placed_address in the target
11795796c8dcSSimon Schubert    machine.  Result is 0 for success, or an errno value.  */
11805796c8dcSSimon Schubert 
1181cf7f2e2dSJohn Marino extern int target_remove_breakpoint (struct gdbarch *gdbarch,
1182cf7f2e2dSJohn Marino 				     struct bp_target_info *bp_tgt);
11835796c8dcSSimon Schubert 
11845796c8dcSSimon Schubert /* Initialize the terminal settings we record for the inferior,
11855796c8dcSSimon Schubert    before we actually run the inferior.  */
11865796c8dcSSimon Schubert 
11875796c8dcSSimon Schubert #define target_terminal_init() \
11885796c8dcSSimon Schubert      (*current_target.to_terminal_init) ()
11895796c8dcSSimon Schubert 
11905796c8dcSSimon Schubert /* Put the inferior's terminal settings into effect.
11915796c8dcSSimon Schubert    This is preparation for starting or resuming the inferior.  */
11925796c8dcSSimon Schubert 
11935796c8dcSSimon Schubert extern void target_terminal_inferior (void);
11945796c8dcSSimon Schubert 
11955796c8dcSSimon Schubert /* Put some of our terminal settings into effect,
11965796c8dcSSimon Schubert    enough to get proper results from our output,
11975796c8dcSSimon Schubert    but do not change into or out of RAW mode
11985796c8dcSSimon Schubert    so that no input is discarded.
11995796c8dcSSimon Schubert 
12005796c8dcSSimon Schubert    After doing this, either terminal_ours or terminal_inferior
12015796c8dcSSimon Schubert    should be called to get back to a normal state of affairs.  */
12025796c8dcSSimon Schubert 
12035796c8dcSSimon Schubert #define target_terminal_ours_for_output() \
12045796c8dcSSimon Schubert      (*current_target.to_terminal_ours_for_output) ()
12055796c8dcSSimon Schubert 
12065796c8dcSSimon Schubert /* Put our terminal settings into effect.
12075796c8dcSSimon Schubert    First record the inferior's terminal settings
12085796c8dcSSimon Schubert    so they can be restored properly later.  */
12095796c8dcSSimon Schubert 
12105796c8dcSSimon Schubert #define target_terminal_ours() \
12115796c8dcSSimon Schubert      (*current_target.to_terminal_ours) ()
12125796c8dcSSimon Schubert 
12135796c8dcSSimon Schubert /* Save our terminal settings.
12145796c8dcSSimon Schubert    This is called from TUI after entering or leaving the curses
12155796c8dcSSimon Schubert    mode.  Since curses modifies our terminal this call is here
12165796c8dcSSimon Schubert    to take this change into account.  */
12175796c8dcSSimon Schubert 
12185796c8dcSSimon Schubert #define target_terminal_save_ours() \
12195796c8dcSSimon Schubert      (*current_target.to_terminal_save_ours) ()
12205796c8dcSSimon Schubert 
12215796c8dcSSimon Schubert /* Print useful information about our terminal status, if such a thing
12225796c8dcSSimon Schubert    exists.  */
12235796c8dcSSimon Schubert 
12245796c8dcSSimon Schubert #define target_terminal_info(arg, from_tty) \
12255796c8dcSSimon Schubert      (*current_target.to_terminal_info) (arg, from_tty)
12265796c8dcSSimon Schubert 
12275796c8dcSSimon Schubert /* Kill the inferior process.   Make it go away.  */
12285796c8dcSSimon Schubert 
12295796c8dcSSimon Schubert extern void target_kill (void);
12305796c8dcSSimon Schubert 
12315796c8dcSSimon Schubert /* Load an executable file into the target process.  This is expected
12325796c8dcSSimon Schubert    to not only bring new code into the target process, but also to
12335796c8dcSSimon Schubert    update GDB's symbol tables to match.
12345796c8dcSSimon Schubert 
12355796c8dcSSimon Schubert    ARG contains command-line arguments, to be broken down with
12365796c8dcSSimon Schubert    buildargv ().  The first non-switch argument is the filename to
12375796c8dcSSimon Schubert    load, FILE; the second is a number (as parsed by strtoul (..., ...,
12385796c8dcSSimon Schubert    0)), which is an offset to apply to the load addresses of FILE's
12395796c8dcSSimon Schubert    sections.  The target may define switches, or other non-switch
12405796c8dcSSimon Schubert    arguments, as it pleases.  */
12415796c8dcSSimon Schubert 
12425796c8dcSSimon Schubert extern void target_load (char *arg, int from_tty);
12435796c8dcSSimon Schubert 
12445796c8dcSSimon Schubert /* Start an inferior process and set inferior_ptid to its pid.
12455796c8dcSSimon Schubert    EXEC_FILE is the file to run.
12465796c8dcSSimon Schubert    ALLARGS is a string containing the arguments to the program.
12475796c8dcSSimon Schubert    ENV is the environment vector to pass.  Errors reported with error().
12485796c8dcSSimon Schubert    On VxWorks and various standalone systems, we ignore exec_file.  */
12495796c8dcSSimon Schubert 
12505796c8dcSSimon Schubert void target_create_inferior (char *exec_file, char *args,
12515796c8dcSSimon Schubert 			     char **env, int from_tty);
12525796c8dcSSimon Schubert 
12535796c8dcSSimon Schubert /* Some targets (such as ttrace-based HPUX) don't allow us to request
12545796c8dcSSimon Schubert    notification of inferior events such as fork and vork immediately
12555796c8dcSSimon Schubert    after the inferior is created.  (This because of how gdb gets an
12565796c8dcSSimon Schubert    inferior created via invoking a shell to do it.  In such a scenario,
12575796c8dcSSimon Schubert    if the shell init file has commands in it, the shell will fork and
12585796c8dcSSimon Schubert    exec for each of those commands, and we will see each such fork
12595796c8dcSSimon Schubert    event.  Very bad.)
12605796c8dcSSimon Schubert 
12615796c8dcSSimon Schubert    Such targets will supply an appropriate definition for this function.  */
12625796c8dcSSimon Schubert 
12635796c8dcSSimon Schubert #define target_post_startup_inferior(ptid) \
12645796c8dcSSimon Schubert      (*current_target.to_post_startup_inferior) (ptid)
12655796c8dcSSimon Schubert 
12665796c8dcSSimon Schubert /* On some targets, we can catch an inferior fork or vfork event when
12675796c8dcSSimon Schubert    it occurs.  These functions insert/remove an already-created
1268c50c785cSJohn Marino    catchpoint for such events.  They return  0 for success, 1 if the
1269c50c785cSJohn Marino    catchpoint type is not supported and -1 for failure.  */
12705796c8dcSSimon Schubert 
12715796c8dcSSimon Schubert #define target_insert_fork_catchpoint(pid) \
12725796c8dcSSimon Schubert      (*current_target.to_insert_fork_catchpoint) (pid)
12735796c8dcSSimon Schubert 
12745796c8dcSSimon Schubert #define target_remove_fork_catchpoint(pid) \
12755796c8dcSSimon Schubert      (*current_target.to_remove_fork_catchpoint) (pid)
12765796c8dcSSimon Schubert 
12775796c8dcSSimon Schubert #define target_insert_vfork_catchpoint(pid) \
12785796c8dcSSimon Schubert      (*current_target.to_insert_vfork_catchpoint) (pid)
12795796c8dcSSimon Schubert 
12805796c8dcSSimon Schubert #define target_remove_vfork_catchpoint(pid) \
12815796c8dcSSimon Schubert      (*current_target.to_remove_vfork_catchpoint) (pid)
12825796c8dcSSimon Schubert 
12835796c8dcSSimon Schubert /* If the inferior forks or vforks, this function will be called at
12845796c8dcSSimon Schubert    the next resume in order to perform any bookkeeping and fiddling
12855796c8dcSSimon Schubert    necessary to continue debugging either the parent or child, as
12865796c8dcSSimon Schubert    requested, and releasing the other.  Information about the fork
12875796c8dcSSimon Schubert    or vfork event is available via get_last_target_status ().
12885796c8dcSSimon Schubert    This function returns 1 if the inferior should not be resumed
12895796c8dcSSimon Schubert    (i.e. there is another event pending).  */
12905796c8dcSSimon Schubert 
12915796c8dcSSimon Schubert int target_follow_fork (int follow_child);
12925796c8dcSSimon Schubert 
12935796c8dcSSimon Schubert /* On some targets, we can catch an inferior exec event when it
12945796c8dcSSimon Schubert    occurs.  These functions insert/remove an already-created
1295c50c785cSJohn Marino    catchpoint for such events.  They return  0 for success, 1 if the
1296c50c785cSJohn Marino    catchpoint type is not supported and -1 for failure.  */
12975796c8dcSSimon Schubert 
12985796c8dcSSimon Schubert #define target_insert_exec_catchpoint(pid) \
12995796c8dcSSimon Schubert      (*current_target.to_insert_exec_catchpoint) (pid)
13005796c8dcSSimon Schubert 
13015796c8dcSSimon Schubert #define target_remove_exec_catchpoint(pid) \
13025796c8dcSSimon Schubert      (*current_target.to_remove_exec_catchpoint) (pid)
13035796c8dcSSimon Schubert 
13045796c8dcSSimon Schubert /* Syscall catch.
13055796c8dcSSimon Schubert 
13065796c8dcSSimon Schubert    NEEDED is nonzero if any syscall catch (of any kind) is requested.
13075796c8dcSSimon Schubert    If NEEDED is zero, it means the target can disable the mechanism to
13085796c8dcSSimon Schubert    catch system calls because there are no more catchpoints of this type.
13095796c8dcSSimon Schubert 
13105796c8dcSSimon Schubert    ANY_COUNT is nonzero if a generic (filter-less) syscall catch is
13115796c8dcSSimon Schubert    being requested.  In this case, both TABLE_SIZE and TABLE should
13125796c8dcSSimon Schubert    be ignored.
13135796c8dcSSimon Schubert 
13145796c8dcSSimon Schubert    TABLE_SIZE is the number of elements in TABLE.  It only matters if
13155796c8dcSSimon Schubert    ANY_COUNT is zero.
13165796c8dcSSimon Schubert 
13175796c8dcSSimon Schubert    TABLE is an array of ints, indexed by syscall number.  An element in
13185796c8dcSSimon Schubert    this array is nonzero if that syscall should be caught.  This argument
1319c50c785cSJohn Marino    only matters if ANY_COUNT is zero.
1320c50c785cSJohn Marino 
1321c50c785cSJohn Marino    Return 0 for success, 1 if syscall catchpoints are not supported or -1
1322c50c785cSJohn Marino    for failure.  */
13235796c8dcSSimon Schubert 
13245796c8dcSSimon Schubert #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \
13255796c8dcSSimon Schubert      (*current_target.to_set_syscall_catchpoint) (pid, needed, any_count, \
13265796c8dcSSimon Schubert 						  table_size, table)
13275796c8dcSSimon Schubert 
13285796c8dcSSimon Schubert /* Returns TRUE if PID has exited.  And, also sets EXIT_STATUS to the
13295796c8dcSSimon Schubert    exit code of PID, if any.  */
13305796c8dcSSimon Schubert 
13315796c8dcSSimon Schubert #define target_has_exited(pid,wait_status,exit_status) \
13325796c8dcSSimon Schubert      (*current_target.to_has_exited) (pid,wait_status,exit_status)
13335796c8dcSSimon Schubert 
13345796c8dcSSimon Schubert /* The debugger has completed a blocking wait() call.  There is now
13355796c8dcSSimon Schubert    some process event that must be processed.  This function should
13365796c8dcSSimon Schubert    be defined by those targets that require the debugger to perform
13375796c8dcSSimon Schubert    cleanup or internal state changes in response to the process event.  */
13385796c8dcSSimon Schubert 
13395796c8dcSSimon Schubert /* The inferior process has died.  Do what is right.  */
13405796c8dcSSimon Schubert 
13415796c8dcSSimon Schubert void target_mourn_inferior (void);
13425796c8dcSSimon Schubert 
13435796c8dcSSimon Schubert /* Does target have enough data to do a run or attach command? */
13445796c8dcSSimon Schubert 
13455796c8dcSSimon Schubert #define target_can_run(t) \
13465796c8dcSSimon Schubert      ((t)->to_can_run) ()
13475796c8dcSSimon Schubert 
1348a45ae5f8SJohn Marino /* Set list of signals to be handled in the target.
13495796c8dcSSimon Schubert 
1350a45ae5f8SJohn Marino    PASS_SIGNALS is an array of size NSIG, indexed by target signal number
1351*ef5ccd6cSJohn Marino    (enum gdb_signal).  For every signal whose entry in this array is
1352a45ae5f8SJohn Marino    non-zero, the target is allowed -but not required- to skip reporting
1353a45ae5f8SJohn Marino    arrival of the signal to the GDB core by returning from target_wait,
1354a45ae5f8SJohn Marino    and to pass the signal directly to the inferior instead.
1355a45ae5f8SJohn Marino 
1356a45ae5f8SJohn Marino    However, if the target is hardware single-stepping a thread that is
1357a45ae5f8SJohn Marino    about to receive a signal, it needs to be reported in any case, even
1358a45ae5f8SJohn Marino    if mentioned in a previous target_pass_signals call.   */
1359a45ae5f8SJohn Marino 
1360a45ae5f8SJohn Marino extern void target_pass_signals (int nsig, unsigned char *pass_signals);
13615796c8dcSSimon Schubert 
1362*ef5ccd6cSJohn Marino /* Set list of signals the target may pass to the inferior.  This
1363*ef5ccd6cSJohn Marino    directly maps to the "handle SIGNAL pass/nopass" setting.
1364*ef5ccd6cSJohn Marino 
1365*ef5ccd6cSJohn Marino    PROGRAM_SIGNALS is an array of size NSIG, indexed by target signal
1366*ef5ccd6cSJohn Marino    number (enum gdb_signal).  For every signal whose entry in this
1367*ef5ccd6cSJohn Marino    array is non-zero, the target is allowed to pass the signal to the
1368*ef5ccd6cSJohn Marino    inferior.  Signals not present in the array shall be silently
1369*ef5ccd6cSJohn Marino    discarded.  This does not influence whether to pass signals to the
1370*ef5ccd6cSJohn Marino    inferior as a result of a target_resume call.  This is useful in
1371*ef5ccd6cSJohn Marino    scenarios where the target needs to decide whether to pass or not a
1372*ef5ccd6cSJohn Marino    signal to the inferior without GDB core involvement, such as for
1373*ef5ccd6cSJohn Marino    example, when detaching (as threads may have been suspended with
1374*ef5ccd6cSJohn Marino    pending signals not reported to GDB).  */
1375*ef5ccd6cSJohn Marino 
1376*ef5ccd6cSJohn Marino extern void target_program_signals (int nsig, unsigned char *program_signals);
1377*ef5ccd6cSJohn Marino 
13785796c8dcSSimon Schubert /* Check to see if a thread is still alive.  */
13795796c8dcSSimon Schubert 
13805796c8dcSSimon Schubert extern int target_thread_alive (ptid_t ptid);
13815796c8dcSSimon Schubert 
13825796c8dcSSimon Schubert /* Query for new threads and add them to the thread list.  */
13835796c8dcSSimon Schubert 
13845796c8dcSSimon Schubert extern void target_find_new_threads (void);
13855796c8dcSSimon Schubert 
13865796c8dcSSimon Schubert /* Make target stop in a continuable fashion.  (For instance, under
13875796c8dcSSimon Schubert    Unix, this should act like SIGSTOP).  This function is normally
13885796c8dcSSimon Schubert    used by GUIs to implement a stop button.  */
13895796c8dcSSimon Schubert 
1390cf7f2e2dSJohn Marino extern void target_stop (ptid_t ptid);
13915796c8dcSSimon Schubert 
13925796c8dcSSimon Schubert /* Send the specified COMMAND to the target's monitor
13935796c8dcSSimon Schubert    (shell,interpreter) for execution.  The result of the query is
13945796c8dcSSimon Schubert    placed in OUTBUF.  */
13955796c8dcSSimon Schubert 
13965796c8dcSSimon Schubert #define target_rcmd(command, outbuf) \
13975796c8dcSSimon Schubert      (*current_target.to_rcmd) (command, outbuf)
13985796c8dcSSimon Schubert 
13995796c8dcSSimon Schubert 
14005796c8dcSSimon Schubert /* Does the target include all of memory, or only part of it?  This
14015796c8dcSSimon Schubert    determines whether we look up the target chain for other parts of
14025796c8dcSSimon Schubert    memory if this target can't satisfy a request.  */
14035796c8dcSSimon Schubert 
14045796c8dcSSimon Schubert extern int target_has_all_memory_1 (void);
14055796c8dcSSimon Schubert #define target_has_all_memory target_has_all_memory_1 ()
14065796c8dcSSimon Schubert 
14075796c8dcSSimon Schubert /* Does the target include memory?  (Dummy targets don't.)  */
14085796c8dcSSimon Schubert 
14095796c8dcSSimon Schubert extern int target_has_memory_1 (void);
14105796c8dcSSimon Schubert #define target_has_memory target_has_memory_1 ()
14115796c8dcSSimon Schubert 
14125796c8dcSSimon Schubert /* Does the target have a stack?  (Exec files don't, VxWorks doesn't, until
14135796c8dcSSimon Schubert    we start a process.)  */
14145796c8dcSSimon Schubert 
14155796c8dcSSimon Schubert extern int target_has_stack_1 (void);
14165796c8dcSSimon Schubert #define target_has_stack target_has_stack_1 ()
14175796c8dcSSimon Schubert 
14185796c8dcSSimon Schubert /* Does the target have registers?  (Exec files don't.)  */
14195796c8dcSSimon Schubert 
14205796c8dcSSimon Schubert extern int target_has_registers_1 (void);
14215796c8dcSSimon Schubert #define target_has_registers target_has_registers_1 ()
14225796c8dcSSimon Schubert 
14235796c8dcSSimon Schubert /* Does the target have execution?  Can we make it jump (through
14245796c8dcSSimon Schubert    hoops), or pop its stack a few times?  This means that the current
14255796c8dcSSimon Schubert    target is currently executing; for some targets, that's the same as
14265796c8dcSSimon Schubert    whether or not the target is capable of execution, but there are
14275796c8dcSSimon Schubert    also targets which can be current while not executing.  In that
14285796c8dcSSimon Schubert    case this will become true after target_create_inferior or
14295796c8dcSSimon Schubert    target_attach.  */
14305796c8dcSSimon Schubert 
1431c50c785cSJohn Marino extern int target_has_execution_1 (ptid_t);
1432c50c785cSJohn Marino 
1433c50c785cSJohn Marino /* Like target_has_execution_1, but always passes inferior_ptid.  */
1434c50c785cSJohn Marino 
1435c50c785cSJohn Marino extern int target_has_execution_current (void);
1436c50c785cSJohn Marino 
1437c50c785cSJohn Marino #define target_has_execution target_has_execution_current ()
14385796c8dcSSimon Schubert 
14395796c8dcSSimon Schubert /* Default implementations for process_stratum targets.  Return true
14405796c8dcSSimon Schubert    if there's a selected inferior, false otherwise.  */
14415796c8dcSSimon Schubert 
14425796c8dcSSimon Schubert extern int default_child_has_all_memory (struct target_ops *ops);
14435796c8dcSSimon Schubert extern int default_child_has_memory (struct target_ops *ops);
14445796c8dcSSimon Schubert extern int default_child_has_stack (struct target_ops *ops);
14455796c8dcSSimon Schubert extern int default_child_has_registers (struct target_ops *ops);
1446c50c785cSJohn Marino extern int default_child_has_execution (struct target_ops *ops,
1447c50c785cSJohn Marino 					ptid_t the_ptid);
14485796c8dcSSimon Schubert 
14495796c8dcSSimon Schubert /* Can the target support the debugger control of thread execution?
14505796c8dcSSimon Schubert    Can it lock the thread scheduler?  */
14515796c8dcSSimon Schubert 
14525796c8dcSSimon Schubert #define target_can_lock_scheduler \
14535796c8dcSSimon Schubert      (current_target.to_has_thread_control & tc_schedlock)
14545796c8dcSSimon Schubert 
14555796c8dcSSimon Schubert /* Should the target enable async mode if it is supported?  Temporary
14565796c8dcSSimon Schubert    cludge until async mode is a strict superset of sync mode.  */
14575796c8dcSSimon Schubert extern int target_async_permitted;
14585796c8dcSSimon Schubert 
14595796c8dcSSimon Schubert /* Can the target support asynchronous execution?  */
14605796c8dcSSimon Schubert #define target_can_async_p() (current_target.to_can_async_p ())
14615796c8dcSSimon Schubert 
14625796c8dcSSimon Schubert /* Is the target in asynchronous execution mode?  */
14635796c8dcSSimon Schubert #define target_is_async_p() (current_target.to_is_async_p ())
14645796c8dcSSimon Schubert 
14655796c8dcSSimon Schubert int target_supports_non_stop (void);
14665796c8dcSSimon Schubert 
14675796c8dcSSimon Schubert /* Put the target in async mode with the specified callback function.  */
14685796c8dcSSimon Schubert #define target_async(CALLBACK,CONTEXT) \
14695796c8dcSSimon Schubert      (current_target.to_async ((CALLBACK), (CONTEXT)))
14705796c8dcSSimon Schubert 
1471a45ae5f8SJohn Marino #define target_execution_direction() \
1472a45ae5f8SJohn Marino   (current_target.to_execution_direction ())
14735796c8dcSSimon Schubert 
14745796c8dcSSimon Schubert /* Converts a process id to a string.  Usually, the string just contains
14755796c8dcSSimon Schubert    `process xyz', but on some systems it may contain
14765796c8dcSSimon Schubert    `process xyz thread abc'.  */
14775796c8dcSSimon Schubert 
14785796c8dcSSimon Schubert extern char *target_pid_to_str (ptid_t ptid);
14795796c8dcSSimon Schubert 
14805796c8dcSSimon Schubert extern char *normal_pid_to_str (ptid_t ptid);
14815796c8dcSSimon Schubert 
14825796c8dcSSimon Schubert /* Return a short string describing extra information about PID,
14835796c8dcSSimon Schubert    e.g. "sleeping", "runnable", "running on LWP 3".  Null return value
14845796c8dcSSimon Schubert    is okay.  */
14855796c8dcSSimon Schubert 
14865796c8dcSSimon Schubert #define target_extra_thread_info(TP) \
14875796c8dcSSimon Schubert      (current_target.to_extra_thread_info (TP))
14885796c8dcSSimon Schubert 
1489c50c785cSJohn Marino /* Return the thread's name.  A NULL result means that the target
1490c50c785cSJohn Marino    could not determine this thread's name.  */
1491c50c785cSJohn Marino 
1492c50c785cSJohn Marino extern char *target_thread_name (struct thread_info *);
1493c50c785cSJohn Marino 
14945796c8dcSSimon Schubert /* Attempts to find the pathname of the executable file
14955796c8dcSSimon Schubert    that was run to create a specified process.
14965796c8dcSSimon Schubert 
14975796c8dcSSimon Schubert    The process PID must be stopped when this operation is used.
14985796c8dcSSimon Schubert 
14995796c8dcSSimon Schubert    If the executable file cannot be determined, NULL is returned.
15005796c8dcSSimon Schubert 
15015796c8dcSSimon Schubert    Else, a pointer to a character string containing the pathname
15025796c8dcSSimon Schubert    is returned.  This string should be copied into a buffer by
15035796c8dcSSimon Schubert    the client if the string will not be immediately used, or if
15045796c8dcSSimon Schubert    it must persist.  */
15055796c8dcSSimon Schubert 
15065796c8dcSSimon Schubert #define target_pid_to_exec_file(pid) \
15075796c8dcSSimon Schubert      (current_target.to_pid_to_exec_file) (pid)
15085796c8dcSSimon Schubert 
15095796c8dcSSimon Schubert /* See the to_thread_architecture description in struct target_ops.  */
15105796c8dcSSimon Schubert 
15115796c8dcSSimon Schubert #define target_thread_architecture(ptid) \
15125796c8dcSSimon Schubert      (current_target.to_thread_architecture (&current_target, ptid))
15135796c8dcSSimon Schubert 
15145796c8dcSSimon Schubert /*
15155796c8dcSSimon Schubert  * Iterator function for target memory regions.
15165796c8dcSSimon Schubert  * Calls a callback function once for each memory region 'mapped'
15175796c8dcSSimon Schubert  * in the child process.  Defined as a simple macro rather than
15185796c8dcSSimon Schubert  * as a function macro so that it can be tested for nullity.
15195796c8dcSSimon Schubert  */
15205796c8dcSSimon Schubert 
15215796c8dcSSimon Schubert #define target_find_memory_regions(FUNC, DATA) \
15225796c8dcSSimon Schubert      (current_target.to_find_memory_regions) (FUNC, DATA)
15235796c8dcSSimon Schubert 
15245796c8dcSSimon Schubert /*
15255796c8dcSSimon Schubert  * Compose corefile .note section.
15265796c8dcSSimon Schubert  */
15275796c8dcSSimon Schubert 
15285796c8dcSSimon Schubert #define target_make_corefile_notes(BFD, SIZE_P) \
15295796c8dcSSimon Schubert      (current_target.to_make_corefile_notes) (BFD, SIZE_P)
15305796c8dcSSimon Schubert 
1531cf7f2e2dSJohn Marino /* Bookmark interfaces.  */
1532cf7f2e2dSJohn Marino #define target_get_bookmark(ARGS, FROM_TTY) \
1533cf7f2e2dSJohn Marino      (current_target.to_get_bookmark) (ARGS, FROM_TTY)
1534cf7f2e2dSJohn Marino 
1535cf7f2e2dSJohn Marino #define target_goto_bookmark(ARG, FROM_TTY) \
1536cf7f2e2dSJohn Marino      (current_target.to_goto_bookmark) (ARG, FROM_TTY)
1537cf7f2e2dSJohn Marino 
15385796c8dcSSimon Schubert /* Hardware watchpoint interfaces.  */
15395796c8dcSSimon Schubert 
15405796c8dcSSimon Schubert /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
1541cf7f2e2dSJohn Marino    write).  Only the INFERIOR_PTID task is being queried.  */
15425796c8dcSSimon Schubert 
15435796c8dcSSimon Schubert #define target_stopped_by_watchpoint \
15445796c8dcSSimon Schubert    (*current_target.to_stopped_by_watchpoint)
15455796c8dcSSimon Schubert 
15465796c8dcSSimon Schubert /* Non-zero if we have steppable watchpoints  */
15475796c8dcSSimon Schubert 
15485796c8dcSSimon Schubert #define target_have_steppable_watchpoint \
15495796c8dcSSimon Schubert    (current_target.to_have_steppable_watchpoint)
15505796c8dcSSimon Schubert 
15515796c8dcSSimon Schubert /* Non-zero if we have continuable watchpoints  */
15525796c8dcSSimon Schubert 
15535796c8dcSSimon Schubert #define target_have_continuable_watchpoint \
15545796c8dcSSimon Schubert    (current_target.to_have_continuable_watchpoint)
15555796c8dcSSimon Schubert 
15565796c8dcSSimon Schubert /* Provide defaults for hardware watchpoint functions.  */
15575796c8dcSSimon Schubert 
15585796c8dcSSimon Schubert /* If the *_hw_beakpoint functions have not been defined
15595796c8dcSSimon Schubert    elsewhere use the definitions in the target vector.  */
15605796c8dcSSimon Schubert 
15615796c8dcSSimon Schubert /* Returns non-zero if we can set a hardware watchpoint of type TYPE.  TYPE is
15625796c8dcSSimon Schubert    one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or
15635796c8dcSSimon Schubert    bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
15645796c8dcSSimon Schubert    (including this one?).  OTHERTYPE is who knows what...  */
15655796c8dcSSimon Schubert 
15665796c8dcSSimon Schubert #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
15675796c8dcSSimon Schubert  (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
15685796c8dcSSimon Schubert 
1569c50c785cSJohn Marino /* Returns the number of debug registers needed to watch the given
1570c50c785cSJohn Marino    memory region, or zero if not supported.  */
1571c50c785cSJohn Marino 
15725796c8dcSSimon Schubert #define target_region_ok_for_hw_watchpoint(addr, len) \
15735796c8dcSSimon Schubert     (*current_target.to_region_ok_for_hw_watchpoint) (addr, len)
15745796c8dcSSimon Schubert 
15755796c8dcSSimon Schubert 
1576cf7f2e2dSJohn Marino /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
1577cf7f2e2dSJohn Marino    TYPE is 0 for write, 1 for read, and 2 for read/write accesses.
1578cf7f2e2dSJohn Marino    COND is the expression for its condition, or NULL if there's none.
1579cf7f2e2dSJohn Marino    Returns 0 for success, 1 if the watchpoint type is not supported,
1580cf7f2e2dSJohn Marino    -1 for failure.  */
15815796c8dcSSimon Schubert 
1582cf7f2e2dSJohn Marino #define	target_insert_watchpoint(addr, len, type, cond) \
1583cf7f2e2dSJohn Marino      (*current_target.to_insert_watchpoint) (addr, len, type, cond)
15845796c8dcSSimon Schubert 
1585cf7f2e2dSJohn Marino #define	target_remove_watchpoint(addr, len, type, cond) \
1586cf7f2e2dSJohn Marino      (*current_target.to_remove_watchpoint) (addr, len, type, cond)
15875796c8dcSSimon Schubert 
1588a45ae5f8SJohn Marino /* Insert a new masked watchpoint at ADDR using the mask MASK.
1589a45ae5f8SJohn Marino    RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
1590a45ae5f8SJohn Marino    or hw_access for an access watchpoint.  Returns 0 for success, 1 if
1591a45ae5f8SJohn Marino    masked watchpoints are not supported, -1 for failure.  */
1592a45ae5f8SJohn Marino 
1593a45ae5f8SJohn Marino extern int target_insert_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
1594a45ae5f8SJohn Marino 
1595a45ae5f8SJohn Marino /* Remove a masked watchpoint at ADDR with the mask MASK.
1596a45ae5f8SJohn Marino    RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
1597a45ae5f8SJohn Marino    or hw_access for an access watchpoint.  Returns 0 for success, non-zero
1598a45ae5f8SJohn Marino    for failure.  */
1599a45ae5f8SJohn Marino 
1600a45ae5f8SJohn Marino extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
1601a45ae5f8SJohn Marino 
16025796c8dcSSimon Schubert #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
16035796c8dcSSimon Schubert      (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt)
16045796c8dcSSimon Schubert 
16055796c8dcSSimon Schubert #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
16065796c8dcSSimon Schubert      (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt)
16075796c8dcSSimon Schubert 
1608c50c785cSJohn Marino /* Return number of debug registers needed for a ranged breakpoint,
1609c50c785cSJohn Marino    or -1 if ranged breakpoints are not supported.  */
1610c50c785cSJohn Marino 
1611c50c785cSJohn Marino extern int target_ranged_break_num_registers (void);
1612c50c785cSJohn Marino 
1613cf7f2e2dSJohn Marino /* Return non-zero if target knows the data address which triggered this
1614cf7f2e2dSJohn Marino    target_stopped_by_watchpoint, in such case place it to *ADDR_P.  Only the
1615cf7f2e2dSJohn Marino    INFERIOR_PTID task is being queried.  */
1616cf7f2e2dSJohn Marino #define target_stopped_data_address(target, addr_p) \
1617cf7f2e2dSJohn Marino     (*target.to_stopped_data_address) (target, addr_p)
16185796c8dcSSimon Schubert 
1619*ef5ccd6cSJohn Marino /* Return non-zero if ADDR is within the range of a watchpoint spanning
1620*ef5ccd6cSJohn Marino    LENGTH bytes beginning at START.  */
16215796c8dcSSimon Schubert #define target_watchpoint_addr_within_range(target, addr, start, length) \
16225796c8dcSSimon Schubert   (*target.to_watchpoint_addr_within_range) (target, addr, start, length)
16235796c8dcSSimon Schubert 
1624cf7f2e2dSJohn Marino /* Return non-zero if the target is capable of using hardware to evaluate
1625cf7f2e2dSJohn Marino    the condition expression.  In this case, if the condition is false when
1626cf7f2e2dSJohn Marino    the watched memory location changes, execution may continue without the
1627cf7f2e2dSJohn Marino    debugger being notified.
1628cf7f2e2dSJohn Marino 
1629cf7f2e2dSJohn Marino    Due to limitations in the hardware implementation, it may be capable of
1630cf7f2e2dSJohn Marino    avoiding triggering the watchpoint in some cases where the condition
1631cf7f2e2dSJohn Marino    expression is false, but may report some false positives as well.
1632cf7f2e2dSJohn Marino    For this reason, GDB will still evaluate the condition expression when
1633cf7f2e2dSJohn Marino    the watchpoint triggers.  */
1634cf7f2e2dSJohn Marino #define target_can_accel_watchpoint_condition(addr, len, type, cond) \
1635cf7f2e2dSJohn Marino   (*current_target.to_can_accel_watchpoint_condition) (addr, len, type, cond)
1636cf7f2e2dSJohn Marino 
1637a45ae5f8SJohn Marino /* Return number of debug registers needed for a masked watchpoint,
1638a45ae5f8SJohn Marino    -1 if masked watchpoints are not supported or -2 if the given address
1639a45ae5f8SJohn Marino    and mask combination cannot be used.  */
1640a45ae5f8SJohn Marino 
1641a45ae5f8SJohn Marino extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask);
1642a45ae5f8SJohn Marino 
16435796c8dcSSimon Schubert /* Target can execute in reverse?  */
16445796c8dcSSimon Schubert #define target_can_execute_reverse \
16455796c8dcSSimon Schubert      (current_target.to_can_execute_reverse ? \
16465796c8dcSSimon Schubert       current_target.to_can_execute_reverse () : 0)
16475796c8dcSSimon Schubert 
16485796c8dcSSimon Schubert extern const struct target_desc *target_read_description (struct target_ops *);
16495796c8dcSSimon Schubert 
16505796c8dcSSimon Schubert #define target_get_ada_task_ptid(lwp, tid) \
16515796c8dcSSimon Schubert      (*current_target.to_get_ada_task_ptid) (lwp,tid)
16525796c8dcSSimon Schubert 
16535796c8dcSSimon Schubert /* Utility implementation of searching memory.  */
16545796c8dcSSimon Schubert extern int simple_search_memory (struct target_ops* ops,
16555796c8dcSSimon Schubert                                  CORE_ADDR start_addr,
16565796c8dcSSimon Schubert                                  ULONGEST search_space_len,
16575796c8dcSSimon Schubert                                  const gdb_byte *pattern,
16585796c8dcSSimon Schubert                                  ULONGEST pattern_len,
16595796c8dcSSimon Schubert                                  CORE_ADDR *found_addrp);
16605796c8dcSSimon Schubert 
16615796c8dcSSimon Schubert /* Main entry point for searching memory.  */
16625796c8dcSSimon Schubert extern int target_search_memory (CORE_ADDR start_addr,
16635796c8dcSSimon Schubert                                  ULONGEST search_space_len,
16645796c8dcSSimon Schubert                                  const gdb_byte *pattern,
16655796c8dcSSimon Schubert                                  ULONGEST pattern_len,
16665796c8dcSSimon Schubert                                  CORE_ADDR *found_addrp);
16675796c8dcSSimon Schubert 
1668*ef5ccd6cSJohn Marino /* Target file operations.  */
1669*ef5ccd6cSJohn Marino 
1670*ef5ccd6cSJohn Marino /* Open FILENAME on the target, using FLAGS and MODE.  Return a
1671*ef5ccd6cSJohn Marino    target file descriptor, or -1 if an error occurs (and set
1672*ef5ccd6cSJohn Marino    *TARGET_ERRNO).  */
1673*ef5ccd6cSJohn Marino extern int target_fileio_open (const char *filename, int flags, int mode,
1674*ef5ccd6cSJohn Marino 			       int *target_errno);
1675*ef5ccd6cSJohn Marino 
1676*ef5ccd6cSJohn Marino /* Write up to LEN bytes from WRITE_BUF to FD on the target.
1677*ef5ccd6cSJohn Marino    Return the number of bytes written, or -1 if an error occurs
1678*ef5ccd6cSJohn Marino    (and set *TARGET_ERRNO).  */
1679*ef5ccd6cSJohn Marino extern int target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
1680*ef5ccd6cSJohn Marino 				 ULONGEST offset, int *target_errno);
1681*ef5ccd6cSJohn Marino 
1682*ef5ccd6cSJohn Marino /* Read up to LEN bytes FD on the target into READ_BUF.
1683*ef5ccd6cSJohn Marino    Return the number of bytes read, or -1 if an error occurs
1684*ef5ccd6cSJohn Marino    (and set *TARGET_ERRNO).  */
1685*ef5ccd6cSJohn Marino extern int target_fileio_pread (int fd, gdb_byte *read_buf, int len,
1686*ef5ccd6cSJohn Marino 				ULONGEST offset, int *target_errno);
1687*ef5ccd6cSJohn Marino 
1688*ef5ccd6cSJohn Marino /* Close FD on the target.  Return 0, or -1 if an error occurs
1689*ef5ccd6cSJohn Marino    (and set *TARGET_ERRNO).  */
1690*ef5ccd6cSJohn Marino extern int target_fileio_close (int fd, int *target_errno);
1691*ef5ccd6cSJohn Marino 
1692*ef5ccd6cSJohn Marino /* Unlink FILENAME on the target.  Return 0, or -1 if an error
1693*ef5ccd6cSJohn Marino    occurs (and set *TARGET_ERRNO).  */
1694*ef5ccd6cSJohn Marino extern int target_fileio_unlink (const char *filename, int *target_errno);
1695*ef5ccd6cSJohn Marino 
1696*ef5ccd6cSJohn Marino /* Read value of symbolic link FILENAME on the target.  Return a
1697*ef5ccd6cSJohn Marino    null-terminated string allocated via xmalloc, or NULL if an error
1698*ef5ccd6cSJohn Marino    occurs (and set *TARGET_ERRNO).  */
1699*ef5ccd6cSJohn Marino extern char *target_fileio_readlink (const char *filename, int *target_errno);
1700*ef5ccd6cSJohn Marino 
1701*ef5ccd6cSJohn Marino /* Read target file FILENAME.  The return value will be -1 if the transfer
1702*ef5ccd6cSJohn Marino    fails or is not supported; 0 if the object is empty; or the length
1703*ef5ccd6cSJohn Marino    of the object otherwise.  If a positive value is returned, a
1704*ef5ccd6cSJohn Marino    sufficiently large buffer will be allocated using xmalloc and
1705*ef5ccd6cSJohn Marino    returned in *BUF_P containing the contents of the object.
1706*ef5ccd6cSJohn Marino 
1707*ef5ccd6cSJohn Marino    This method should be used for objects sufficiently small to store
1708*ef5ccd6cSJohn Marino    in a single xmalloc'd buffer, when no fixed bound on the object's
1709*ef5ccd6cSJohn Marino    size is known in advance.  */
1710*ef5ccd6cSJohn Marino extern LONGEST target_fileio_read_alloc (const char *filename,
1711*ef5ccd6cSJohn Marino 					 gdb_byte **buf_p);
1712*ef5ccd6cSJohn Marino 
1713*ef5ccd6cSJohn Marino /* Read target file FILENAME.  The result is NUL-terminated and
1714*ef5ccd6cSJohn Marino    returned as a string, allocated using xmalloc.  If an error occurs
1715*ef5ccd6cSJohn Marino    or the transfer is unsupported, NULL is returned.  Empty objects
1716*ef5ccd6cSJohn Marino    are returned as allocated but empty strings.  A warning is issued
1717*ef5ccd6cSJohn Marino    if the result contains any embedded NUL bytes.  */
1718*ef5ccd6cSJohn Marino extern char *target_fileio_read_stralloc (const char *filename);
1719*ef5ccd6cSJohn Marino 
1720*ef5ccd6cSJohn Marino 
1721cf7f2e2dSJohn Marino /* Tracepoint-related operations.  */
1722cf7f2e2dSJohn Marino 
1723cf7f2e2dSJohn Marino #define target_trace_init() \
1724cf7f2e2dSJohn Marino   (*current_target.to_trace_init) ()
1725cf7f2e2dSJohn Marino 
1726cf7f2e2dSJohn Marino #define target_download_tracepoint(t) \
1727cf7f2e2dSJohn Marino   (*current_target.to_download_tracepoint) (t)
1728cf7f2e2dSJohn Marino 
1729a45ae5f8SJohn Marino #define target_can_download_tracepoint() \
1730a45ae5f8SJohn Marino   (*current_target.to_can_download_tracepoint) ()
1731a45ae5f8SJohn Marino 
1732cf7f2e2dSJohn Marino #define target_download_trace_state_variable(tsv) \
1733cf7f2e2dSJohn Marino   (*current_target.to_download_trace_state_variable) (tsv)
1734cf7f2e2dSJohn Marino 
1735a45ae5f8SJohn Marino #define target_enable_tracepoint(loc) \
1736a45ae5f8SJohn Marino   (*current_target.to_enable_tracepoint) (loc)
1737a45ae5f8SJohn Marino 
1738a45ae5f8SJohn Marino #define target_disable_tracepoint(loc) \
1739a45ae5f8SJohn Marino   (*current_target.to_disable_tracepoint) (loc)
1740a45ae5f8SJohn Marino 
1741cf7f2e2dSJohn Marino #define target_trace_start() \
1742cf7f2e2dSJohn Marino   (*current_target.to_trace_start) ()
1743cf7f2e2dSJohn Marino 
1744cf7f2e2dSJohn Marino #define target_trace_set_readonly_regions() \
1745cf7f2e2dSJohn Marino   (*current_target.to_trace_set_readonly_regions) ()
1746cf7f2e2dSJohn Marino 
1747cf7f2e2dSJohn Marino #define target_get_trace_status(ts) \
1748cf7f2e2dSJohn Marino   (*current_target.to_get_trace_status) (ts)
1749cf7f2e2dSJohn Marino 
1750a45ae5f8SJohn Marino #define target_get_tracepoint_status(tp,utp)		\
1751a45ae5f8SJohn Marino   (*current_target.to_get_tracepoint_status) (tp, utp)
1752a45ae5f8SJohn Marino 
1753cf7f2e2dSJohn Marino #define target_trace_stop() \
1754cf7f2e2dSJohn Marino   (*current_target.to_trace_stop) ()
1755cf7f2e2dSJohn Marino 
1756cf7f2e2dSJohn Marino #define target_trace_find(type,num,addr1,addr2,tpp) \
1757cf7f2e2dSJohn Marino   (*current_target.to_trace_find) ((type), (num), (addr1), (addr2), (tpp))
1758cf7f2e2dSJohn Marino 
1759cf7f2e2dSJohn Marino #define target_get_trace_state_variable_value(tsv,val) \
1760cf7f2e2dSJohn Marino   (*current_target.to_get_trace_state_variable_value) ((tsv), (val))
1761cf7f2e2dSJohn Marino 
1762cf7f2e2dSJohn Marino #define target_save_trace_data(filename) \
1763cf7f2e2dSJohn Marino   (*current_target.to_save_trace_data) (filename)
1764cf7f2e2dSJohn Marino 
1765cf7f2e2dSJohn Marino #define target_upload_tracepoints(utpp) \
1766cf7f2e2dSJohn Marino   (*current_target.to_upload_tracepoints) (utpp)
1767cf7f2e2dSJohn Marino 
1768cf7f2e2dSJohn Marino #define target_upload_trace_state_variables(utsvp) \
1769cf7f2e2dSJohn Marino   (*current_target.to_upload_trace_state_variables) (utsvp)
1770cf7f2e2dSJohn Marino 
1771cf7f2e2dSJohn Marino #define target_get_raw_trace_data(buf,offset,len) \
1772cf7f2e2dSJohn Marino   (*current_target.to_get_raw_trace_data) ((buf), (offset), (len))
1773cf7f2e2dSJohn Marino 
1774a45ae5f8SJohn Marino #define target_get_min_fast_tracepoint_insn_len() \
1775a45ae5f8SJohn Marino   (*current_target.to_get_min_fast_tracepoint_insn_len) ()
1776a45ae5f8SJohn Marino 
1777cf7f2e2dSJohn Marino #define target_set_disconnected_tracing(val) \
1778cf7f2e2dSJohn Marino   (*current_target.to_set_disconnected_tracing) (val)
1779cf7f2e2dSJohn Marino 
1780cf7f2e2dSJohn Marino #define	target_set_circular_trace_buffer(val)	\
1781cf7f2e2dSJohn Marino   (*current_target.to_set_circular_trace_buffer) (val)
1782cf7f2e2dSJohn Marino 
1783*ef5ccd6cSJohn Marino #define	target_set_trace_buffer_size(val)	\
1784*ef5ccd6cSJohn Marino   (*current_target.to_set_trace_buffer_size) (val)
1785*ef5ccd6cSJohn Marino 
1786a45ae5f8SJohn Marino #define	target_set_trace_notes(user,notes,stopnotes)		\
1787a45ae5f8SJohn Marino   (*current_target.to_set_trace_notes) ((user), (notes), (stopnotes))
1788a45ae5f8SJohn Marino 
1789cf7f2e2dSJohn Marino #define target_get_tib_address(ptid, addr) \
1790cf7f2e2dSJohn Marino   (*current_target.to_get_tib_address) ((ptid), (addr))
1791cf7f2e2dSJohn Marino 
1792cf7f2e2dSJohn Marino #define target_set_permissions() \
1793cf7f2e2dSJohn Marino   (*current_target.to_set_permissions) ()
1794cf7f2e2dSJohn Marino 
1795cf7f2e2dSJohn Marino #define target_static_tracepoint_marker_at(addr, marker) \
1796cf7f2e2dSJohn Marino   (*current_target.to_static_tracepoint_marker_at) (addr, marker)
1797cf7f2e2dSJohn Marino 
1798cf7f2e2dSJohn Marino #define target_static_tracepoint_markers_by_strid(marker_id) \
1799cf7f2e2dSJohn Marino   (*current_target.to_static_tracepoint_markers_by_strid) (marker_id)
1800cf7f2e2dSJohn Marino 
1801c50c785cSJohn Marino #define target_traceframe_info() \
1802c50c785cSJohn Marino   (*current_target.to_traceframe_info) ()
1803c50c785cSJohn Marino 
1804*ef5ccd6cSJohn Marino #define target_use_agent(use) \
1805*ef5ccd6cSJohn Marino   (*current_target.to_use_agent) (use)
1806*ef5ccd6cSJohn Marino 
1807*ef5ccd6cSJohn Marino #define target_can_use_agent() \
1808*ef5ccd6cSJohn Marino   (*current_target.to_can_use_agent) ()
1809*ef5ccd6cSJohn Marino 
18105796c8dcSSimon Schubert /* Command logging facility.  */
18115796c8dcSSimon Schubert 
18125796c8dcSSimon Schubert #define target_log_command(p)						\
18135796c8dcSSimon Schubert   do									\
18145796c8dcSSimon Schubert     if (current_target.to_log_command)					\
18155796c8dcSSimon Schubert       (*current_target.to_log_command) (p);				\
18165796c8dcSSimon Schubert   while (0)
18175796c8dcSSimon Schubert 
1818cf7f2e2dSJohn Marino 
1819cf7f2e2dSJohn Marino extern int target_core_of_thread (ptid_t ptid);
1820cf7f2e2dSJohn Marino 
1821cf7f2e2dSJohn Marino /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range matches
1822cf7f2e2dSJohn Marino    the contents of [DATA,DATA+SIZE).  Returns 1 if there's a match, 0
1823cf7f2e2dSJohn Marino    if there's a mismatch, and -1 if an error is encountered while
1824cf7f2e2dSJohn Marino    reading memory.  Throws an error if the functionality is found not
1825cf7f2e2dSJohn Marino    to be supported by the current target.  */
1826cf7f2e2dSJohn Marino int target_verify_memory (const gdb_byte *data,
1827cf7f2e2dSJohn Marino 			  CORE_ADDR memaddr, ULONGEST size);
1828cf7f2e2dSJohn Marino 
18295796c8dcSSimon Schubert /* Routines for maintenance of the target structures...
18305796c8dcSSimon Schubert 
18315796c8dcSSimon Schubert    add_target:   Add a target to the list of all possible targets.
18325796c8dcSSimon Schubert 
18335796c8dcSSimon Schubert    push_target:  Make this target the top of the stack of currently used
18345796c8dcSSimon Schubert    targets, within its particular stratum of the stack.  Result
18355796c8dcSSimon Schubert    is 0 if now atop the stack, nonzero if not on top (maybe
18365796c8dcSSimon Schubert    should warn user).
18375796c8dcSSimon Schubert 
18385796c8dcSSimon Schubert    unpush_target: Remove this from the stack of currently used targets,
18395796c8dcSSimon Schubert    no matter where it is on the list.  Returns 0 if no
18405796c8dcSSimon Schubert    change, 1 if removed from stack.
18415796c8dcSSimon Schubert 
18425796c8dcSSimon Schubert    pop_target:   Remove the top thing on the stack of current targets.  */
18435796c8dcSSimon Schubert 
18445796c8dcSSimon Schubert extern void add_target (struct target_ops *);
18455796c8dcSSimon Schubert 
1846*ef5ccd6cSJohn Marino /* Adds a command ALIAS for target T and marks it deprecated.  This is useful
1847*ef5ccd6cSJohn Marino    for maintaining backwards compatibility when renaming targets.  */
1848*ef5ccd6cSJohn Marino 
1849*ef5ccd6cSJohn Marino extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
1850*ef5ccd6cSJohn Marino 
1851cf7f2e2dSJohn Marino extern void push_target (struct target_ops *);
18525796c8dcSSimon Schubert 
18535796c8dcSSimon Schubert extern int unpush_target (struct target_ops *);
18545796c8dcSSimon Schubert 
18555796c8dcSSimon Schubert extern void target_pre_inferior (int);
18565796c8dcSSimon Schubert 
18575796c8dcSSimon Schubert extern void target_preopen (int);
18585796c8dcSSimon Schubert 
18595796c8dcSSimon Schubert extern void pop_target (void);
18605796c8dcSSimon Schubert 
18615796c8dcSSimon Schubert /* Does whatever cleanup is required to get rid of all pushed targets.
18625796c8dcSSimon Schubert    QUITTING is propagated to target_close; it indicates that GDB is
18635796c8dcSSimon Schubert    exiting and should not get hung on an error (otherwise it is
18645796c8dcSSimon Schubert    important to perform clean termination, even if it takes a
18655796c8dcSSimon Schubert    while).  */
18665796c8dcSSimon Schubert extern void pop_all_targets (int quitting);
18675796c8dcSSimon Schubert 
18685796c8dcSSimon Schubert /* Like pop_all_targets, but pops only targets whose stratum is
18695796c8dcSSimon Schubert    strictly above ABOVE_STRATUM.  */
18705796c8dcSSimon Schubert extern void pop_all_targets_above (enum strata above_stratum, int quitting);
18715796c8dcSSimon Schubert 
1872c50c785cSJohn Marino extern int target_is_pushed (struct target_ops *t);
1873c50c785cSJohn Marino 
18745796c8dcSSimon Schubert extern CORE_ADDR target_translate_tls_address (struct objfile *objfile,
18755796c8dcSSimon Schubert 					       CORE_ADDR offset);
18765796c8dcSSimon Schubert 
18775796c8dcSSimon Schubert /* Struct target_section maps address ranges to file sections.  It is
18785796c8dcSSimon Schubert    mostly used with BFD files, but can be used without (e.g. for handling
18795796c8dcSSimon Schubert    raw disks, or files not in formats handled by BFD).  */
18805796c8dcSSimon Schubert 
18815796c8dcSSimon Schubert struct target_section
18825796c8dcSSimon Schubert   {
18835796c8dcSSimon Schubert     CORE_ADDR addr;		/* Lowest address in section */
18845796c8dcSSimon Schubert     CORE_ADDR endaddr;		/* 1+highest address in section */
18855796c8dcSSimon Schubert 
18865796c8dcSSimon Schubert     struct bfd_section *the_bfd_section;
18875796c8dcSSimon Schubert 
1888*ef5ccd6cSJohn Marino     /* A given BFD may appear multiple times in the target section
1889*ef5ccd6cSJohn Marino        list, so each BFD is associated with a given key.  The key is
1890*ef5ccd6cSJohn Marino        just some convenient pointer that can be used to differentiate
1891*ef5ccd6cSJohn Marino        the BFDs.  These are managed only by convention.  */
1892*ef5ccd6cSJohn Marino     void *key;
1893*ef5ccd6cSJohn Marino 
18945796c8dcSSimon Schubert     bfd *bfd;			/* BFD file pointer */
18955796c8dcSSimon Schubert   };
18965796c8dcSSimon Schubert 
18975796c8dcSSimon Schubert /* Holds an array of target sections.  Defined by [SECTIONS..SECTIONS_END[.  */
18985796c8dcSSimon Schubert 
18995796c8dcSSimon Schubert struct target_section_table
19005796c8dcSSimon Schubert {
19015796c8dcSSimon Schubert   struct target_section *sections;
19025796c8dcSSimon Schubert   struct target_section *sections_end;
19035796c8dcSSimon Schubert };
19045796c8dcSSimon Schubert 
19055796c8dcSSimon Schubert /* Return the "section" containing the specified address.  */
19065796c8dcSSimon Schubert struct target_section *target_section_by_addr (struct target_ops *target,
19075796c8dcSSimon Schubert 					       CORE_ADDR addr);
19085796c8dcSSimon Schubert 
19095796c8dcSSimon Schubert /* Return the target section table this target (or the targets
19105796c8dcSSimon Schubert    beneath) currently manipulate.  */
19115796c8dcSSimon Schubert 
19125796c8dcSSimon Schubert extern struct target_section_table *target_get_section_table
19135796c8dcSSimon Schubert   (struct target_ops *target);
19145796c8dcSSimon Schubert 
19155796c8dcSSimon Schubert /* From mem-break.c */
19165796c8dcSSimon Schubert 
1917c50c785cSJohn Marino extern int memory_remove_breakpoint (struct gdbarch *,
1918c50c785cSJohn Marino 				     struct bp_target_info *);
19195796c8dcSSimon Schubert 
1920c50c785cSJohn Marino extern int memory_insert_breakpoint (struct gdbarch *,
1921c50c785cSJohn Marino 				     struct bp_target_info *);
19225796c8dcSSimon Schubert 
1923c50c785cSJohn Marino extern int default_memory_remove_breakpoint (struct gdbarch *,
1924c50c785cSJohn Marino 					     struct bp_target_info *);
19255796c8dcSSimon Schubert 
1926c50c785cSJohn Marino extern int default_memory_insert_breakpoint (struct gdbarch *,
1927c50c785cSJohn Marino 					     struct bp_target_info *);
19285796c8dcSSimon Schubert 
19295796c8dcSSimon Schubert 
19305796c8dcSSimon Schubert /* From target.c */
19315796c8dcSSimon Schubert 
19325796c8dcSSimon Schubert extern void initialize_targets (void);
19335796c8dcSSimon Schubert 
1934cf7f2e2dSJohn Marino extern void noprocess (void) ATTRIBUTE_NORETURN;
19355796c8dcSSimon Schubert 
19365796c8dcSSimon Schubert extern void target_require_runnable (void);
19375796c8dcSSimon Schubert 
19385796c8dcSSimon Schubert extern void find_default_attach (struct target_ops *, char *, int);
19395796c8dcSSimon Schubert 
19405796c8dcSSimon Schubert extern void find_default_create_inferior (struct target_ops *,
19415796c8dcSSimon Schubert 					  char *, char *, char **, int);
19425796c8dcSSimon Schubert 
19435796c8dcSSimon Schubert extern struct target_ops *find_run_target (void);
19445796c8dcSSimon Schubert 
19455796c8dcSSimon Schubert extern struct target_ops *find_target_beneath (struct target_ops *);
19465796c8dcSSimon Schubert 
19475796c8dcSSimon Schubert /* Read OS data object of type TYPE from the target, and return it in
19485796c8dcSSimon Schubert    XML format.  The result is NUL-terminated and returned as a string,
19495796c8dcSSimon Schubert    allocated using xmalloc.  If an error occurs or the transfer is
19505796c8dcSSimon Schubert    unsupported, NULL is returned.  Empty objects are returned as
19515796c8dcSSimon Schubert    allocated but empty strings.  */
19525796c8dcSSimon Schubert 
19535796c8dcSSimon Schubert extern char *target_get_osdata (const char *type);
19545796c8dcSSimon Schubert 
19555796c8dcSSimon Schubert 
19565796c8dcSSimon Schubert /* Stuff that should be shared among the various remote targets.  */
19575796c8dcSSimon Schubert 
19585796c8dcSSimon Schubert /* Debugging level.  0 is off, and non-zero values mean to print some debug
19595796c8dcSSimon Schubert    information (higher values, more information).  */
19605796c8dcSSimon Schubert extern int remote_debug;
19615796c8dcSSimon Schubert 
19625796c8dcSSimon Schubert /* Speed in bits per second, or -1 which means don't mess with the speed.  */
19635796c8dcSSimon Schubert extern int baud_rate;
19645796c8dcSSimon Schubert /* Timeout limit for response from target.  */
19655796c8dcSSimon Schubert extern int remote_timeout;
19665796c8dcSSimon Schubert 
19675796c8dcSSimon Schubert 
19685796c8dcSSimon Schubert 
19695796c8dcSSimon Schubert /* Set the show memory breakpoints mode to show, and installs a cleanup
19705796c8dcSSimon Schubert    to restore it back to the current value.  */
19715796c8dcSSimon Schubert extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);
19725796c8dcSSimon Schubert 
1973cf7f2e2dSJohn Marino extern int may_write_registers;
1974cf7f2e2dSJohn Marino extern int may_write_memory;
1975cf7f2e2dSJohn Marino extern int may_insert_breakpoints;
1976cf7f2e2dSJohn Marino extern int may_insert_tracepoints;
1977cf7f2e2dSJohn Marino extern int may_insert_fast_tracepoints;
1978cf7f2e2dSJohn Marino extern int may_stop;
1979cf7f2e2dSJohn Marino 
1980cf7f2e2dSJohn Marino extern void update_target_permissions (void);
1981cf7f2e2dSJohn Marino 
19825796c8dcSSimon Schubert 
1983c50c785cSJohn Marino /* Imported from machine dependent code.  */
19845796c8dcSSimon Schubert 
19855796c8dcSSimon Schubert /* Blank target vector entries are initialized to target_ignore.  */
19865796c8dcSSimon Schubert void target_ignore (void);
19875796c8dcSSimon Schubert 
1988*ef5ccd6cSJohn Marino /* See to_supports_btrace in struct target_ops.  */
1989*ef5ccd6cSJohn Marino extern int target_supports_btrace (void);
1990*ef5ccd6cSJohn Marino 
1991*ef5ccd6cSJohn Marino /* See to_enable_btrace in struct target_ops.  */
1992*ef5ccd6cSJohn Marino extern struct btrace_target_info *target_enable_btrace (ptid_t ptid);
1993*ef5ccd6cSJohn Marino 
1994*ef5ccd6cSJohn Marino /* See to_disable_btrace in struct target_ops.  */
1995*ef5ccd6cSJohn Marino extern void target_disable_btrace (struct btrace_target_info *btinfo);
1996*ef5ccd6cSJohn Marino 
1997*ef5ccd6cSJohn Marino /* See to_teardown_btrace in struct target_ops.  */
1998*ef5ccd6cSJohn Marino extern void target_teardown_btrace (struct btrace_target_info *btinfo);
1999*ef5ccd6cSJohn Marino 
2000*ef5ccd6cSJohn Marino /* See to_read_btrace in struct target_ops.  */
2001*ef5ccd6cSJohn Marino extern VEC (btrace_block_s) *target_read_btrace (struct btrace_target_info *,
2002*ef5ccd6cSJohn Marino 						 enum btrace_read_type);
2003*ef5ccd6cSJohn Marino 
2004*ef5ccd6cSJohn Marino /* See to_stop_recording in struct target_ops.  */
2005*ef5ccd6cSJohn Marino extern void target_stop_recording (void);
2006*ef5ccd6cSJohn Marino 
2007*ef5ccd6cSJohn Marino /* See to_info_record in struct target_ops.  */
2008*ef5ccd6cSJohn Marino extern void target_info_record (void);
2009*ef5ccd6cSJohn Marino 
2010*ef5ccd6cSJohn Marino /* See to_save_record in struct target_ops.  */
2011*ef5ccd6cSJohn Marino extern void target_save_record (char *filename);
2012*ef5ccd6cSJohn Marino 
2013*ef5ccd6cSJohn Marino /* Query if the target supports deleting the execution log.  */
2014*ef5ccd6cSJohn Marino extern int target_supports_delete_record (void);
2015*ef5ccd6cSJohn Marino 
2016*ef5ccd6cSJohn Marino /* See to_delete_record in struct target_ops.  */
2017*ef5ccd6cSJohn Marino extern void target_delete_record (void);
2018*ef5ccd6cSJohn Marino 
2019*ef5ccd6cSJohn Marino /* See to_record_is_replaying in struct target_ops.  */
2020*ef5ccd6cSJohn Marino extern int target_record_is_replaying (void);
2021*ef5ccd6cSJohn Marino 
2022*ef5ccd6cSJohn Marino /* See to_goto_record_begin in struct target_ops.  */
2023*ef5ccd6cSJohn Marino extern void target_goto_record_begin (void);
2024*ef5ccd6cSJohn Marino 
2025*ef5ccd6cSJohn Marino /* See to_goto_record_end in struct target_ops.  */
2026*ef5ccd6cSJohn Marino extern void target_goto_record_end (void);
2027*ef5ccd6cSJohn Marino 
2028*ef5ccd6cSJohn Marino /* See to_goto_record in struct target_ops.  */
2029*ef5ccd6cSJohn Marino extern void target_goto_record (ULONGEST insn);
2030*ef5ccd6cSJohn Marino 
2031*ef5ccd6cSJohn Marino /* See to_insn_history.  */
2032*ef5ccd6cSJohn Marino extern void target_insn_history (int size, int flags);
2033*ef5ccd6cSJohn Marino 
2034*ef5ccd6cSJohn Marino /* See to_insn_history_from.  */
2035*ef5ccd6cSJohn Marino extern void target_insn_history_from (ULONGEST from, int size, int flags);
2036*ef5ccd6cSJohn Marino 
2037*ef5ccd6cSJohn Marino /* See to_insn_history_range.  */
2038*ef5ccd6cSJohn Marino extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags);
2039*ef5ccd6cSJohn Marino 
2040*ef5ccd6cSJohn Marino /* See to_call_history.  */
2041*ef5ccd6cSJohn Marino extern void target_call_history (int size, int flags);
2042*ef5ccd6cSJohn Marino 
2043*ef5ccd6cSJohn Marino /* See to_call_history_from.  */
2044*ef5ccd6cSJohn Marino extern void target_call_history_from (ULONGEST begin, int size, int flags);
2045*ef5ccd6cSJohn Marino 
2046*ef5ccd6cSJohn Marino /* See to_call_history_range.  */
2047*ef5ccd6cSJohn Marino extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags);
2048*ef5ccd6cSJohn Marino 
20495796c8dcSSimon Schubert #endif /* !defined (TARGET_H) */
2050