gdb/target.h - gdb

Global variables defined

Data types defined

Macros defined

Source code

  1. /* Interface between GDB and target environments, including files and processes

  2.    Copyright (C) 1990-2015 Free Software Foundation, Inc.

  3.    Contributed by Cygnus Support.  Written by John Gilmore.

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #if !defined (TARGET_H)
  16. #define TARGET_H

  17. struct objfile;
  18. struct ui_file;
  19. struct mem_attrib;
  20. struct target_ops;
  21. struct bp_location;
  22. struct bp_target_info;
  23. struct regcache;
  24. struct target_section_table;
  25. struct trace_state_variable;
  26. struct trace_status;
  27. struct uploaded_tsv;
  28. struct uploaded_tp;
  29. struct static_tracepoint_marker;
  30. struct traceframe_info;
  31. struct expression;
  32. struct dcache_struct;

  33. /* This include file defines the interface between the main part
  34.    of the debugger, and the part which is target-specific, or
  35.    specific to the communications interface between us and the
  36.    target.

  37.    A TARGET is an interface between the debugger and a particular
  38.    kind of file or process.  Targets can be STACKED in STRATA,
  39.    so that more than one target can potentially respond to a request.
  40.    In particular, memory accesses will walk down the stack of targets
  41.    until they find a target that is interested in handling that particular
  42.    address.  STRATA are artificial boundaries on the stack, within
  43.    which particular kinds of targets live.  Strata exist so that
  44.    people don't get confused by pushing e.g. a process target and then
  45.    a file target, and wondering why they can't see the current values
  46.    of variables any more (the file target is handling them and they
  47.    never get to the process target).  So when you push a file target,
  48.    it goes into the file stratum, which is always below the process
  49.    stratum.  */

  50. #include "target/target.h"
  51. #include "target/resume.h"
  52. #include "target/wait.h"
  53. #include "target/waitstatus.h"
  54. #include "bfd.h"
  55. #include "symtab.h"
  56. #include "memattr.h"
  57. #include "vec.h"
  58. #include "gdb_signals.h"
  59. #include "btrace.h"
  60. #include "command.h"

  61. enum strata
  62.   {
  63.     dummy_stratum,                /* The lowest of the low */
  64.     file_stratum,                /* Executable files, etc */
  65.     process_stratum,                /* Executing processes or core dump files */
  66.     thread_stratum,                /* Executing threads */
  67.     record_stratum,                /* Support record debugging */
  68.     arch_stratum                /* Architecture overrides */
  69.   };

  70. enum thread_control_capabilities
  71.   {
  72.     tc_none = 0,                /* Default: can't control thread execution.  */
  73.     tc_schedlock = 1,                /* Can lock the thread scheduler.  */
  74.   };

  75. /* The structure below stores information about a system call.
  76.    It is basically used in the "catch syscall" command, and in
  77.    every function that gives information about a system call.

  78.    It's also good to mention that its fields represent everything
  79.    that we currently know about a syscall in GDB.  */
  80. struct syscall
  81.   {
  82.     /* The syscall number.  */
  83.     int number;

  84.     /* The syscall name.  */
  85.     const char *name;
  86.   };

  87. /* Return a pretty printed form of target_waitstatus.
  88.    Space for the result is malloc'd, caller must free.  */
  89. extern char *target_waitstatus_to_string (const struct target_waitstatus *);

  90. /* Return a pretty printed form of TARGET_OPTIONS.
  91.    Space for the result is malloc'd, caller must free.  */
  92. extern char *target_options_to_string (int target_options);

  93. /* Possible types of events that the inferior handler will have to
  94.    deal with.  */
  95. enum inferior_event_type
  96.   {
  97.     /* Process a normal inferior event which will result in target_wait
  98.        being called.  */
  99.     INF_REG_EVENT,
  100.     /* We are called because a timer went off.  */
  101.     INF_TIMER,
  102.     /* We are called to do stuff after the inferior stops.  */
  103.     INF_EXEC_COMPLETE,
  104.     /* We are called to do some stuff after the inferior stops, but we
  105.        are expected to reenter the proceed() and
  106.        handle_inferior_event() functions.  This is used only in case of
  107.        'step n' like commands.  */
  108.     INF_EXEC_CONTINUE
  109.   };

  110. /* Target objects which can be transfered using target_read,
  111.    target_write, et cetera.  */

  112. enum target_object
  113. {
  114.   /* AVR target specific transfer.  See "avr-tdep.c" and "remote.c".  */
  115.   TARGET_OBJECT_AVR,
  116.   /* SPU target specific transfer.  See "spu-tdep.c".  */
  117.   TARGET_OBJECT_SPU,
  118.   /* Transfer up-to LEN bytes of memory starting at OFFSET.  */
  119.   TARGET_OBJECT_MEMORY,
  120.   /* Memory, avoiding GDB's data cache and trusting the executable.
  121.      Target implementations of to_xfer_partial never need to handle
  122.      this object, and most callers should not use it.  */
  123.   TARGET_OBJECT_RAW_MEMORY,
  124.   /* Memory known to be part of the target's stack.  This is cached even
  125.      if it is not in a region marked as such, since it is known to be
  126.      "normal" RAM.  */
  127.   TARGET_OBJECT_STACK_MEMORY,
  128.   /* Memory known to be part of the target code.   This is cached even
  129.      if it is not in a region marked as such.  */
  130.   TARGET_OBJECT_CODE_MEMORY,
  131.   /* Kernel Unwind Table.  See "ia64-tdep.c".  */
  132.   TARGET_OBJECT_UNWIND_TABLE,
  133.   /* Transfer auxilliary vector.  */
  134.   TARGET_OBJECT_AUXV,
  135.   /* StackGhost cookie.  See "sparc-tdep.c".  */
  136.   TARGET_OBJECT_WCOOKIE,
  137.   /* Target memory map in XML format.  */
  138.   TARGET_OBJECT_MEMORY_MAP,
  139.   /* Flash memory.  This object can be used to write contents to
  140.      a previously erased flash memory.  Using it without erasing
  141.      flash can have unexpected results.  Addresses are physical
  142.      address on target, and not relative to flash start.  */
  143.   TARGET_OBJECT_FLASH,
  144.   /* Available target-specific features, e.g. registers and coprocessors.
  145.      See "target-descriptions.c".  ANNEX should never be empty.  */
  146.   TARGET_OBJECT_AVAILABLE_FEATURES,
  147.   /* Currently loaded libraries, in XML format.  */
  148.   TARGET_OBJECT_LIBRARIES,
  149.   /* Currently loaded libraries specific for SVR4 systems, in XML format.  */
  150.   TARGET_OBJECT_LIBRARIES_SVR4,
  151.   /* Currently loaded libraries specific to AIX systems, in XML format.  */
  152.   TARGET_OBJECT_LIBRARIES_AIX,
  153.   /* Get OS specific data.  The ANNEX specifies the type (running
  154.      processes, etc.).  The data being transfered is expected to follow
  155.      the DTD specified in features/osdata.dtd.  */
  156.   TARGET_OBJECT_OSDATA,
  157.   /* Extra signal info.  Usually the contents of `siginfo_t' on unix
  158.      platforms.  */
  159.   TARGET_OBJECT_SIGNAL_INFO,
  160.   /* The list of threads that are being debugged.  */
  161.   TARGET_OBJECT_THREADS,
  162.   /* Collected static trace data.  */
  163.   TARGET_OBJECT_STATIC_TRACE_DATA,
  164.   /* The HP-UX registers (those that can be obtained or modified by using
  165.      the TT_LWP_RUREGS/TT_LWP_WUREGS ttrace requests).  */
  166.   TARGET_OBJECT_HPUX_UREGS,
  167.   /* The HP-UX shared library linkage pointer.  ANNEX should be a string
  168.      image of the code address whose linkage pointer we are looking for.

  169.      The size of the data transfered is always 8 bytes (the size of an
  170.      address on ia64).  */
  171.   TARGET_OBJECT_HPUX_SOLIB_GOT,
  172.   /* Traceframe info, in XML format.  */
  173.   TARGET_OBJECT_TRACEFRAME_INFO,
  174.   /* Load maps for FDPIC systems.  */
  175.   TARGET_OBJECT_FDPIC,
  176.   /* Darwin dynamic linker info data.  */
  177.   TARGET_OBJECT_DARWIN_DYLD_INFO,
  178.   /* OpenVMS Unwind Information Block.  */
  179.   TARGET_OBJECT_OPENVMS_UIB,
  180.   /* Branch trace data, in XML format.  */
  181.   TARGET_OBJECT_BTRACE
  182.   /* Possible future objects: TARGET_OBJECT_FILE, ...  */
  183. };

  184. /* Possible values returned by target_xfer_partial, etc.  */

  185. enum target_xfer_status
  186. {
  187.   /* Some bytes are transferred.  */
  188.   TARGET_XFER_OK = 1,

  189.   /* No further transfer is possible.  */
  190.   TARGET_XFER_EOF = 0,

  191.   /* The piece of the object requested is unavailable.  */
  192.   TARGET_XFER_UNAVAILABLE = 2,

  193.   /* Generic I/O error.  Note that it's important that this is '-1',
  194.      as we still have target_xfer-related code returning hardcoded
  195.      '-1' on error.  */
  196.   TARGET_XFER_E_IO = -1,

  197.   /* Keep list in sync with target_xfer_status_to_string.  */
  198. };

  199. /* Return the string form of STATUS.  */

  200. extern const char *
  201.   target_xfer_status_to_string (enum target_xfer_status status);

  202. /* Enumeration of the kinds of traceframe searches that a target may
  203.    be able to perform.  */

  204. enum trace_find_type
  205.   {
  206.     tfind_number,
  207.     tfind_pc,
  208.     tfind_tp,
  209.     tfind_range,
  210.     tfind_outside,
  211.   };

  212. typedef struct static_tracepoint_marker *static_tracepoint_marker_p;
  213. DEF_VEC_P(static_tracepoint_marker_p);

  214. typedef enum target_xfer_status
  215.   target_xfer_partial_ftype (struct target_ops *ops,
  216.                              enum target_object object,
  217.                              const char *annex,
  218.                              gdb_byte *readbuf,
  219.                              const gdb_byte *writebuf,
  220.                              ULONGEST offset,
  221.                              ULONGEST len,
  222.                              ULONGEST *xfered_len);

  223. /* Request that OPS transfer up to LEN 8-bit bytes of the target's
  224.    OBJECT.  The OFFSET, for a seekable object, specifies the
  225.    starting point.  The ANNEX can be used to provide additional
  226.    data-specific information to the target.

  227.    Return the number of bytes actually transfered, or a negative error
  228.    code (an 'enum target_xfer_error' value) if the transfer is not
  229.    supported or otherwise fails.  Return of a positive value less than
  230.    LEN indicates that no further transfer is possible.  Unlike the raw
  231.    to_xfer_partial interface, callers of these functions do not need
  232.    to retry partial transfers.  */

  233. extern LONGEST target_read (struct target_ops *ops,
  234.                             enum target_object object,
  235.                             const char *annex, gdb_byte *buf,
  236.                             ULONGEST offset, LONGEST len);

  237. struct memory_read_result
  238.   {
  239.     /* First address that was read.  */
  240.     ULONGEST begin;
  241.     /* Past-the-end address.  */
  242.     ULONGEST end;
  243.     /* The data.  */
  244.     gdb_byte *data;
  245. };
  246. typedef struct memory_read_result memory_read_result_s;
  247. DEF_VEC_O(memory_read_result_s);

  248. extern void free_memory_read_result_vector (void *);

  249. extern VEC(memory_read_result_s)* read_memory_robust (struct target_ops *ops,
  250.                                                       ULONGEST offset,
  251.                                                       LONGEST len);

  252. extern LONGEST target_write (struct target_ops *ops,
  253.                              enum target_object object,
  254.                              const char *annex, const gdb_byte *buf,
  255.                              ULONGEST offset, LONGEST len);

  256. /* Similar to target_write, except that it also calls PROGRESS with
  257.    the number of bytes written and the opaque BATON after every
  258.    successful partial write (and before the first write).  This is
  259.    useful for progress reporting and user interaction while writing
  260.    data.  To abort the transfer, the progress callback can throw an
  261.    exception.  */

  262. LONGEST target_write_with_progress (struct target_ops *ops,
  263.                                     enum target_object object,
  264.                                     const char *annex, const gdb_byte *buf,
  265.                                     ULONGEST offset, LONGEST len,
  266.                                     void (*progress) (ULONGEST, void *),
  267.                                     void *baton);

  268. /* Wrapper to perform a full read of unknown size.  OBJECT/ANNEX will
  269.    be read using OPS.  The return value will be -1 if the transfer
  270.    fails or is not supported; 0 if the object is empty; or the length
  271.    of the object otherwise.  If a positive value is returned, a
  272.    sufficiently large buffer will be allocated using xmalloc and
  273.    returned in *BUF_P containing the contents of the object.

  274.    This method should be used for objects sufficiently small to store
  275.    in a single xmalloc'd buffer, when no fixed bound on the object's
  276.    size is known in advance.  Don't try to read TARGET_OBJECT_MEMORY
  277.    through this function.  */

  278. extern LONGEST target_read_alloc (struct target_ops *ops,
  279.                                   enum target_object object,
  280.                                   const char *annex, gdb_byte **buf_p);

  281. /* Read OBJECT/ANNEX using OPS.  The result is NUL-terminated and
  282.    returned as a string, allocated using xmalloc.  If an error occurs
  283.    or the transfer is unsupported, NULL is returned.  Empty objects
  284.    are returned as allocated but empty strings.  A warning is issued
  285.    if the result contains any embedded NUL bytes.  */

  286. extern char *target_read_stralloc (struct target_ops *ops,
  287.                                    enum target_object object,
  288.                                    const char *annex);

  289. /* See target_ops->to_xfer_partial.  */
  290. extern target_xfer_partial_ftype target_xfer_partial;

  291. /* Wrappers to target read/write that perform memory transfers.  They
  292.    throw an error if the memory transfer fails.

  293.    NOTE: cagney/2003-10-23: The naming schema is lifted from
  294.    "frame.h".  The parameter order is lifted from get_frame_memory,
  295.    which in turn lifted it from read_memory.  */

  296. extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
  297.                                gdb_byte *buf, LONGEST len);
  298. extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
  299.                                             CORE_ADDR addr, int len,
  300.                                             enum bfd_endian byte_order);

  301. struct thread_info;                /* fwd decl for parameter list below: */

  302. /* The type of the callback to the to_async method.  */

  303. typedef void async_callback_ftype (enum inferior_event_type event_type,
  304.                                    void *context);

  305. /* Normally target debug printing is purely type-based.  However,
  306.    sometimes it is necessary to override the debug printing on a
  307.    per-argument basis.  This macro can be used, attribute-style, to
  308.    name the target debug printing function for a particular method
  309.    argument.  FUNC is the name of the function.  The macro's
  310.    definition is empty because it is only used by the
  311.    make-target-delegates script.  */

  312. #define TARGET_DEBUG_PRINTER(FUNC)

  313. /* These defines are used to mark target_ops methods.  The script
  314.    make-target-delegates scans these and auto-generates the base
  315.    method implementations.  There are four macros that can be used:

  316.    1. TARGET_DEFAULT_IGNORE.  There is no argument.  The base method
  317.    does nothing.  This is only valid if the method return type is
  318.    'void'.

  319.    2. TARGET_DEFAULT_NORETURN.  The argument is a function call, like
  320.    'tcomplain ()'.  The base method simply makes this call, which is
  321.    assumed not to return.

  322.    3. TARGET_DEFAULT_RETURN.  The argument is a C expression.  The
  323.    base method returns this expression's value.

  324.    4. TARGET_DEFAULT_FUNC.  The argument is the name of a function.
  325.    make-target-delegates does not generate a base method in this case,
  326.    but instead uses the argument function as the base method.  */

  327. #define TARGET_DEFAULT_IGNORE()
  328. #define TARGET_DEFAULT_NORETURN(ARG)
  329. #define TARGET_DEFAULT_RETURN(ARG)
  330. #define TARGET_DEFAULT_FUNC(ARG)

  331. struct target_ops
  332.   {
  333.     struct target_ops *beneath;        /* To the target under this one.  */
  334.     const char *to_shortname;        /* Name this target type */
  335.     const char *to_longname;        /* Name for printing */
  336.     const char *to_doc;                /* Documentation.  Does not include trailing
  337.                                    newline, and starts with a one-line descrip-
  338.                                    tion (probably similar to to_longname).  */
  339.     /* Per-target scratch pad.  */
  340.     void *to_data;
  341.     /* The open routine takes the rest of the parameters from the
  342.        command, and (if successful) pushes a new target onto the
  343.        stack.  Targets should supply this routine, if only to provide
  344.        an error message.  */
  345.     void (*to_open) (const char *, int);
  346.     /* Old targets with a static target vector provide "to_close".
  347.        New re-entrant targets provide "to_xclose" and that is expected
  348.        to xfree everything (including the "struct target_ops").  */
  349.     void (*to_xclose) (struct target_ops *targ);
  350.     void (*to_close) (struct target_ops *);
  351.     /* Attaches to a process on the target side.  Arguments are as
  352.        passed to the `attach' command by the user.  This routine can
  353.        be called when the target is not on the target-stack, if the
  354.        target_can_run routine returns 1; in that case, it must push
  355.        itself onto the stack.  Upon exit, the target should be ready
  356.        for normal operations, and should be ready to deliver the
  357.        status of the process immediately (without waiting) to an
  358.        upcoming target_wait call.  */
  359.     void (*to_attach) (struct target_ops *ops, const char *, int);
  360.     void (*to_post_attach) (struct target_ops *, int)
  361.       TARGET_DEFAULT_IGNORE ();
  362.     void (*to_detach) (struct target_ops *ops, const char *, int)
  363.       TARGET_DEFAULT_IGNORE ();
  364.     void (*to_disconnect) (struct target_ops *, const char *, int)
  365.       TARGET_DEFAULT_NORETURN (tcomplain ());
  366.     void (*to_resume) (struct target_ops *, ptid_t,
  367.                        int TARGET_DEBUG_PRINTER (target_debug_print_step),
  368.                        enum gdb_signal)
  369.       TARGET_DEFAULT_NORETURN (noprocess ());
  370.     ptid_t (*to_wait) (struct target_ops *,
  371.                        ptid_t, struct target_waitstatus *,
  372.                        int TARGET_DEBUG_PRINTER (target_debug_print_options))
  373.       TARGET_DEFAULT_NORETURN (noprocess ());
  374.     void (*to_fetch_registers) (struct target_ops *, struct regcache *, int)
  375.       TARGET_DEFAULT_IGNORE ();
  376.     void (*to_store_registers) (struct target_ops *, struct regcache *, int)
  377.       TARGET_DEFAULT_NORETURN (noprocess ());
  378.     void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
  379.       TARGET_DEFAULT_NORETURN (noprocess ());

  380.     void (*to_files_info) (struct target_ops *)
  381.       TARGET_DEFAULT_IGNORE ();
  382.     int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
  383.                                  struct bp_target_info *)
  384.       TARGET_DEFAULT_FUNC (memory_insert_breakpoint);
  385.     int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
  386.                                  struct bp_target_info *)
  387.       TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
  388.     int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int)
  389.       TARGET_DEFAULT_RETURN (0);
  390.     int (*to_ranged_break_num_registers) (struct target_ops *)
  391.       TARGET_DEFAULT_RETURN (-1);
  392.     int (*to_insert_hw_breakpoint) (struct target_ops *,
  393.                                     struct gdbarch *, struct bp_target_info *)
  394.       TARGET_DEFAULT_RETURN (-1);
  395.     int (*to_remove_hw_breakpoint) (struct target_ops *,
  396.                                     struct gdbarch *, struct bp_target_info *)
  397.       TARGET_DEFAULT_RETURN (-1);

  398.     /* Documentation of what the two routines below are expected to do is
  399.        provided with the corresponding target_* macros.  */
  400.     int (*to_remove_watchpoint) (struct target_ops *,
  401.                                  CORE_ADDR, int, int, struct expression *)
  402.       TARGET_DEFAULT_RETURN (-1);
  403.     int (*to_insert_watchpoint) (struct target_ops *,
  404.                                  CORE_ADDR, int, int, struct expression *)
  405.       TARGET_DEFAULT_RETURN (-1);

  406.     int (*to_insert_mask_watchpoint) (struct target_ops *,
  407.                                       CORE_ADDR, CORE_ADDR, int)
  408.       TARGET_DEFAULT_RETURN (1);
  409.     int (*to_remove_mask_watchpoint) (struct target_ops *,
  410.                                       CORE_ADDR, CORE_ADDR, int)
  411.       TARGET_DEFAULT_RETURN (1);
  412.     int (*to_stopped_by_watchpoint) (struct target_ops *)
  413.       TARGET_DEFAULT_RETURN (0);
  414.     int to_have_steppable_watchpoint;
  415.     int to_have_continuable_watchpoint;
  416.     int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
  417.       TARGET_DEFAULT_RETURN (0);
  418.     int (*to_watchpoint_addr_within_range) (struct target_ops *,
  419.                                             CORE_ADDR, CORE_ADDR, int)
  420.       TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);

  421.     /* Documentation of this routine is provided with the corresponding
  422.        target_* macro.  */
  423.     int (*to_region_ok_for_hw_watchpoint) (struct target_ops *,
  424.                                            CORE_ADDR, int)
  425.       TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);

  426.     int (*to_can_accel_watchpoint_condition) (struct target_ops *,
  427.                                               CORE_ADDR, int, int,
  428.                                               struct expression *)
  429.       TARGET_DEFAULT_RETURN (0);
  430.     int (*to_masked_watch_num_registers) (struct target_ops *,
  431.                                           CORE_ADDR, CORE_ADDR)
  432.       TARGET_DEFAULT_RETURN (-1);
  433.     void (*to_terminal_init) (struct target_ops *)
  434.       TARGET_DEFAULT_IGNORE ();
  435.     void (*to_terminal_inferior) (struct target_ops *)
  436.       TARGET_DEFAULT_IGNORE ();
  437.     void (*to_terminal_ours_for_output) (struct target_ops *)
  438.       TARGET_DEFAULT_IGNORE ();
  439.     void (*to_terminal_ours) (struct target_ops *)
  440.       TARGET_DEFAULT_IGNORE ();
  441.     void (*to_terminal_info) (struct target_ops *, const char *, int)
  442.       TARGET_DEFAULT_FUNC (default_terminal_info);
  443.     void (*to_kill) (struct target_ops *)
  444.       TARGET_DEFAULT_NORETURN (noprocess ());
  445.     void (*to_load) (struct target_ops *, const char *, int)
  446.       TARGET_DEFAULT_NORETURN (tcomplain ());
  447.     /* Start an inferior process and set inferior_ptid to its pid.
  448.        EXEC_FILE is the file to run.
  449.        ALLARGS is a string containing the arguments to the program.
  450.        ENV is the environment vector to pass.  Errors reported with error().
  451.        On VxWorks and various standalone systems, we ignore exec_file.  */
  452.     void (*to_create_inferior) (struct target_ops *,
  453.                                 char *, char *, char **, int);
  454.     void (*to_post_startup_inferior) (struct target_ops *, ptid_t)
  455.       TARGET_DEFAULT_IGNORE ();
  456.     int (*to_insert_fork_catchpoint) (struct target_ops *, int)
  457.       TARGET_DEFAULT_RETURN (1);
  458.     int (*to_remove_fork_catchpoint) (struct target_ops *, int)
  459.       TARGET_DEFAULT_RETURN (1);
  460.     int (*to_insert_vfork_catchpoint) (struct target_ops *, int)
  461.       TARGET_DEFAULT_RETURN (1);
  462.     int (*to_remove_vfork_catchpoint) (struct target_ops *, int)
  463.       TARGET_DEFAULT_RETURN (1);
  464.     int (*to_follow_fork) (struct target_ops *, int, int)
  465.       TARGET_DEFAULT_FUNC (default_follow_fork);
  466.     int (*to_insert_exec_catchpoint) (struct target_ops *, int)
  467.       TARGET_DEFAULT_RETURN (1);
  468.     int (*to_remove_exec_catchpoint) (struct target_ops *, int)
  469.       TARGET_DEFAULT_RETURN (1);
  470.     int (*to_set_syscall_catchpoint) (struct target_ops *,
  471.                                       int, int, int, int, int *)
  472.       TARGET_DEFAULT_RETURN (1);
  473.     int (*to_has_exited) (struct target_ops *, int, int, int *)
  474.       TARGET_DEFAULT_RETURN (0);
  475.     void (*to_mourn_inferior) (struct target_ops *)
  476.       TARGET_DEFAULT_FUNC (default_mourn_inferior);
  477.     /* Note that to_can_run is special and can be invoked on an
  478.        unpushed target.  Targets defining this method must also define
  479.        to_can_async_p and to_supports_non_stop.  */
  480.     int (*to_can_run) (struct target_ops *)
  481.       TARGET_DEFAULT_RETURN (0);

  482.     /* Documentation of this routine is provided with the corresponding
  483.        target_* macro.  */
  484.     void (*to_pass_signals) (struct target_ops *, int,
  485.                              unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
  486.       TARGET_DEFAULT_IGNORE ();

  487.     /* Documentation of this routine is provided with the
  488.        corresponding target_* function.  */
  489.     void (*to_program_signals) (struct target_ops *, int,
  490.                                 unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
  491.       TARGET_DEFAULT_IGNORE ();

  492.     int (*to_thread_alive) (struct target_ops *, ptid_t ptid)
  493.       TARGET_DEFAULT_RETURN (0);
  494.     void (*to_update_thread_list) (struct target_ops *)
  495.       TARGET_DEFAULT_IGNORE ();
  496.     char *(*to_pid_to_str) (struct target_ops *, ptid_t)
  497.       TARGET_DEFAULT_FUNC (default_pid_to_str);
  498.     char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
  499.       TARGET_DEFAULT_RETURN (NULL);
  500.     char *(*to_thread_name) (struct target_ops *, struct thread_info *)
  501.       TARGET_DEFAULT_RETURN (NULL);
  502.     void (*to_stop) (struct target_ops *, ptid_t)
  503.       TARGET_DEFAULT_IGNORE ();
  504.     void (*to_rcmd) (struct target_ops *,
  505.                      const char *command, struct ui_file *output)
  506.       TARGET_DEFAULT_FUNC (default_rcmd);
  507.     char *(*to_pid_to_exec_file) (struct target_ops *, int pid)
  508.       TARGET_DEFAULT_RETURN (NULL);
  509.     void (*to_log_command) (struct target_ops *, const char *)
  510.       TARGET_DEFAULT_IGNORE ();
  511.     struct target_section_table *(*to_get_section_table) (struct target_ops *)
  512.       TARGET_DEFAULT_RETURN (NULL);
  513.     enum strata to_stratum;
  514.     int (*to_has_all_memory) (struct target_ops *);
  515.     int (*to_has_memory) (struct target_ops *);
  516.     int (*to_has_stack) (struct target_ops *);
  517.     int (*to_has_registers) (struct target_ops *);
  518.     int (*to_has_execution) (struct target_ops *, ptid_t);
  519.     int to_has_thread_control;        /* control thread execution */
  520.     int to_attach_no_wait;
  521.     /* This method must be implemented in some situations.  See the
  522.        comment on 'to_can_run'.  */
  523.     int (*to_can_async_p) (struct target_ops *)
  524.       TARGET_DEFAULT_RETURN (0);
  525.     int (*to_is_async_p) (struct target_ops *)
  526.       TARGET_DEFAULT_RETURN (0);
  527.     void (*to_async) (struct target_ops *, async_callback_ftype *, void *)
  528.       TARGET_DEFAULT_NORETURN (tcomplain ());
  529.     /* This method must be implemented in some situations.  See the
  530.        comment on 'to_can_run'.  */
  531.     int (*to_supports_non_stop) (struct target_ops *)
  532.       TARGET_DEFAULT_RETURN (0);
  533.     /* find_memory_regions support method for gcore */
  534.     int (*to_find_memory_regions) (struct target_ops *,
  535.                                    find_memory_region_ftype func, void *data)
  536.       TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
  537.     /* make_corefile_notes support method for gcore */
  538.     char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
  539.       TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
  540.     /* get_bookmark support method for bookmarks */
  541.     gdb_byte * (*to_get_bookmark) (struct target_ops *, const char *, int)
  542.       TARGET_DEFAULT_NORETURN (tcomplain ());
  543.     /* goto_bookmark support method for bookmarks */
  544.     void (*to_goto_bookmark) (struct target_ops *, const gdb_byte *, int)
  545.       TARGET_DEFAULT_NORETURN (tcomplain ());
  546.     /* Return the thread-local address at OFFSET in the
  547.        thread-local storage for the thread PTID and the shared library
  548.        or executable file given by OBJFILE.  If that block of
  549.        thread-local storage hasn't been allocated yet, this function
  550.        may return an error.  LOAD_MODULE_ADDR may be zero for statically
  551.        linked multithreaded inferiors.  */
  552.     CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
  553.                                               ptid_t ptid,
  554.                                               CORE_ADDR load_module_addr,
  555.                                               CORE_ADDR offset)
  556.       TARGET_DEFAULT_NORETURN (generic_tls_error ());

  557.     /* Request that OPS transfer up to LEN 8-bit bytes of the target's
  558.        OBJECT.  The OFFSET, for a seekable object, specifies the
  559.        starting point.  The ANNEX can be used to provide additional
  560.        data-specific information to the target.

  561.        Return the transferred status, error or OK (an
  562.        'enum target_xfer_status' value).  Save the number of bytes
  563.        actually transferred in *XFERED_LEN if transfer is successful
  564.        (TARGET_XFER_OK) or the number unavailable bytes if the requested
  565.        data is unavailable (TARGET_XFER_UNAVAILABLE).  *XFERED_LEN
  566.        smaller than LEN does not indicate the end of the object, only
  567.        the end of the transfer; higher level code should continue
  568.        transferring if desired.  This is handled in target.c.

  569.        The interface does not support a "retry" mechanism.  Instead it
  570.        assumes that at least one byte will be transfered on each
  571.        successful call.

  572.        NOTE: cagney/2003-10-17: The current interface can lead to
  573.        fragmented transfers.  Lower target levels should not implement
  574.        hacks, such as enlarging the transfer, in an attempt to
  575.        compensate for this.  Instead, the target stack should be
  576.        extended so that it implements supply/collect methods and a
  577.        look-aside object cache.  With that available, the lowest
  578.        target can safely and freely "push" data up the stack.

  579.        See target_read and target_write for more information.  One,
  580.        and only one, of readbuf or writebuf must be non-NULL.  */

  581.     enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
  582.                                                 enum target_object object,
  583.                                                 const char *annex,
  584.                                                 gdb_byte *readbuf,
  585.                                                 const gdb_byte *writebuf,
  586.                                                 ULONGEST offset, ULONGEST len,
  587.                                                 ULONGEST *xfered_len)
  588.       TARGET_DEFAULT_RETURN (TARGET_XFER_E_IO);

  589.     /* Returns the memory map for the target.  A return value of NULL
  590.        means that no memory map is available.  If a memory address
  591.        does not fall within any returned regions, it's assumed to be
  592.        RAM.  The returned memory regions should not overlap.

  593.        The order of regions does not matter; target_memory_map will
  594.        sort regions by starting address.  For that reason, this
  595.        function should not be called directly except via
  596.        target_memory_map.

  597.        This method should not cache data; if the memory map could
  598.        change unexpectedly, it should be invalidated, and higher
  599.        layers will re-fetch it.  */
  600.     VEC(mem_region_s) *(*to_memory_map) (struct target_ops *)
  601.       TARGET_DEFAULT_RETURN (NULL);

  602.     /* Erases the region of flash memory starting at ADDRESS, of
  603.        length LENGTH.

  604.        Precondition: both ADDRESS and ADDRESS+LENGTH should be aligned
  605.        on flash block boundaries, as reported by 'to_memory_map'.  */
  606.     void (*to_flash_erase) (struct target_ops *,
  607.                            ULONGEST address, LONGEST length)
  608.       TARGET_DEFAULT_NORETURN (tcomplain ());

  609.     /* Finishes a flash memory write sequence.  After this operation
  610.        all flash memory should be available for writing and the result
  611.        of reading from areas written by 'to_flash_write' should be
  612.        equal to what was written.  */
  613.     void (*to_flash_done) (struct target_ops *)
  614.       TARGET_DEFAULT_NORETURN (tcomplain ());

  615.     /* Describe the architecture-specific features of this target.  If
  616.        OPS doesn't have a description, this should delegate to the
  617.        "beneath" target.  Returns the description found, or NULL if no
  618.        description was available.  */
  619.     const struct target_desc *(*to_read_description) (struct target_ops *ops)
  620.          TARGET_DEFAULT_RETURN (NULL);

  621.     /* Build the PTID of the thread on which a given task is running,
  622.        based on LWP and THREAD.  These values are extracted from the
  623.        task Private_Data section of the Ada Task Control Block, and
  624.        their interpretation depends on the target.  */
  625.     ptid_t (*to_get_ada_task_ptid) (struct target_ops *,
  626.                                     long lwp, long thread)
  627.       TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);

  628.     /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
  629.        Return 0 if *READPTR is already at the end of the buffer.
  630.        Return -1 if there is insufficient buffer for a whole entry.
  631.        Return 1 if an entry was read into *TYPEP and *VALP.  */
  632.     int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr,
  633.                          gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
  634.       TARGET_DEFAULT_FUNC (default_auxv_parse);

  635.     /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
  636.        sequence of bytes in PATTERN with length PATTERN_LEN.

  637.        The result is 1 if found, 0 if not found, and -1 if there was an error
  638.        requiring halting of the search (e.g. memory read error).
  639.        If the pattern is found the address is recorded in FOUND_ADDRP.  */
  640.     int (*to_search_memory) (struct target_ops *ops,
  641.                              CORE_ADDR start_addr, ULONGEST search_space_len,
  642.                              const gdb_byte *pattern, ULONGEST pattern_len,
  643.                              CORE_ADDR *found_addrp)
  644.       TARGET_DEFAULT_FUNC (default_search_memory);

  645.     /* Can target execute in reverse?  */
  646.     int (*to_can_execute_reverse) (struct target_ops *)
  647.       TARGET_DEFAULT_RETURN (0);

  648.     /* The direction the target is currently executing.  Must be
  649.        implemented on targets that support reverse execution and async
  650.        mode.  The default simply returns forward execution.  */
  651.     enum exec_direction_kind (*to_execution_direction) (struct target_ops *)
  652.       TARGET_DEFAULT_FUNC (default_execution_direction);

  653.     /* Does this target support debugging multiple processes
  654.        simultaneously?  */
  655.     int (*to_supports_multi_process) (struct target_ops *)
  656.       TARGET_DEFAULT_RETURN (0);

  657.     /* Does this target support enabling and disabling tracepoints while a trace
  658.        experiment is running?  */
  659.     int (*to_supports_enable_disable_tracepoint) (struct target_ops *)
  660.       TARGET_DEFAULT_RETURN (0);

  661.     /* Does this target support disabling address space randomization?  */
  662.     int (*to_supports_disable_randomization) (struct target_ops *);

  663.     /* Does this target support the tracenz bytecode for string collection?  */
  664.     int (*to_supports_string_tracing) (struct target_ops *)
  665.       TARGET_DEFAULT_RETURN (0);

  666.     /* Does this target support evaluation of breakpoint conditions on its
  667.        end?  */
  668.     int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *)
  669.       TARGET_DEFAULT_RETURN (0);

  670.     /* Does this target support evaluation of breakpoint commands on its
  671.        end?  */
  672.     int (*to_can_run_breakpoint_commands) (struct target_ops *)
  673.       TARGET_DEFAULT_RETURN (0);

  674.     /* Determine current architecture of thread PTID.

  675.        The target is supposed to determine the architecture of the code where
  676.        the target is currently stopped at (on Cell, if a target is in spu_run,
  677.        to_thread_architecture would return SPU, otherwise PPC32 or PPC64).
  678.        This is architecture used to perform decr_pc_after_break adjustment,
  679.        and also determines the frame architecture of the innermost frame.
  680.        ptrace operations need to operate according to target_gdbarch ().

  681.        The default implementation always returns target_gdbarch ().  */
  682.     struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t)
  683.       TARGET_DEFAULT_FUNC (default_thread_architecture);

  684.     /* Determine current address space of thread PTID.

  685.        The default implementation always returns the inferior's
  686.        address space.  */
  687.     struct address_space *(*to_thread_address_space) (struct target_ops *,
  688.                                                       ptid_t)
  689.       TARGET_DEFAULT_FUNC (default_thread_address_space);

  690.     /* Target file operations.  */

  691.     /* Open FILENAME on the target, using FLAGS and MODE.  Return a
  692.        target file descriptor, or -1 if an error occurs (and set
  693.        *TARGET_ERRNO).  */
  694.     int (*to_fileio_open) (struct target_ops *,
  695.                            const char *filename, int flags, int mode,
  696.                            int *target_errno);

  697.     /* Write up to LEN bytes from WRITE_BUF to FD on the target.
  698.        Return the number of bytes written, or -1 if an error occurs
  699.        (and set *TARGET_ERRNO).  */
  700.     int (*to_fileio_pwrite) (struct target_ops *,
  701.                              int fd, const gdb_byte *write_buf, int len,
  702.                              ULONGEST offset, int *target_errno);

  703.     /* Read up to LEN bytes FD on the target into READ_BUF.
  704.        Return the number of bytes read, or -1 if an error occurs
  705.        (and set *TARGET_ERRNO).  */
  706.     int (*to_fileio_pread) (struct target_ops *,
  707.                             int fd, gdb_byte *read_buf, int len,
  708.                             ULONGEST offset, int *target_errno);

  709.     /* Close FD on the target.  Return 0, or -1 if an error occurs
  710.        (and set *TARGET_ERRNO).  */
  711.     int (*to_fileio_close) (struct target_ops *, int fd, int *target_errno);

  712.     /* Unlink FILENAME on the target.  Return 0, or -1 if an error
  713.        occurs (and set *TARGET_ERRNO).  */
  714.     int (*to_fileio_unlink) (struct target_ops *,
  715.                              const char *filename, int *target_errno);

  716.     /* Read value of symbolic link FILENAME on the target.  Return a
  717.        null-terminated string allocated via xmalloc, or NULL if an error
  718.        occurs (and set *TARGET_ERRNO).  */
  719.     char *(*to_fileio_readlink) (struct target_ops *,
  720.                                  const char *filename, int *target_errno);


  721.     /* Implement the "info proc" command.  */
  722.     void (*to_info_proc) (struct target_ops *, const char *,
  723.                           enum info_proc_what);

  724.     /* Tracepoint-related operations.  */

  725.     /* Prepare the target for a tracing run.  */
  726.     void (*to_trace_init) (struct target_ops *)
  727.       TARGET_DEFAULT_NORETURN (tcomplain ());

  728.     /* Send full details of a tracepoint location to the target.  */
  729.     void (*to_download_tracepoint) (struct target_ops *,
  730.                                     struct bp_location *location)
  731.       TARGET_DEFAULT_NORETURN (tcomplain ());

  732.     /* Is the target able to download tracepoint locations in current
  733.        state?  */
  734.     int (*to_can_download_tracepoint) (struct target_ops *)
  735.       TARGET_DEFAULT_RETURN (0);

  736.     /* Send full details of a trace state variable to the target.  */
  737.     void (*to_download_trace_state_variable) (struct target_ops *,
  738.                                               struct trace_state_variable *tsv)
  739.       TARGET_DEFAULT_NORETURN (tcomplain ());

  740.     /* Enable a tracepoint on the target.  */
  741.     void (*to_enable_tracepoint) (struct target_ops *,
  742.                                   struct bp_location *location)
  743.       TARGET_DEFAULT_NORETURN (tcomplain ());

  744.     /* Disable a tracepoint on the target.  */
  745.     void (*to_disable_tracepoint) (struct target_ops *,
  746.                                    struct bp_location *location)
  747.       TARGET_DEFAULT_NORETURN (tcomplain ());

  748.     /* Inform the target info of memory regions that are readonly
  749.        (such as text sections), and so it should return data from
  750.        those rather than look in the trace buffer.  */
  751.     void (*to_trace_set_readonly_regions) (struct target_ops *)
  752.       TARGET_DEFAULT_NORETURN (tcomplain ());

  753.     /* Start a trace run.  */
  754.     void (*to_trace_start) (struct target_ops *)
  755.       TARGET_DEFAULT_NORETURN (tcomplain ());

  756.     /* Get the current status of a tracing run.  */
  757.     int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts)
  758.       TARGET_DEFAULT_RETURN (-1);

  759.     void (*to_get_tracepoint_status) (struct target_ops *,
  760.                                       struct breakpoint *tp,
  761.                                       struct uploaded_tp *utp)
  762.       TARGET_DEFAULT_NORETURN (tcomplain ());

  763.     /* Stop a trace run.  */
  764.     void (*to_trace_stop) (struct target_ops *)
  765.       TARGET_DEFAULT_NORETURN (tcomplain ());

  766.    /* Ask the target to find a trace frame of the given type TYPE,
  767.       using NUM, ADDR1, and ADDR2 as search parameters.  Returns the
  768.       number of the trace frame, and also the tracepoint number at
  769.       TPP.  If no trace frame matches, return -1.  May throw if the
  770.       operation fails.  */
  771.     int (*to_trace_find) (struct target_ops *,
  772.                           enum trace_find_type type, int num,
  773.                           CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
  774.       TARGET_DEFAULT_RETURN (-1);

  775.     /* Get the value of the trace state variable number TSV, returning
  776.        1 if the value is known and writing the value itself into the
  777.        location pointed to by VAL, else returning 0.  */
  778.     int (*to_get_trace_state_variable_value) (struct target_ops *,
  779.                                               int tsv, LONGEST *val)
  780.       TARGET_DEFAULT_RETURN (0);

  781.     int (*to_save_trace_data) (struct target_ops *, const char *filename)
  782.       TARGET_DEFAULT_NORETURN (tcomplain ());

  783.     int (*to_upload_tracepoints) (struct target_ops *,
  784.                                   struct uploaded_tp **utpp)
  785.       TARGET_DEFAULT_RETURN (0);

  786.     int (*to_upload_trace_state_variables) (struct target_ops *,
  787.                                             struct uploaded_tsv **utsvp)
  788.       TARGET_DEFAULT_RETURN (0);

  789.     LONGEST (*to_get_raw_trace_data) (struct target_ops *, gdb_byte *buf,
  790.                                       ULONGEST offset, LONGEST len)
  791.       TARGET_DEFAULT_NORETURN (tcomplain ());

  792.     /* Get the minimum length of instruction on which a fast tracepoint
  793.        may be set on the target.  If this operation is unsupported,
  794.        return -1.  If for some reason the minimum length cannot be
  795.        determined, return 0.  */
  796.     int (*to_get_min_fast_tracepoint_insn_len) (struct target_ops *)
  797.       TARGET_DEFAULT_RETURN (-1);

  798.     /* Set the target's tracing behavior in response to unexpected
  799.        disconnection - set VAL to 1 to keep tracing, 0 to stop.  */
  800.     void (*to_set_disconnected_tracing) (struct target_ops *, int val)
  801.       TARGET_DEFAULT_IGNORE ();
  802.     void (*to_set_circular_trace_buffer) (struct target_ops *, int val)
  803.       TARGET_DEFAULT_IGNORE ();
  804.     /* Set the size of trace buffer in the target.  */
  805.     void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val)
  806.       TARGET_DEFAULT_IGNORE ();

  807.     /* Add/change textual notes about the trace run, returning 1 if
  808.        successful, 0 otherwise.  */
  809.     int (*to_set_trace_notes) (struct target_ops *,
  810.                                const char *user, const char *notes,
  811.                                const char *stopnotes)
  812.       TARGET_DEFAULT_RETURN (0);

  813.     /* Return the processor core that thread PTID was last seen on.
  814.        This information is updated only when:
  815.        - update_thread_list is called
  816.        - thread stops
  817.        If the core cannot be determined -- either for the specified
  818.        thread, or right now, or in this debug session, or for this
  819.        target -- return -1.  */
  820.     int (*to_core_of_thread) (struct target_ops *, ptid_t ptid)
  821.       TARGET_DEFAULT_RETURN (-1);

  822.     /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
  823.        matches the contents of [DATA,DATA+SIZE).  Returns 1 if there's
  824.        a match, 0 if there's a mismatch, and -1 if an error is
  825.        encountered while reading memory.  */
  826.     int (*to_verify_memory) (struct target_ops *, const gdb_byte *data,
  827.                              CORE_ADDR memaddr, ULONGEST size)
  828.       TARGET_DEFAULT_FUNC (default_verify_memory);

  829.     /* Return the address of the start of the Thread Information Block
  830.        a Windows OS specific feature.  */
  831.     int (*to_get_tib_address) (struct target_ops *,
  832.                                ptid_t ptid, CORE_ADDR *addr)
  833.       TARGET_DEFAULT_NORETURN (tcomplain ());

  834.     /* Send the new settings of write permission variables.  */
  835.     void (*to_set_permissions) (struct target_ops *)
  836.       TARGET_DEFAULT_IGNORE ();

  837.     /* Look for a static tracepoint marker at ADDR, and fill in MARKER
  838.        with its details.  Return 1 on success, 0 on failure.  */
  839.     int (*to_static_tracepoint_marker_at) (struct target_ops *, CORE_ADDR,
  840.                                            struct static_tracepoint_marker *marker)
  841.       TARGET_DEFAULT_RETURN (0);

  842.     /* Return a vector of all tracepoints markers string id ID, or all
  843.        markers if ID is NULL.  */
  844.     VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid) (struct target_ops *, const char *id)
  845.       TARGET_DEFAULT_NORETURN (tcomplain ());

  846.     /* Return a traceframe info object describing the current
  847.        traceframe's contents.  This method should not cache data;
  848.        higher layers take care of caching, invalidating, and
  849.        re-fetching when necessary.  */
  850.     struct traceframe_info *(*to_traceframe_info) (struct target_ops *)
  851.         TARGET_DEFAULT_NORETURN (tcomplain ());

  852.     /* Ask the target to use or not to use agent according to USE.  Return 1
  853.        successful, 0 otherwise.  */
  854.     int (*to_use_agent) (struct target_ops *, int use)
  855.       TARGET_DEFAULT_NORETURN (tcomplain ());

  856.     /* Is the target able to use agent in current state?  */
  857.     int (*to_can_use_agent) (struct target_ops *)
  858.       TARGET_DEFAULT_RETURN (0);

  859.     /* Check whether the target supports branch tracing.  */
  860.     int (*to_supports_btrace) (struct target_ops *)
  861.       TARGET_DEFAULT_RETURN (0);

  862.     /* Enable branch tracing for PTID and allocate a branch trace target
  863.        information struct for reading and for disabling branch trace.  */
  864.     struct btrace_target_info *(*to_enable_btrace) (struct target_ops *,
  865.                                                     ptid_t ptid)
  866.       TARGET_DEFAULT_NORETURN (tcomplain ());

  867.     /* Disable branch tracing and deallocate TINFO.  */
  868.     void (*to_disable_btrace) (struct target_ops *,
  869.                                struct btrace_target_info *tinfo)
  870.       TARGET_DEFAULT_NORETURN (tcomplain ());

  871.     /* Disable branch tracing and deallocate TINFO.  This function is similar
  872.        to to_disable_btrace, except that it is called during teardown and is
  873.        only allowed to perform actions that are safe.  A counter-example would
  874.        be attempting to talk to a remote target.  */
  875.     void (*to_teardown_btrace) (struct target_ops *,
  876.                                 struct btrace_target_info *tinfo)
  877.       TARGET_DEFAULT_NORETURN (tcomplain ());

  878.     /* Read branch trace data for the thread indicated by BTINFO into DATA.
  879.        DATA is cleared before new trace is added.
  880.        The branch trace will start with the most recent block and continue
  881.        towards older blocks.  */
  882.     enum btrace_error (*to_read_btrace) (struct target_ops *self,
  883.                                          VEC (btrace_block_s) **data,
  884.                                          struct btrace_target_info *btinfo,
  885.                                          enum btrace_read_type type)
  886.       TARGET_DEFAULT_NORETURN (tcomplain ());

  887.     /* Stop trace recording.  */
  888.     void (*to_stop_recording) (struct target_ops *)
  889.       TARGET_DEFAULT_IGNORE ();

  890.     /* Print information about the recording.  */
  891.     void (*to_info_record) (struct target_ops *)
  892.       TARGET_DEFAULT_IGNORE ();

  893.     /* Save the recorded execution trace into a file.  */
  894.     void (*to_save_record) (struct target_ops *, const char *filename)
  895.       TARGET_DEFAULT_NORETURN (tcomplain ());

  896.     /* Delete the recorded execution trace from the current position
  897.        onwards.  */
  898.     void (*to_delete_record) (struct target_ops *)
  899.       TARGET_DEFAULT_NORETURN (tcomplain ());

  900.     /* Query if the record target is currently replaying.  */
  901.     int (*to_record_is_replaying) (struct target_ops *)
  902.       TARGET_DEFAULT_RETURN (0);

  903.     /* Go to the begin of the execution trace.  */
  904.     void (*to_goto_record_begin) (struct target_ops *)
  905.       TARGET_DEFAULT_NORETURN (tcomplain ());

  906.     /* Go to the end of the execution trace.  */
  907.     void (*to_goto_record_end) (struct target_ops *)
  908.       TARGET_DEFAULT_NORETURN (tcomplain ());

  909.     /* Go to a specific location in the recorded execution trace.  */
  910.     void (*to_goto_record) (struct target_ops *, ULONGEST insn)
  911.       TARGET_DEFAULT_NORETURN (tcomplain ());

  912.     /* Disassemble SIZE instructions in the recorded execution trace from
  913.        the current position.
  914.        If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
  915.        disassemble SIZE succeeding instructions.  */
  916.     void (*to_insn_history) (struct target_ops *, int size, int flags)
  917.       TARGET_DEFAULT_NORETURN (tcomplain ());

  918.     /* Disassemble SIZE instructions in the recorded execution trace around
  919.        FROM.
  920.        If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
  921.        disassemble SIZE instructions after FROM.  */
  922.     void (*to_insn_history_from) (struct target_ops *,
  923.                                   ULONGEST from, int size, int flags)
  924.       TARGET_DEFAULT_NORETURN (tcomplain ());

  925.     /* Disassemble a section of the recorded execution trace from instruction
  926.        BEGIN (inclusive) to instruction END (inclusive).  */
  927.     void (*to_insn_history_range) (struct target_ops *,
  928.                                    ULONGEST begin, ULONGEST end, int flags)
  929.       TARGET_DEFAULT_NORETURN (tcomplain ());

  930.     /* Print a function trace of the recorded execution trace.
  931.        If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
  932.        succeeding functions.  */
  933.     void (*to_call_history) (struct target_ops *, int size, int flags)
  934.       TARGET_DEFAULT_NORETURN (tcomplain ());

  935.     /* Print a function trace of the recorded execution trace starting
  936.        at function FROM.
  937.        If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
  938.        SIZE functions after FROM.  */
  939.     void (*to_call_history_from) (struct target_ops *,
  940.                                   ULONGEST begin, int size, int flags)
  941.       TARGET_DEFAULT_NORETURN (tcomplain ());

  942.     /* Print a function trace of an execution trace section from function BEGIN
  943.        (inclusive) to function END (inclusive).  */
  944.     void (*to_call_history_range) (struct target_ops *,
  945.                                    ULONGEST begin, ULONGEST end, int flags)
  946.       TARGET_DEFAULT_NORETURN (tcomplain ());

  947.     /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
  948.        non-empty annex.  */
  949.     int (*to_augmented_libraries_svr4_read) (struct target_ops *)
  950.       TARGET_DEFAULT_RETURN (0);

  951.     /* Those unwinders are tried before any other arch unwinders.  If
  952.        SELF doesn't have unwinders, it should delegate to the
  953.        "beneath" target.  */
  954.     const struct frame_unwind *(*to_get_unwinder) (struct target_ops *self)
  955.       TARGET_DEFAULT_RETURN (NULL);

  956.     const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self)
  957.       TARGET_DEFAULT_RETURN (NULL);

  958.     /* Return the number of bytes by which the PC needs to be decremented
  959.        after executing a breakpoint instruction.
  960.        Defaults to gdbarch_decr_pc_after_break (GDBARCH).  */
  961.     CORE_ADDR (*to_decr_pc_after_break) (struct target_ops *ops,
  962.                                          struct gdbarch *gdbarch)
  963.       TARGET_DEFAULT_FUNC (default_target_decr_pc_after_break);

  964.     /* Prepare to generate a core file.  */
  965.     void (*to_prepare_to_generate_core) (struct target_ops *)
  966.       TARGET_DEFAULT_IGNORE ();

  967.     /* Cleanup after generating a core file.  */
  968.     void (*to_done_generating_core) (struct target_ops *)
  969.       TARGET_DEFAULT_IGNORE ();

  970.     int to_magic;
  971.     /* Need sub-structure for target machine related rather than comm related?
  972.      */
  973.   };

  974. /* Magic number for checking ops size.  If a struct doesn't end with this
  975.    number, somebody changed the declaration but didn't change all the
  976.    places that initialize one.  */

  977. #define        OPS_MAGIC        3840

  978. /* The ops structure for our "current" target process.  This should
  979.    never be NULL.  If there is no target, it points to the dummy_target.  */

  980. extern struct target_ops current_target;

  981. /* Define easy words for doing these operations on our current target.  */

  982. #define        target_shortname        (current_target.to_shortname)
  983. #define        target_longname                (current_target.to_longname)

  984. /* Does whatever cleanup is required for a target that we are no
  985.    longer going to be calling.  This routine is automatically always
  986.    called after popping the target off the target stack - the target's
  987.    own methods are no longer available through the target vector.
  988.    Closing file descriptors and freeing all memory allocated memory are
  989.    typical things it should do.  */

  990. void target_close (struct target_ops *targ);

  991. /* Find the correct target to use for "attach".  If a target on the
  992.    current stack supports attaching, then it is returned.  Otherwise,
  993.    the default run target is returned.  */

  994. extern struct target_ops *find_attach_target (void);

  995. /* Find the correct target to use for "run".  If a target on the
  996.    current stack supports creating a new inferior, then it is
  997.    returned.  Otherwise, the default run target is returned.  */

  998. extern struct target_ops *find_run_target (void);

  999. /* Some targets don't generate traps when attaching to the inferior,
  1000.    or their target_attach implementation takes care of the waiting.
  1001.    These targets must set to_attach_no_wait.  */

  1002. #define target_attach_no_wait \
  1003.      (current_target.to_attach_no_wait)

  1004. /* The target_attach operation places a process under debugger control,
  1005.    and stops the process.

  1006.    This operation provides a target-specific hook that allows the
  1007.    necessary bookkeeping to be performed after an attach completes.  */
  1008. #define target_post_attach(pid) \
  1009.      (*current_target.to_post_attach) (&current_target, pid)

  1010. /* Takes a program previously attached to and detaches it.
  1011.    The program may resume execution (some targets do, some don't) and will
  1012.    no longer stop on signals, etc.  We better not have left any breakpoints
  1013.    in the program or it'll die when it hits one.  ARGS is arguments
  1014.    typed by the user (e.g. a signal to send the process).  FROM_TTY
  1015.    says whether to be verbose or not.  */

  1016. extern void target_detach (const char *, int);

  1017. /* Disconnect from the current target without resuming it (leaving it
  1018.    waiting for a debugger).  */

  1019. extern void target_disconnect (const char *, int);

  1020. /* Resume execution of the target process PTID (or a group of
  1021.    threads).  STEP says whether to single-step or to run free; SIGGNAL
  1022.    is the signal to be given to the target, or GDB_SIGNAL_0 for no
  1023.    signal.  The caller may not pass GDB_SIGNAL_DEFAULT.  A specific
  1024.    PTID means `step/resume only this process id'.  A wildcard PTID
  1025.    (all threads, or all threads of process) means `step/resume
  1026.    INFERIOR_PTID, and let other threads (for which the wildcard PTID
  1027.    matches) resume with their 'thread->suspend.stop_signal' signal
  1028.    (usually GDB_SIGNAL_0) if it is in "pass" state, or with no signal
  1029.    if in "no pass" state.  */

  1030. extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal);

  1031. /* Wait for process pid to do something.  PTID = -1 to wait for any
  1032.    pid to do something.  Return pid of child, or -1 in case of error;
  1033.    store status through argument pointer STATUS.  Note that it is
  1034.    _NOT_ OK to throw_exception() out of target_wait() without popping
  1035.    the debugging target from the stack; GDB isn't prepared to get back
  1036.    to the prompt with a debugging target but without the frame cache,
  1037.    stop_pc, etc., set up.  OPTIONS is a bitwise OR of TARGET_W*
  1038.    options.  */

  1039. extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status,
  1040.                            int options);

  1041. /* Fetch at least register REGNO, or all regs if regno == -1.  No result.  */

  1042. extern void target_fetch_registers (struct regcache *regcache, int regno);

  1043. /* Store at least register REGNO, or all regs if REGNO == -1.
  1044.    It can store as many registers as it wants to, so target_prepare_to_store
  1045.    must have been previously called.  Calls error() if there are problems.  */

  1046. extern void target_store_registers (struct regcache *regcache, int regs);

  1047. /* Get ready to modify the registers array.  On machines which store
  1048.    individual registers, this doesn't need to do anything.  On machines
  1049.    which store all the registers in one fell swoop, this makes sure
  1050.    that REGISTERS contains all the registers from the program being
  1051.    debugged.  */

  1052. #define        target_prepare_to_store(regcache)        \
  1053.      (*current_target.to_prepare_to_store) (&current_target, regcache)

  1054. /* Determine current address space of thread PTID.  */

  1055. struct address_space *target_thread_address_space (ptid_t);

  1056. /* Implement the "info proc" command.  This returns one if the request
  1057.    was handled, and zero otherwise.  It can also throw an exception if
  1058.    an error was encountered while attempting to handle the
  1059.    request.  */

  1060. int target_info_proc (const char *, enum info_proc_what);

  1061. /* Returns true if this target can debug multiple processes
  1062.    simultaneously.  */

  1063. #define        target_supports_multi_process()        \
  1064.      (*current_target.to_supports_multi_process) (&current_target)

  1065. /* Returns true if this target can disable address space randomization.  */

  1066. int target_supports_disable_randomization (void);

  1067. /* Returns true if this target can enable and disable tracepoints
  1068.    while a trace experiment is running.  */

  1069. #define target_supports_enable_disable_tracepoint() \
  1070.   (*current_target.to_supports_enable_disable_tracepoint) (&current_target)

  1071. #define target_supports_string_tracing() \
  1072.   (*current_target.to_supports_string_tracing) (&current_target)

  1073. /* Returns true if this target can handle breakpoint conditions
  1074.    on its end.  */

  1075. #define target_supports_evaluation_of_breakpoint_conditions() \
  1076.   (*current_target.to_supports_evaluation_of_breakpoint_conditions) (&current_target)

  1077. /* Returns true if this target can handle breakpoint commands
  1078.    on its end.  */

  1079. #define target_can_run_breakpoint_commands() \
  1080.   (*current_target.to_can_run_breakpoint_commands) (&current_target)

  1081. extern int target_read_string (CORE_ADDR, char **, int, int *);

  1082. /* For target_read_memory see target/target.h.  */

  1083. extern int target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
  1084.                                    ssize_t len);

  1085. extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);

  1086. extern int target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);

  1087. /* For target_write_memory see target/target.h.  */

  1088. extern int target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
  1089.                                     ssize_t len);

  1090. /* Fetches the target's memory map.  If one is found it is sorted
  1091.    and returned, after some consistency checking.  Otherwise, NULL
  1092.    is returned.  */
  1093. VEC(mem_region_s) *target_memory_map (void);

  1094. /* Erase the specified flash region.  */
  1095. void target_flash_erase (ULONGEST address, LONGEST length);

  1096. /* Finish a sequence of flash operations.  */
  1097. void target_flash_done (void);

  1098. /* Describes a request for a memory write operation.  */
  1099. struct memory_write_request
  1100.   {
  1101.     /* Begining address that must be written.  */
  1102.     ULONGEST begin;
  1103.     /* Past-the-end address.  */
  1104.     ULONGEST end;
  1105.     /* The data to write.  */
  1106.     gdb_byte *data;
  1107.     /* A callback baton for progress reporting for this request.  */
  1108.     void *baton;
  1109.   };
  1110. typedef struct memory_write_request memory_write_request_s;
  1111. DEF_VEC_O(memory_write_request_s);

  1112. /* Enumeration specifying different flash preservation behaviour.  */
  1113. enum flash_preserve_mode
  1114.   {
  1115.     flash_preserve,
  1116.     flash_discard
  1117.   };

  1118. /* Write several memory blocks at once.  This version can be more
  1119.    efficient than making several calls to target_write_memory, in
  1120.    particular because it can optimize accesses to flash memory.

  1121.    Moreover, this is currently the only memory access function in gdb
  1122.    that supports writing to flash memory, and it should be used for
  1123.    all cases where access to flash memory is desirable.

  1124.    REQUESTS is the vector (see vec.h) of memory_write_request.
  1125.    PRESERVE_FLASH_P indicates what to do with blocks which must be
  1126.      erased, but not completely rewritten.
  1127.    PROGRESS_CB is a function that will be periodically called to provide
  1128.      feedback to user.  It will be called with the baton corresponding
  1129.      to the request currently being written.  It may also be called
  1130.      with a NULL baton, when preserved flash sectors are being rewritten.

  1131.    The function returns 0 on success, and error otherwise.  */
  1132. int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
  1133.                                 enum flash_preserve_mode preserve_flash_p,
  1134.                                 void (*progress_cb) (ULONGEST, void *));

  1135. /* Print a line about the current target.  */

  1136. #define        target_files_info()        \
  1137.      (*current_target.to_files_info) (&current_target)

  1138. /* Insert a breakpoint at address BP_TGT->placed_address in
  1139.    the target machine.  Returns 0 for success, and returns non-zero or
  1140.    throws an error (with a detailed failure reason error code and
  1141.    message) otherwise.  */

  1142. extern int target_insert_breakpoint (struct gdbarch *gdbarch,
  1143.                                      struct bp_target_info *bp_tgt);

  1144. /* Remove a breakpoint at address BP_TGT->placed_address in the target
  1145.    machine.  Result is 0 for success, non-zero for error.  */

  1146. extern int target_remove_breakpoint (struct gdbarch *gdbarch,
  1147.                                      struct bp_target_info *bp_tgt);

  1148. /* Returns true if the terminal settings of the inferior are in
  1149.    effect.  */

  1150. extern int target_terminal_is_inferior (void);

  1151. /* Initialize the terminal settings we record for the inferior,
  1152.    before we actually run the inferior.  */

  1153. extern void target_terminal_init (void);

  1154. /* Put the inferior's terminal settings into effect.
  1155.    This is preparation for starting or resuming the inferior.  */

  1156. extern void target_terminal_inferior (void);

  1157. /* Put some of our terminal settings into effect, enough to get proper
  1158.    results from our output, but do not change into or out of RAW mode
  1159.    so that no input is discarded.  This is a no-op if terminal_ours
  1160.    was most recently called.  */

  1161. extern void target_terminal_ours_for_output (void);

  1162. /* Put our terminal settings into effect.
  1163.    First record the inferior's terminal settings
  1164.    so they can be restored properly later.  */

  1165. extern void target_terminal_ours (void);

  1166. /* Return true if the target stack has a non-default
  1167.   "to_terminal_ours" method.  */

  1168. extern int target_supports_terminal_ours (void);

  1169. /* Make a cleanup that restores the state of the terminal to the current
  1170.    state.  */
  1171. extern struct cleanup *make_cleanup_restore_target_terminal (void);

  1172. /* Print useful information about our terminal status, if such a thing
  1173.    exists.  */

  1174. #define target_terminal_info(arg, from_tty) \
  1175.      (*current_target.to_terminal_info) (&current_target, arg, from_tty)

  1176. /* Kill the inferior process.   Make it go away.  */

  1177. extern void target_kill (void);

  1178. /* Load an executable file into the target process.  This is expected
  1179.    to not only bring new code into the target process, but also to
  1180.    update GDB's symbol tables to match.

  1181.    ARG contains command-line arguments, to be broken down with
  1182.    buildargv ().  The first non-switch argument is the filename to
  1183.    load, FILE; the second is a number (as parsed by strtoul (..., ...,
  1184.    0)), which is an offset to apply to the load addresses of FILE's
  1185.    sections.  The target may define switches, or other non-switch
  1186.    arguments, as it pleases.  */

  1187. extern void target_load (const char *arg, int from_tty);

  1188. /* Some targets (such as ttrace-based HPUX) don't allow us to request
  1189.    notification of inferior events such as fork and vork immediately
  1190.    after the inferior is created.  (This because of how gdb gets an
  1191.    inferior created via invoking a shell to do it.  In such a scenario,
  1192.    if the shell init file has commands in it, the shell will fork and
  1193.    exec for each of those commands, and we will see each such fork
  1194.    event.  Very bad.)

  1195.    Such targets will supply an appropriate definition for this function.  */

  1196. #define target_post_startup_inferior(ptid) \
  1197.      (*current_target.to_post_startup_inferior) (&current_target, ptid)

  1198. /* On some targets, we can catch an inferior fork or vfork event when
  1199.    it occurs.  These functions insert/remove an already-created
  1200.    catchpoint for such events.  They return  0 for success, 1 if the
  1201.    catchpoint type is not supported and -1 for failure.  */

  1202. #define target_insert_fork_catchpoint(pid) \
  1203.      (*current_target.to_insert_fork_catchpoint) (&current_target, pid)

  1204. #define target_remove_fork_catchpoint(pid) \
  1205.      (*current_target.to_remove_fork_catchpoint) (&current_target, pid)

  1206. #define target_insert_vfork_catchpoint(pid) \
  1207.      (*current_target.to_insert_vfork_catchpoint) (&current_target, pid)

  1208. #define target_remove_vfork_catchpoint(pid) \
  1209.      (*current_target.to_remove_vfork_catchpoint) (&current_target, pid)

  1210. /* If the inferior forks or vforks, this function will be called at
  1211.    the next resume in order to perform any bookkeeping and fiddling
  1212.    necessary to continue debugging either the parent or child, as
  1213.    requested, and releasing the other.  Information about the fork
  1214.    or vfork event is available via get_last_target_status ().
  1215.    This function returns 1 if the inferior should not be resumed
  1216.    (i.e. there is another event pending).  */

  1217. int target_follow_fork (int follow_child, int detach_fork);

  1218. /* On some targets, we can catch an inferior exec event when it
  1219.    occurs.  These functions insert/remove an already-created
  1220.    catchpoint for such events.  They return  0 for success, 1 if the
  1221.    catchpoint type is not supported and -1 for failure.  */

  1222. #define target_insert_exec_catchpoint(pid) \
  1223.      (*current_target.to_insert_exec_catchpoint) (&current_target, pid)

  1224. #define target_remove_exec_catchpoint(pid) \
  1225.      (*current_target.to_remove_exec_catchpoint) (&current_target, pid)

  1226. /* Syscall catch.

  1227.    NEEDED is nonzero if any syscall catch (of any kind) is requested.
  1228.    If NEEDED is zero, it means the target can disable the mechanism to
  1229.    catch system calls because there are no more catchpoints of this type.

  1230.    ANY_COUNT is nonzero if a generic (filter-less) syscall catch is
  1231.    being requested.  In this case, both TABLE_SIZE and TABLE should
  1232.    be ignored.

  1233.    TABLE_SIZE is the number of elements in TABLE.  It only matters if
  1234.    ANY_COUNT is zero.

  1235.    TABLE is an array of ints, indexed by syscall number.  An element in
  1236.    this array is nonzero if that syscall should be caught.  This argument
  1237.    only matters if ANY_COUNT is zero.

  1238.    Return 0 for success, 1 if syscall catchpoints are not supported or -1
  1239.    for failure.  */

  1240. #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \
  1241.      (*current_target.to_set_syscall_catchpoint) (&current_target,        \
  1242.                                                   pid, needed, any_count, \
  1243.                                                   table_size, table)

  1244. /* Returns TRUE if PID has exited.  And, also sets EXIT_STATUS to the
  1245.    exit code of PID, if any.  */

  1246. #define target_has_exited(pid,wait_status,exit_status) \
  1247.      (*current_target.to_has_exited) (&current_target, \
  1248.                                       pid,wait_status,exit_status)

  1249. /* The debugger has completed a blocking wait() call.  There is now
  1250.    some process event that must be processed.  This function should
  1251.    be defined by those targets that require the debugger to perform
  1252.    cleanup or internal state changes in response to the process event.  */

  1253. /* The inferior process has died.  Do what is right.  */

  1254. void target_mourn_inferior (void);

  1255. /* Does target have enough data to do a run or attach command? */

  1256. #define target_can_run(t) \
  1257.      ((t)->to_can_run) (t)

  1258. /* Set list of signals to be handled in the target.

  1259.    PASS_SIGNALS is an array of size NSIG, indexed by target signal number
  1260.    (enum gdb_signal).  For every signal whose entry in this array is
  1261.    non-zero, the target is allowed -but not required- to skip reporting
  1262.    arrival of the signal to the GDB core by returning from target_wait,
  1263.    and to pass the signal directly to the inferior instead.

  1264.    However, if the target is hardware single-stepping a thread that is
  1265.    about to receive a signal, it needs to be reported in any case, even
  1266.    if mentioned in a previous target_pass_signals call.   */

  1267. extern void target_pass_signals (int nsig, unsigned char *pass_signals);

  1268. /* Set list of signals the target may pass to the inferior.  This
  1269.    directly maps to the "handle SIGNAL pass/nopass" setting.

  1270.    PROGRAM_SIGNALS is an array of size NSIG, indexed by target signal
  1271.    number (enum gdb_signal).  For every signal whose entry in this
  1272.    array is non-zero, the target is allowed to pass the signal to the
  1273.    inferior.  Signals not present in the array shall be silently
  1274.    discarded.  This does not influence whether to pass signals to the
  1275.    inferior as a result of a target_resume call.  This is useful in
  1276.    scenarios where the target needs to decide whether to pass or not a
  1277.    signal to the inferior without GDB core involvement, such as for
  1278.    example, when detaching (as threads may have been suspended with
  1279.    pending signals not reported to GDB).  */

  1280. extern void target_program_signals (int nsig, unsigned char *program_signals);

  1281. /* Check to see if a thread is still alive.  */

  1282. extern int target_thread_alive (ptid_t ptid);

  1283. /* Sync the target's threads with GDB's thread list.  */

  1284. extern void target_update_thread_list (void);

  1285. /* Make target stop in a continuable fashion.  (For instance, under
  1286.    Unix, this should act like SIGSTOP).  Note that this function is
  1287.    asynchronous: it does not wait for the target to become stopped
  1288.    before returning.  If this is the behavior you want please use
  1289.    target_stop_and_wait.  */

  1290. extern void target_stop (ptid_t ptid);

  1291. /* Send the specified COMMAND to the target's monitor
  1292.    (shell,interpreter) for execution.  The result of the query is
  1293.    placed in OUTBUF.  */

  1294. #define target_rcmd(command, outbuf) \
  1295.      (*current_target.to_rcmd) (&current_target, command, outbuf)


  1296. /* Does the target include all of memory, or only part of it?  This
  1297.    determines whether we look up the target chain for other parts of
  1298.    memory if this target can't satisfy a request.  */

  1299. extern int target_has_all_memory_1 (void);
  1300. #define target_has_all_memory target_has_all_memory_1 ()

  1301. /* Does the target include memory?  (Dummy targets don't.)  */

  1302. extern int target_has_memory_1 (void);
  1303. #define target_has_memory target_has_memory_1 ()

  1304. /* Does the target have a stack?  (Exec files don't, VxWorks doesn't, until
  1305.    we start a process.)  */

  1306. extern int target_has_stack_1 (void);
  1307. #define target_has_stack target_has_stack_1 ()

  1308. /* Does the target have registers?  (Exec files don't.)  */

  1309. extern int target_has_registers_1 (void);
  1310. #define target_has_registers target_has_registers_1 ()

  1311. /* Does the target have execution?  Can we make it jump (through
  1312.    hoops), or pop its stack a few times?  This means that the current
  1313.    target is currently executing; for some targets, that's the same as
  1314.    whether or not the target is capable of execution, but there are
  1315.    also targets which can be current while not executing.  In that
  1316.    case this will become true after to_create_inferior or
  1317.    to_attach.  */

  1318. extern int target_has_execution_1 (ptid_t);

  1319. /* Like target_has_execution_1, but always passes inferior_ptid.  */

  1320. extern int target_has_execution_current (void);

  1321. #define target_has_execution target_has_execution_current ()

  1322. /* Default implementations for process_stratum targets.  Return true
  1323.    if there's a selected inferior, false otherwise.  */

  1324. extern int default_child_has_all_memory (struct target_ops *ops);
  1325. extern int default_child_has_memory (struct target_ops *ops);
  1326. extern int default_child_has_stack (struct target_ops *ops);
  1327. extern int default_child_has_registers (struct target_ops *ops);
  1328. extern int default_child_has_execution (struct target_ops *ops,
  1329.                                         ptid_t the_ptid);

  1330. /* Can the target support the debugger control of thread execution?
  1331.    Can it lock the thread scheduler?  */

  1332. #define target_can_lock_scheduler \
  1333.      (current_target.to_has_thread_control & tc_schedlock)

  1334. /* Controls whether async mode is permitted.  */
  1335. extern int target_async_permitted;

  1336. /* Can the target support asynchronous execution?  */
  1337. #define target_can_async_p() (current_target.to_can_async_p (&current_target))

  1338. /* Is the target in asynchronous execution mode?  */
  1339. #define target_is_async_p() (current_target.to_is_async_p (&current_target))

  1340. /* Put the target in async mode with the specified callback function.  */
  1341. #define target_async(CALLBACK,CONTEXT) \
  1342.      (current_target.to_async (&current_target, (CALLBACK), (CONTEXT)))

  1343. #define target_execution_direction() \
  1344.   (current_target.to_execution_direction (&current_target))

  1345. /* Converts a process id to a string.  Usually, the string just contains
  1346.    `process xyz', but on some systems it may contain
  1347.    `process xyz thread abc'.  */

  1348. extern char *target_pid_to_str (ptid_t ptid);

  1349. extern char *normal_pid_to_str (ptid_t ptid);

  1350. /* Return a short string describing extra information about PID,
  1351.    e.g. "sleeping", "runnable", "running on LWP 3".  Null return value
  1352.    is okay.  */

  1353. #define target_extra_thread_info(TP) \
  1354.      (current_target.to_extra_thread_info (&current_target, TP))

  1355. /* Return the thread's nameA NULL result means that the target
  1356.    could not determine this thread's name.  */

  1357. extern char *target_thread_name (struct thread_info *);

  1358. /* Attempts to find the pathname of the executable file
  1359.    that was run to create a specified process.

  1360.    The process PID must be stopped when this operation is used.

  1361.    If the executable file cannot be determined, NULL is returned.

  1362.    Else, a pointer to a character string containing the pathname
  1363.    is returned.  This string should be copied into a buffer by
  1364.    the client if the string will not be immediately used, or if
  1365.    it must persist.  */

  1366. #define target_pid_to_exec_file(pid) \
  1367.      (current_target.to_pid_to_exec_file) (&current_target, pid)

  1368. /* See the to_thread_architecture description in struct target_ops.  */

  1369. #define target_thread_architecture(ptid) \
  1370.      (current_target.to_thread_architecture (&current_target, ptid))

  1371. /*
  1372. * Iterator function for target memory regions.
  1373. * Calls a callback function once for each memory region 'mapped'
  1374. * in the child process.  Defined as a simple macro rather than
  1375. * as a function macro so that it can be tested for nullity.
  1376. */

  1377. #define target_find_memory_regions(FUNC, DATA) \
  1378.      (current_target.to_find_memory_regions) (&current_target, FUNC, DATA)

  1379. /*
  1380. * Compose corefile .note section.
  1381. */

  1382. #define target_make_corefile_notes(BFD, SIZE_P) \
  1383.      (current_target.to_make_corefile_notes) (&current_target, BFD, SIZE_P)

  1384. /* Bookmark interfaces.  */
  1385. #define target_get_bookmark(ARGS, FROM_TTY) \
  1386.      (current_target.to_get_bookmark) (&current_target, ARGS, FROM_TTY)

  1387. #define target_goto_bookmark(ARG, FROM_TTY) \
  1388.      (current_target.to_goto_bookmark) (&current_target, ARG, FROM_TTY)

  1389. /* Hardware watchpoint interfaces.  */

  1390. /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
  1391.    write).  Only the INFERIOR_PTID task is being queried.  */

  1392. #define target_stopped_by_watchpoint()                \
  1393.   ((*current_target.to_stopped_by_watchpoint) (&current_target))

  1394. /* Non-zero if we have steppable watchpoints  */

  1395. #define target_have_steppable_watchpoint \
  1396.    (current_target.to_have_steppable_watchpoint)

  1397. /* Non-zero if we have continuable watchpoints  */

  1398. #define target_have_continuable_watchpoint \
  1399.    (current_target.to_have_continuable_watchpoint)

  1400. /* Provide defaults for hardware watchpoint functions.  */

  1401. /* If the *_hw_beakpoint functions have not been defined
  1402.    elsewhere use the definitions in the target vector.  */

  1403. /* Returns non-zero if we can set a hardware watchpoint of type TYPETYPE is
  1404.    one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or
  1405.    bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
  1406.    (including this one?).  OTHERTYPE is who knows what...  */

  1407. #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
  1408. (*current_target.to_can_use_hw_breakpoint) (&current_target,  \
  1409.                                              TYPE, CNT, OTHERTYPE);

  1410. /* Returns the number of debug registers needed to watch the given
  1411.    memory region, or zero if not supported.  */

  1412. #define target_region_ok_for_hw_watchpoint(addr, len) \
  1413.     (*current_target.to_region_ok_for_hw_watchpoint) (&current_target,        \
  1414.                                                       addr, len)


  1415. /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
  1416.    TYPE is 0 for write, 1 for read, and 2 for read/write accesses.
  1417.    COND is the expression for its condition, or NULL if there's none.
  1418.    Returns 0 for success, 1 if the watchpoint type is not supported,
  1419.    -1 for failure.  */

  1420. #define        target_insert_watchpoint(addr, len, type, cond) \
  1421.      (*current_target.to_insert_watchpoint) (&current_target,        \
  1422.                                              addr, len, type, cond)

  1423. #define        target_remove_watchpoint(addr, len, type, cond) \
  1424.      (*current_target.to_remove_watchpoint) (&current_target,        \
  1425.                                              addr, len, type, cond)

  1426. /* Insert a new masked watchpoint at ADDR using the mask MASK.
  1427.    RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
  1428.    or hw_access for an access watchpoint.  Returns 0 for success, 1 if
  1429.    masked watchpoints are not supported, -1 for failure.  */

  1430. extern int target_insert_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);

  1431. /* Remove a masked watchpoint at ADDR with the mask MASK.
  1432.    RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
  1433.    or hw_access for an access watchpoint.  Returns 0 for success, non-zero
  1434.    for failure.  */

  1435. extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);

  1436. /* Insert a hardware breakpoint at address BP_TGT->placed_address in
  1437.    the target machine.  Returns 0 for success, and returns non-zero or
  1438.    throws an error (with a detailed failure reason error code and
  1439.    message) otherwise.  */

  1440. #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
  1441.      (*current_target.to_insert_hw_breakpoint) (&current_target,        \
  1442.                                                 gdbarch, bp_tgt)

  1443. #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
  1444.      (*current_target.to_remove_hw_breakpoint) (&current_target,        \
  1445.                                                 gdbarch, bp_tgt)

  1446. /* Return number of debug registers needed for a ranged breakpoint,
  1447.    or -1 if ranged breakpoints are not supported.  */

  1448. extern int target_ranged_break_num_registers (void);

  1449. /* Return non-zero if target knows the data address which triggered this
  1450.    target_stopped_by_watchpoint, in such case place it to *ADDR_P.  Only the
  1451.    INFERIOR_PTID task is being queried.  */
  1452. #define target_stopped_data_address(target, addr_p) \
  1453.     (*(target)->to_stopped_data_address) (target, addr_p)

  1454. /* Return non-zero if ADDR is within the range of a watchpoint spanning
  1455.    LENGTH bytes beginning at START.  */
  1456. #define target_watchpoint_addr_within_range(target, addr, start, length) \
  1457.   (*(target)->to_watchpoint_addr_within_range) (target, addr, start, length)

  1458. /* Return non-zero if the target is capable of using hardware to evaluate
  1459.    the condition expression.  In this case, if the condition is false when
  1460.    the watched memory location changes, execution may continue without the
  1461.    debugger being notified.

  1462.    Due to limitations in the hardware implementation, it may be capable of
  1463.    avoiding triggering the watchpoint in some cases where the condition
  1464.    expression is false, but may report some false positives as well.
  1465.    For this reason, GDB will still evaluate the condition expression when
  1466.    the watchpoint triggers.  */
  1467. #define target_can_accel_watchpoint_condition(addr, len, type, cond) \
  1468.   (*current_target.to_can_accel_watchpoint_condition) (&current_target,        \
  1469.                                                        addr, len, type, cond)

  1470. /* Return number of debug registers needed for a masked watchpoint,
  1471.    -1 if masked watchpoints are not supported or -2 if the given address
  1472.    and mask combination cannot be used.  */

  1473. extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask);

  1474. /* Target can execute in reverse?  */
  1475. #define target_can_execute_reverse \
  1476.       current_target.to_can_execute_reverse (&current_target)

  1477. extern const struct target_desc *target_read_description (struct target_ops *);

  1478. #define target_get_ada_task_ptid(lwp, tid) \
  1479.      (*current_target.to_get_ada_task_ptid) (&current_target, lwp,tid)

  1480. /* Utility implementation of searching memory.  */
  1481. extern int simple_search_memory (struct target_ops* ops,
  1482.                                  CORE_ADDR start_addr,
  1483.                                  ULONGEST search_space_len,
  1484.                                  const gdb_byte *pattern,
  1485.                                  ULONGEST pattern_len,
  1486.                                  CORE_ADDR *found_addrp);

  1487. /* Main entry point for searching memory.  */
  1488. extern int target_search_memory (CORE_ADDR start_addr,
  1489.                                  ULONGEST search_space_len,
  1490.                                  const gdb_byte *pattern,
  1491.                                  ULONGEST pattern_len,
  1492.                                  CORE_ADDR *found_addrp);

  1493. /* Target file operations.  */

  1494. /* Open FILENAME on the target, using FLAGS and MODE.  Return a
  1495.    target file descriptor, or -1 if an error occurs (and set
  1496.    *TARGET_ERRNO).  */
  1497. extern int target_fileio_open (const char *filename, int flags, int mode,
  1498.                                int *target_errno);

  1499. /* Write up to LEN bytes from WRITE_BUF to FD on the target.
  1500.    Return the number of bytes written, or -1 if an error occurs
  1501.    (and set *TARGET_ERRNO).  */
  1502. extern int target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
  1503.                                  ULONGEST offset, int *target_errno);

  1504. /* Read up to LEN bytes FD on the target into READ_BUF.
  1505.    Return the number of bytes read, or -1 if an error occurs
  1506.    (and set *TARGET_ERRNO).  */
  1507. extern int target_fileio_pread (int fd, gdb_byte *read_buf, int len,
  1508.                                 ULONGEST offset, int *target_errno);

  1509. /* Close FD on the target.  Return 0, or -1 if an error occurs
  1510.    (and set *TARGET_ERRNO).  */
  1511. extern int target_fileio_close (int fd, int *target_errno);

  1512. /* Unlink FILENAME on the target.  Return 0, or -1 if an error
  1513.    occurs (and set *TARGET_ERRNO).  */
  1514. extern int target_fileio_unlink (const char *filename, int *target_errno);

  1515. /* Read value of symbolic link FILENAME on the target.  Return a
  1516.    null-terminated string allocated via xmalloc, or NULL if an error
  1517.    occurs (and set *TARGET_ERRNO).  */
  1518. extern char *target_fileio_readlink (const char *filename, int *target_errno);

  1519. /* Read target file FILENAME.  The return value will be -1 if the transfer
  1520.    fails or is not supported; 0 if the object is empty; or the length
  1521.    of the object otherwise.  If a positive value is returned, a
  1522.    sufficiently large buffer will be allocated using xmalloc and
  1523.    returned in *BUF_P containing the contents of the object.

  1524.    This method should be used for objects sufficiently small to store
  1525.    in a single xmalloc'd buffer, when no fixed bound on the object's
  1526.    size is known in advance.  */
  1527. extern LONGEST target_fileio_read_alloc (const char *filename,
  1528.                                          gdb_byte **buf_p);

  1529. /* Read target file FILENAME.  The result is NUL-terminated and
  1530.    returned as a string, allocated using xmalloc.  If an error occurs
  1531.    or the transfer is unsupported, NULL is returned.  Empty objects
  1532.    are returned as allocated but empty strings.  A warning is issued
  1533.    if the result contains any embedded NUL bytes.  */
  1534. extern char *target_fileio_read_stralloc (const char *filename);


  1535. /* Tracepoint-related operations.  */

  1536. #define target_trace_init() \
  1537.   (*current_target.to_trace_init) (&current_target)

  1538. #define target_download_tracepoint(t) \
  1539.   (*current_target.to_download_tracepoint) (&current_target, t)

  1540. #define target_can_download_tracepoint() \
  1541.   (*current_target.to_can_download_tracepoint) (&current_target)

  1542. #define target_download_trace_state_variable(tsv) \
  1543.   (*current_target.to_download_trace_state_variable) (&current_target, tsv)

  1544. #define target_enable_tracepoint(loc) \
  1545.   (*current_target.to_enable_tracepoint) (&current_target, loc)

  1546. #define target_disable_tracepoint(loc) \
  1547.   (*current_target.to_disable_tracepoint) (&current_target, loc)

  1548. #define target_trace_start() \
  1549.   (*current_target.to_trace_start) (&current_target)

  1550. #define target_trace_set_readonly_regions() \
  1551.   (*current_target.to_trace_set_readonly_regions) (&current_target)

  1552. #define target_get_trace_status(ts) \
  1553.   (*current_target.to_get_trace_status) (&current_target, ts)

  1554. #define target_get_tracepoint_status(tp,utp)                \
  1555.   (*current_target.to_get_tracepoint_status) (&current_target, tp, utp)

  1556. #define target_trace_stop() \
  1557.   (*current_target.to_trace_stop) (&current_target)

  1558. #define target_trace_find(type,num,addr1,addr2,tpp) \
  1559.   (*current_target.to_trace_find) (&current_target, \
  1560.                                    (type), (num), (addr1), (addr2), (tpp))

  1561. #define target_get_trace_state_variable_value(tsv,val) \
  1562.   (*current_target.to_get_trace_state_variable_value) (&current_target,        \
  1563.                                                        (tsv), (val))

  1564. #define target_save_trace_data(filename) \
  1565.   (*current_target.to_save_trace_data) (&current_target, filename)

  1566. #define target_upload_tracepoints(utpp) \
  1567.   (*current_target.to_upload_tracepoints) (&current_target, utpp)

  1568. #define target_upload_trace_state_variables(utsvp) \
  1569.   (*current_target.to_upload_trace_state_variables) (&current_target, utsvp)

  1570. #define target_get_raw_trace_data(buf,offset,len) \
  1571.   (*current_target.to_get_raw_trace_data) (&current_target,        \
  1572.                                            (buf), (offset), (len))

  1573. #define target_get_min_fast_tracepoint_insn_len() \
  1574.   (*current_target.to_get_min_fast_tracepoint_insn_len) (&current_target)

  1575. #define target_set_disconnected_tracing(val) \
  1576.   (*current_target.to_set_disconnected_tracing) (&current_target, val)

  1577. #define        target_set_circular_trace_buffer(val)        \
  1578.   (*current_target.to_set_circular_trace_buffer) (&current_target, val)

  1579. #define        target_set_trace_buffer_size(val)        \
  1580.   (*current_target.to_set_trace_buffer_size) (&current_target, val)

  1581. #define        target_set_trace_notes(user,notes,stopnotes)                \
  1582.   (*current_target.to_set_trace_notes) (&current_target,        \
  1583.                                         (user), (notes), (stopnotes))

  1584. #define target_get_tib_address(ptid, addr) \
  1585.   (*current_target.to_get_tib_address) (&current_target, (ptid), (addr))

  1586. #define target_set_permissions() \
  1587.   (*current_target.to_set_permissions) (&current_target)

  1588. #define target_static_tracepoint_marker_at(addr, marker) \
  1589.   (*current_target.to_static_tracepoint_marker_at) (&current_target,        \
  1590.                                                     addr, marker)

  1591. #define target_static_tracepoint_markers_by_strid(marker_id) \
  1592.   (*current_target.to_static_tracepoint_markers_by_strid) (&current_target, \
  1593.                                                            marker_id)

  1594. #define target_traceframe_info() \
  1595.   (*current_target.to_traceframe_info) (&current_target)

  1596. #define target_use_agent(use) \
  1597.   (*current_target.to_use_agent) (&current_target, use)

  1598. #define target_can_use_agent() \
  1599.   (*current_target.to_can_use_agent) (&current_target)

  1600. #define target_augmented_libraries_svr4_read() \
  1601.   (*current_target.to_augmented_libraries_svr4_read) (&current_target)

  1602. /* Command logging facility.  */

  1603. #define target_log_command(p)                                        \
  1604.   (*current_target.to_log_command) (&current_target, p)


  1605. extern int target_core_of_thread (ptid_t ptid);

  1606. /* See to_get_unwinder in struct target_ops.  */
  1607. extern const struct frame_unwind *target_get_unwinder (void);

  1608. /* See to_get_tailcall_unwinder in struct target_ops.  */
  1609. extern const struct frame_unwind *target_get_tailcall_unwinder (void);

  1610. /* This implements basic memory verification, reading target memory
  1611.    and performing the comparison here (as opposed to accelerated
  1612.    verification making use of the qCRC packet, for example).  */

  1613. extern int simple_verify_memory (struct target_ops* ops,
  1614.                                  const gdb_byte *data,
  1615.                                  CORE_ADDR memaddr, ULONGEST size);

  1616. /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range matches
  1617.    the contents of [DATA,DATA+SIZE).  Returns 1 if there's a match, 0
  1618.    if there's a mismatch, and -1 if an error is encountered while
  1619.    reading memory.  Throws an error if the functionality is found not
  1620.    to be supported by the current target.  */
  1621. int target_verify_memory (const gdb_byte *data,
  1622.                           CORE_ADDR memaddr, ULONGEST size);

  1623. /* Routines for maintenance of the target structures...

  1624.    complete_target_initialization: Finalize a target_ops by filling in
  1625.    any fields needed by the target implementation.  Unnecessary for
  1626.    targets which are registered via add_target, as this part gets
  1627.    taken care of then.

  1628.    add_target:   Add a target to the list of all possible targets.
  1629.    This only makes sense for targets that should be activated using
  1630.    the "target TARGET_NAME ..." command.

  1631.    push_target:  Make this target the top of the stack of currently used
  1632.    targets, within its particular stratum of the stack.  Result
  1633.    is 0 if now atop the stack, nonzero if not on top (maybe
  1634.    should warn user).

  1635.    unpush_target: Remove this from the stack of currently used targets,
  1636.    no matter where it is on the list.  Returns 0 if no
  1637.    change, 1 if removed from stack.  */

  1638. extern void add_target (struct target_ops *);

  1639. extern void add_target_with_completer (struct target_ops *t,
  1640.                                        completer_ftype *completer);

  1641. extern void complete_target_initialization (struct target_ops *t);

  1642. /* Adds a command ALIAS for target T and marks it deprecated.  This is useful
  1643.    for maintaining backwards compatibility when renaming targets.  */

  1644. extern void add_deprecated_target_alias (struct target_ops *t, char *alias);

  1645. extern void push_target (struct target_ops *);

  1646. extern int unpush_target (struct target_ops *);

  1647. extern void target_pre_inferior (int);

  1648. extern void target_preopen (int);

  1649. /* Does whatever cleanup is required to get rid of all pushed targets.  */
  1650. extern void pop_all_targets (void);

  1651. /* Like pop_all_targets, but pops only targets whose stratum is
  1652.    strictly above ABOVE_STRATUM.  */
  1653. extern void pop_all_targets_above (enum strata above_stratum);

  1654. extern int target_is_pushed (struct target_ops *t);

  1655. extern CORE_ADDR target_translate_tls_address (struct objfile *objfile,
  1656.                                                CORE_ADDR offset);

  1657. /* Struct target_section maps address ranges to file sections.  It is
  1658.    mostly used with BFD files, but can be used without (e.g. for handling
  1659.    raw disks, or files not in formats handled by BFD).  */

  1660. struct target_section
  1661.   {
  1662.     CORE_ADDR addr;                /* Lowest address in section */
  1663.     CORE_ADDR endaddr;                /* 1+highest address in section */

  1664.     struct bfd_section *the_bfd_section;

  1665.     /* The "owner" of the section.
  1666.        It can be any unique value.  It is set by add_target_sections
  1667.        and used by remove_target_sections.
  1668.        For example, for executables it is a pointer to exec_bfd and
  1669.        for shlibs it is the so_list pointer.  */
  1670.     void *owner;
  1671.   };

  1672. /* Holds an array of target sections.  Defined by [SECTIONS..SECTIONS_END[.  */

  1673. struct target_section_table
  1674. {
  1675.   struct target_section *sections;
  1676.   struct target_section *sections_end;
  1677. };

  1678. /* Return the "section" containing the specified address.  */
  1679. struct target_section *target_section_by_addr (struct target_ops *target,
  1680.                                                CORE_ADDR addr);

  1681. /* Return the target section table this target (or the targets
  1682.    beneath) currently manipulate.  */

  1683. extern struct target_section_table *target_get_section_table
  1684.   (struct target_ops *target);

  1685. /* From mem-break.c */

  1686. extern int memory_remove_breakpoint (struct target_ops *, struct gdbarch *,
  1687.                                      struct bp_target_info *);

  1688. extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *,
  1689.                                      struct bp_target_info *);

  1690. /* Check whether the memory at the breakpoint's placed address still
  1691.    contains the expected breakpoint instruction.  */

  1692. extern int memory_validate_breakpoint (struct gdbarch *gdbarch,
  1693.                                        struct bp_target_info *bp_tgt);

  1694. extern int default_memory_remove_breakpoint (struct gdbarch *,
  1695.                                              struct bp_target_info *);

  1696. extern int default_memory_insert_breakpoint (struct gdbarch *,
  1697.                                              struct bp_target_info *);


  1698. /* From target.c */

  1699. extern void initialize_targets (void);

  1700. extern void noprocess (void) ATTRIBUTE_NORETURN;

  1701. extern void target_require_runnable (void);

  1702. extern void find_default_attach (struct target_ops *, const char *, int);

  1703. extern void find_default_create_inferior (struct target_ops *,
  1704.                                           char *, char *, char **, int);

  1705. extern struct target_ops *find_target_beneath (struct target_ops *);

  1706. /* Find the target at STRATUM.  If no target is at that stratum,
  1707.    return NULL.  */

  1708. struct target_ops *find_target_at (enum strata stratum);

  1709. /* Read OS data object of type TYPE from the target, and return it in
  1710.    XML format.  The result is NUL-terminated and returned as a string,
  1711.    allocated using xmalloc.  If an error occurs or the transfer is
  1712.    unsupported, NULL is returned.  Empty objects are returned as
  1713.    allocated but empty strings.  */

  1714. extern char *target_get_osdata (const char *type);


  1715. /* Stuff that should be shared among the various remote targets.  */

  1716. /* Debugging level.  0 is off, and non-zero values mean to print some debug
  1717.    information (higher values, more information).  */
  1718. extern int remote_debug;

  1719. /* Speed in bits per second, or -1 which means don't mess with the speed.  */
  1720. extern int baud_rate;
  1721. /* Timeout limit for response from target.  */
  1722. extern int remote_timeout;



  1723. /* Set the show memory breakpoints mode to show, and installs a cleanup
  1724.    to restore it back to the current value.  */
  1725. extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);

  1726. extern int may_write_registers;
  1727. extern int may_write_memory;
  1728. extern int may_insert_breakpoints;
  1729. extern int may_insert_tracepoints;
  1730. extern int may_insert_fast_tracepoints;
  1731. extern int may_stop;

  1732. extern void update_target_permissions (void);


  1733. /* Imported from machine dependent code.  */

  1734. /* See to_supports_btrace in struct target_ops.  */
  1735. #define target_supports_btrace() \
  1736.   (current_target.to_supports_btrace (&current_target))

  1737. /* See to_enable_btrace in struct target_ops.  */
  1738. extern struct btrace_target_info *target_enable_btrace (ptid_t ptid);

  1739. /* See to_disable_btrace in struct target_ops.  */
  1740. extern void target_disable_btrace (struct btrace_target_info *btinfo);

  1741. /* See to_teardown_btrace in struct target_ops.  */
  1742. extern void target_teardown_btrace (struct btrace_target_info *btinfo);

  1743. /* See to_read_btrace in struct target_ops.  */
  1744. extern enum btrace_error target_read_btrace (VEC (btrace_block_s) **,
  1745.                                              struct btrace_target_info *,
  1746.                                              enum btrace_read_type);

  1747. /* See to_stop_recording in struct target_ops.  */
  1748. extern void target_stop_recording (void);

  1749. /* See to_save_record in struct target_ops.  */
  1750. extern void target_save_record (const char *filename);

  1751. /* Query if the target supports deleting the execution log.  */
  1752. extern int target_supports_delete_record (void);

  1753. /* See to_delete_record in struct target_ops.  */
  1754. extern void target_delete_record (void);

  1755. /* See to_record_is_replaying in struct target_ops.  */
  1756. extern int target_record_is_replaying (void);

  1757. /* See to_goto_record_begin in struct target_ops.  */
  1758. extern void target_goto_record_begin (void);

  1759. /* See to_goto_record_end in struct target_ops.  */
  1760. extern void target_goto_record_end (void);

  1761. /* See to_goto_record in struct target_ops.  */
  1762. extern void target_goto_record (ULONGEST insn);

  1763. /* See to_insn_history.  */
  1764. extern void target_insn_history (int size, int flags);

  1765. /* See to_insn_history_from.  */
  1766. extern void target_insn_history_from (ULONGEST from, int size, int flags);

  1767. /* See to_insn_history_range.  */
  1768. extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags);

  1769. /* See to_call_history.  */
  1770. extern void target_call_history (int size, int flags);

  1771. /* See to_call_history_from.  */
  1772. extern void target_call_history_from (ULONGEST begin, int size, int flags);

  1773. /* See to_call_history_range.  */
  1774. extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags);

  1775. /* See to_decr_pc_after_break.  Start searching for the target at OPS.  */
  1776. extern CORE_ADDR forward_target_decr_pc_after_break (struct target_ops *ops,
  1777.                                                      struct gdbarch *gdbarch);

  1778. /* See to_decr_pc_after_break.  */
  1779. extern CORE_ADDR target_decr_pc_after_break (struct gdbarch *gdbarch);

  1780. /* See to_prepare_to_generate_core.  */
  1781. extern void target_prepare_to_generate_core (void);

  1782. /* See to_done_generating_core.  */
  1783. extern void target_done_generating_core (void);

  1784. #endif /* !defined (TARGET_H) */