import gdb-1999-09-28 snapshot
[deliverable/binutils-gdb.git] / gdb / target.h
index c8c9bb52b4fbd040e74d42d178d36ccd1d0d66d9..5439fac9da7d92637a016773e8193def398b9904 100644 (file)
@@ -2,21 +2,22 @@
    Copyright 1990, 91, 92, 93, 94, 1999 Free Software Foundation, Inc.
    Contributed by Cygnus Support.  Written by John Gilmore.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #if !defined (TARGET_H)
 #define TARGET_H
@@ -43,72 +44,81 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "bfd.h"
 #include "symtab.h"
 
-enum strata {
-       dummy_stratum,          /* The lowest of the low */
-       file_stratum,           /* Executable files, etc */
-       core_stratum,           /* Core dump files */
-       download_stratum,       /* Downloading of remote targets */
-       process_stratum         /* Executing processes */
-};
+enum strata
+  {
+    dummy_stratum,             /* The lowest of the low */
+    file_stratum,              /* Executable files, etc */
+    core_stratum,              /* Core dump files */
+    download_stratum,          /* Downloading of remote targets */
+    process_stratum,           /* Executing processes */
+    thread_stratum             /* Executing threads */
+  };
 
-enum thread_control_capabilities {
-       tc_none = 0,            /* Default: can't control thread execution. */
-       tc_schedlock = 1,       /* Can lock the thread scheduler. */
-       tc_switch = 2           /* Can switch the running thread on demand. */
-};
+enum thread_control_capabilities
+  {
+    tc_none = 0,               /* Default: can't control thread execution. */
+    tc_schedlock = 1,          /* Can lock the thread scheduler. */
+    tc_switch = 2              /* Can switch the running thread on demand. */
+  };
 
 /* Stuff for target_wait.  */
 
 /* Generally, what has the program done?  */
-enum target_waitkind {
-  /* The program has exited.  The exit status is in value.integer.  */
-  TARGET_WAITKIND_EXITED,
+enum target_waitkind
+  {
+    /* The program has exited.  The exit status is in value.integer.  */
+    TARGET_WAITKIND_EXITED,
 
-  /* The program has stopped with a signal.  Which signal is in value.sig.  */
-  TARGET_WAITKIND_STOPPED,
+    /* The program has stopped with a signal.  Which signal is in value.sig.  */
+    TARGET_WAITKIND_STOPPED,
 
-  /* The program has terminated with a signal.  Which signal is in
-     value.sig.  */
-  TARGET_WAITKIND_SIGNALLED,
+    /* The program has terminated with a signal.  Which signal is in
+       value.sig.  */
+    TARGET_WAITKIND_SIGNALLED,
 
-  /* The program is letting us know that it dynamically loaded something
-     (e.g. it called load(2) on AIX).  */
-  TARGET_WAITKIND_LOADED,
+    /* The program is letting us know that it dynamically loaded something
+       (e.g. it called load(2) on AIX).  */
+    TARGET_WAITKIND_LOADED,
 
-  /* The program has forked.  A "related" process' ID is in value.related_pid.
-     I.e., if the child forks, value.related_pid is the parent's ID.
+    /* The program has forked.  A "related" process' ID is in value.related_pid.
+       I.e., if the child forks, value.related_pid is the parent's ID.
      */
-  TARGET_WAITKIND_FORKED,
+    TARGET_WAITKIND_FORKED,
 
-  /* The program has vforked.  A "related" process's ID is in value.related_pid.
+    /* The program has vforked.  A "related" process's ID is in value.related_pid.
      */
-  TARGET_WAITKIND_VFORKED,
+    TARGET_WAITKIND_VFORKED,
 
-  /* The program has exec'ed a new executable file.  The new file's pathname
-     is pointed to by value.execd_pathname.
+    /* The program has exec'ed a new executable file.  The new file's pathname
+       is pointed to by value.execd_pathname.
      */
-  TARGET_WAITKIND_EXECD,
+    TARGET_WAITKIND_EXECD,
 
-  /* The program has entered or returned from a system call.  On HP-UX, this
-     is used in the hardware watchpoint implementation.  The syscall's unique
-     integer ID number is in value.syscall_id;
+    /* The program has entered or returned from a system call.  On HP-UX, this
+       is used in the hardware watchpoint implementation.  The syscall's unique
+       integer ID number is in value.syscall_id;
      */
-  TARGET_WAITKIND_SYSCALL_ENTRY,
-  TARGET_WAITKIND_SYSCALL_RETURN,
+    TARGET_WAITKIND_SYSCALL_ENTRY,
+    TARGET_WAITKIND_SYSCALL_RETURN,
 
-  /* Nothing happened, but we stopped anyway.  This perhaps should be handled
-     within target_wait, but I'm not sure target_wait should be resuming the
-     inferior.  */
-  TARGET_WAITKIND_SPURIOUS
+    /* Nothing happened, but we stopped anyway.  This perhaps should be handled
+       within target_wait, but I'm not sure target_wait should be resuming the
+       inferior.  */
+    TARGET_WAITKIND_SPURIOUS
   };
 
 /* The numbering of these signals is chosen to match traditional unix
    signals (insofar as various unices use the same numbers, anyway).
    It is also the numbering of the GDB remote protocol.  Other remote
    protocols, if they use a different numbering, should make sure to
-   translate appropriately.  */
+   translate appropriately.
 
-/* This is based strongly on Unix/POSIX signals for several reasons:
+   Since these numbers have actually made it out into other software
+   (stubs, etc.), you mustn't disturb the assigned numbering.  If you
+   need to add new signals here, add them to the end of the explicitly
+   numbered signals.
+
+   This is based strongly on Unix/POSIX signals for several reasons:
    (1) This set of signals represents a widely-accepted attempt to
    represent events of this sort in a portable fashion, (2) we want a
    signal to make it from wait to child_wait to the user intact, (3) many
@@ -124,121 +134,135 @@ enum target_waitkind {
 /* For an explanation of what each signal means, see
    target_signal_to_string.  */
 
-enum target_signal {
-  /* Used some places (e.g. stop_signal) to record the concept that
-     there is no signal.  */
-  TARGET_SIGNAL_0 = 0,
-  TARGET_SIGNAL_FIRST = 0,
-  TARGET_SIGNAL_HUP = 1,
-  TARGET_SIGNAL_INT = 2,
-  TARGET_SIGNAL_QUIT = 3,
-  TARGET_SIGNAL_ILL = 4,
-  TARGET_SIGNAL_TRAP = 5,
-  TARGET_SIGNAL_ABRT = 6,
-  TARGET_SIGNAL_EMT = 7,
-  TARGET_SIGNAL_FPE = 8,
-  TARGET_SIGNAL_KILL = 9,
-  TARGET_SIGNAL_BUS = 10,
-  TARGET_SIGNAL_SEGV = 11,
-  TARGET_SIGNAL_SYS = 12,
-  TARGET_SIGNAL_PIPE = 13,
-  TARGET_SIGNAL_ALRM = 14,
-  TARGET_SIGNAL_TERM = 15,
-  TARGET_SIGNAL_URG = 16,
-  TARGET_SIGNAL_STOP = 17,
-  TARGET_SIGNAL_TSTP = 18,
-  TARGET_SIGNAL_CONT = 19,
-  TARGET_SIGNAL_CHLD = 20,
-  TARGET_SIGNAL_TTIN = 21,
-  TARGET_SIGNAL_TTOU = 22,
-  TARGET_SIGNAL_IO = 23,
-  TARGET_SIGNAL_XCPU = 24,
-  TARGET_SIGNAL_XFSZ = 25,
-  TARGET_SIGNAL_VTALRM = 26,
-  TARGET_SIGNAL_PROF = 27,
-  TARGET_SIGNAL_WINCH = 28,
-  TARGET_SIGNAL_LOST = 29,
-  TARGET_SIGNAL_USR1 = 30,
-  TARGET_SIGNAL_USR2 = 31,
-  TARGET_SIGNAL_PWR = 32,
-  /* Similar to SIGIO.  Perhaps they should have the same number.  */
-  TARGET_SIGNAL_POLL = 33,
-  TARGET_SIGNAL_WIND = 34,
-  TARGET_SIGNAL_PHONE = 35,
-  TARGET_SIGNAL_WAITING = 36,
-  TARGET_SIGNAL_LWP = 37,
-  TARGET_SIGNAL_DANGER = 38,
-  TARGET_SIGNAL_GRANT = 39,
-  TARGET_SIGNAL_RETRACT = 40,
-  TARGET_SIGNAL_MSG = 41,
-  TARGET_SIGNAL_SOUND = 42,
-  TARGET_SIGNAL_SAK = 43,
-  TARGET_SIGNAL_PRIO = 44,
-  TARGET_SIGNAL_REALTIME_33 = 45,
-  TARGET_SIGNAL_REALTIME_34 = 46,
-  TARGET_SIGNAL_REALTIME_35 = 47,
-  TARGET_SIGNAL_REALTIME_36 = 48,
-  TARGET_SIGNAL_REALTIME_37 = 49,
-  TARGET_SIGNAL_REALTIME_38 = 50,
-  TARGET_SIGNAL_REALTIME_39 = 51,
-  TARGET_SIGNAL_REALTIME_40 = 52,
-  TARGET_SIGNAL_REALTIME_41 = 53,
-  TARGET_SIGNAL_REALTIME_42 = 54,
-  TARGET_SIGNAL_REALTIME_43 = 55,
-  TARGET_SIGNAL_REALTIME_44 = 56,
-  TARGET_SIGNAL_REALTIME_45 = 57,
-  TARGET_SIGNAL_REALTIME_46 = 58,
-  TARGET_SIGNAL_REALTIME_47 = 59,
-  TARGET_SIGNAL_REALTIME_48 = 60,
-  TARGET_SIGNAL_REALTIME_49 = 61,
-  TARGET_SIGNAL_REALTIME_50 = 62,
-  TARGET_SIGNAL_REALTIME_51 = 63,
-  TARGET_SIGNAL_REALTIME_52 = 64,
-  TARGET_SIGNAL_REALTIME_53 = 65,
-  TARGET_SIGNAL_REALTIME_54 = 66,
-  TARGET_SIGNAL_REALTIME_55 = 67,
-  TARGET_SIGNAL_REALTIME_56 = 68,
-  TARGET_SIGNAL_REALTIME_57 = 69,
-  TARGET_SIGNAL_REALTIME_58 = 70,
-  TARGET_SIGNAL_REALTIME_59 = 71,
-  TARGET_SIGNAL_REALTIME_60 = 72,
-  TARGET_SIGNAL_REALTIME_61 = 73,
-  TARGET_SIGNAL_REALTIME_62 = 74,
-  TARGET_SIGNAL_REALTIME_63 = 75,
+enum target_signal
+  {
+    /* Used some places (e.g. stop_signal) to record the concept that
+       there is no signal.  */
+    TARGET_SIGNAL_0 = 0,
+    TARGET_SIGNAL_FIRST = 0,
+    TARGET_SIGNAL_HUP = 1,
+    TARGET_SIGNAL_INT = 2,
+    TARGET_SIGNAL_QUIT = 3,
+    TARGET_SIGNAL_ILL = 4,
+    TARGET_SIGNAL_TRAP = 5,
+    TARGET_SIGNAL_ABRT = 6,
+    TARGET_SIGNAL_EMT = 7,
+    TARGET_SIGNAL_FPE = 8,
+    TARGET_SIGNAL_KILL = 9,
+    TARGET_SIGNAL_BUS = 10,
+    TARGET_SIGNAL_SEGV = 11,
+    TARGET_SIGNAL_SYS = 12,
+    TARGET_SIGNAL_PIPE = 13,
+    TARGET_SIGNAL_ALRM = 14,
+    TARGET_SIGNAL_TERM = 15,
+    TARGET_SIGNAL_URG = 16,
+    TARGET_SIGNAL_STOP = 17,
+    TARGET_SIGNAL_TSTP = 18,
+    TARGET_SIGNAL_CONT = 19,
+    TARGET_SIGNAL_CHLD = 20,
+    TARGET_SIGNAL_TTIN = 21,
+    TARGET_SIGNAL_TTOU = 22,
+    TARGET_SIGNAL_IO = 23,
+    TARGET_SIGNAL_XCPU = 24,
+    TARGET_SIGNAL_XFSZ = 25,
+    TARGET_SIGNAL_VTALRM = 26,
+    TARGET_SIGNAL_PROF = 27,
+    TARGET_SIGNAL_WINCH = 28,
+    TARGET_SIGNAL_LOST = 29,
+    TARGET_SIGNAL_USR1 = 30,
+    TARGET_SIGNAL_USR2 = 31,
+    TARGET_SIGNAL_PWR = 32,
+    /* Similar to SIGIO.  Perhaps they should have the same number.  */
+    TARGET_SIGNAL_POLL = 33,
+    TARGET_SIGNAL_WIND = 34,
+    TARGET_SIGNAL_PHONE = 35,
+    TARGET_SIGNAL_WAITING = 36,
+    TARGET_SIGNAL_LWP = 37,
+    TARGET_SIGNAL_DANGER = 38,
+    TARGET_SIGNAL_GRANT = 39,
+    TARGET_SIGNAL_RETRACT = 40,
+    TARGET_SIGNAL_MSG = 41,
+    TARGET_SIGNAL_SOUND = 42,
+    TARGET_SIGNAL_SAK = 43,
+    TARGET_SIGNAL_PRIO = 44,
+    TARGET_SIGNAL_REALTIME_33 = 45,
+    TARGET_SIGNAL_REALTIME_34 = 46,
+    TARGET_SIGNAL_REALTIME_35 = 47,
+    TARGET_SIGNAL_REALTIME_36 = 48,
+    TARGET_SIGNAL_REALTIME_37 = 49,
+    TARGET_SIGNAL_REALTIME_38 = 50,
+    TARGET_SIGNAL_REALTIME_39 = 51,
+    TARGET_SIGNAL_REALTIME_40 = 52,
+    TARGET_SIGNAL_REALTIME_41 = 53,
+    TARGET_SIGNAL_REALTIME_42 = 54,
+    TARGET_SIGNAL_REALTIME_43 = 55,
+    TARGET_SIGNAL_REALTIME_44 = 56,
+    TARGET_SIGNAL_REALTIME_45 = 57,
+    TARGET_SIGNAL_REALTIME_46 = 58,
+    TARGET_SIGNAL_REALTIME_47 = 59,
+    TARGET_SIGNAL_REALTIME_48 = 60,
+    TARGET_SIGNAL_REALTIME_49 = 61,
+    TARGET_SIGNAL_REALTIME_50 = 62,
+    TARGET_SIGNAL_REALTIME_51 = 63,
+    TARGET_SIGNAL_REALTIME_52 = 64,
+    TARGET_SIGNAL_REALTIME_53 = 65,
+    TARGET_SIGNAL_REALTIME_54 = 66,
+    TARGET_SIGNAL_REALTIME_55 = 67,
+    TARGET_SIGNAL_REALTIME_56 = 68,
+    TARGET_SIGNAL_REALTIME_57 = 69,
+    TARGET_SIGNAL_REALTIME_58 = 70,
+    TARGET_SIGNAL_REALTIME_59 = 71,
+    TARGET_SIGNAL_REALTIME_60 = 72,
+    TARGET_SIGNAL_REALTIME_61 = 73,
+    TARGET_SIGNAL_REALTIME_62 = 74,
+    TARGET_SIGNAL_REALTIME_63 = 75,
+
+    /* Used internally by Solaris threads.  See signal(5) on Solaris.  */
+    TARGET_SIGNAL_CANCEL = 76,
+
+    /* Yes, this pains me, too.  But LynxOS didn't have SIG32, and now
+       Linux does, and we can't disturb the numbering, since it's part
+       of the protocol.  Note that in some GDB's TARGET_SIGNAL_REALTIME_32
+       is number 76.  */
+    TARGET_SIGNAL_REALTIME_32,
+
 #if defined(MACH) || defined(__MACH__)
-  /* Mach exceptions */
-  TARGET_EXC_BAD_ACCESS,
-  TARGET_EXC_BAD_INSTRUCTION,
-  TARGET_EXC_ARITHMETIC,
-  TARGET_EXC_EMULATION,
-  TARGET_EXC_SOFTWARE,
-  TARGET_EXC_BREAKPOINT,
+    /* Mach exceptions */
+    TARGET_EXC_BAD_ACCESS,
+    TARGET_EXC_BAD_INSTRUCTION,
+    TARGET_EXC_ARITHMETIC,
+    TARGET_EXC_EMULATION,
+    TARGET_EXC_SOFTWARE,
+    TARGET_EXC_BREAKPOINT,
 #endif
-  TARGET_SIGNAL_INFO,
+    TARGET_SIGNAL_INFO,
 
-  /* Some signal we don't know about.  */
-  TARGET_SIGNAL_UNKNOWN,
+    /* Some signal we don't know about.  */
+    TARGET_SIGNAL_UNKNOWN,
 
-  /* Use whatever signal we use when one is not specifically specified
-     (for passing to proceed and so on).  */
-  TARGET_SIGNAL_DEFAULT,
+    /* Use whatever signal we use when one is not specifically specified
+       (for passing to proceed and so on).  */
+    TARGET_SIGNAL_DEFAULT,
 
-  /* Last and unused enum value, for sizing arrays, etc.  */
-  TARGET_SIGNAL_LAST
-};
-
-struct target_waitstatus {
-  enum target_waitkind kind;
+    /* Last and unused enum value, for sizing arrays, etc.  */
+    TARGET_SIGNAL_LAST
+  };
 
-  /* Forked child pid, execd pathname, exit status or signal number.  */
-  union {
-    int integer;
-    enum target_signal sig;
-    int  related_pid;
-    char *  execd_pathname;
-    int  syscall_id;
-  } value;
-};
+struct target_waitstatus
+  {
+    enum target_waitkind kind;
+
+    /* Forked child pid, execd pathname, exit status or signal number.  */
+    union
+      {
+       int integer;
+       enum target_signal sig;
+       int related_pid;
+       char *execd_pathname;
+       int syscall_id;
+      }
+    value;
+  };
 
 /* Return the string for a signal.  */
 extern char *target_signal_to_string PARAMS ((enum target_signal));
@@ -248,8 +272,8 @@ extern char *target_signal_to_name PARAMS ((enum target_signal));
 
 /* Given a name (SIGHUP, etc.), return its signal.  */
 enum target_signal target_signal_from_name PARAMS ((char *));
-
 \f
+
 /* If certain kinds of activity happen, target_wait should perform
    callbacks.  */
 /* Right now we just call (*TARGET_ACTIVITY_FUNCTION) if I/O is possible
@@ -259,125 +283,131 @@ extern int target_activity_fd;
 extern int (*target_activity_function) PARAMS ((void));
 \f
 struct target_ops
-{
-  char        *to_shortname;   /* Name this target type */
-  char        *to_longname;    /* Name for printing */
-  char                *to_doc;         /* Documentation.  Does not include trailing
+  {
+    char *to_shortname;                /* Name this target type */
+    char *to_longname;         /* Name for printing */
+    char *to_doc;              /* Documentation.  Does not include trailing
                                   newline, and starts with a one-line descrip-
                                   tion (probably similar to to_longname). */
-  void               (*to_open) PARAMS ((char *, int));
-  void               (*to_close) PARAMS ((int));
-  void               (*to_attach) PARAMS ((char *, int));
-  void        (*to_post_attach) PARAMS ((int));
-  void               (*to_require_attach) PARAMS ((char *, int));
-  void               (*to_detach) PARAMS ((char *, int));
-  void               (*to_require_detach) PARAMS ((int, char *, int));
-  void               (*to_resume) PARAMS ((int, int, enum target_signal));
-  int                (*to_wait) PARAMS ((int, struct target_waitstatus *));
-  void        (*to_post_wait) PARAMS ((int, int));
-  void               (*to_fetch_registers) PARAMS ((int));
-  void               (*to_store_registers) PARAMS ((int));
-  void               (*to_prepare_to_store) PARAMS ((void));
-
-  /* Transfer LEN bytes of memory between GDB address MYADDR and
-     target address MEMADDR.  If WRITE, transfer them to the target, else
-     transfer them from the target.  TARGET is the target from which we
-     get this function.
-
-     Return value, N, is one of the following:
-
-     0 means that we can't handle this.  If errno has been set, it is the
-     error which prevented us from doing it (FIXME: What about bfd_error?).
-
-     positive (call it N) means that we have transferred N bytes
-     starting at MEMADDR.  We might be able to handle more bytes
-     beyond this length, but no promises.
-
-     negative (call its absolute value N) means that we cannot
-     transfer right at MEMADDR, but we could transfer at least
-     something at MEMADDR + N.  */
-
-  int                (*to_xfer_memory) PARAMS ((CORE_ADDR memaddr, char *myaddr,
-                                        int len, int write,
-                                        struct target_ops * target));
+    void (*to_open) PARAMS ((char *, int));
+    void (*to_close) PARAMS ((int));
+    void (*to_attach) PARAMS ((char *, int));
+    void (*to_post_attach) PARAMS ((int));
+    void (*to_require_attach) PARAMS ((char *, int));
+    void (*to_detach) PARAMS ((char *, int));
+    void (*to_require_detach) PARAMS ((int, char *, int));
+    void (*to_resume) PARAMS ((int, int, enum target_signal));
+    int (*to_wait) PARAMS ((int, struct target_waitstatus *));
+    void (*to_post_wait) PARAMS ((int, int));
+    void (*to_fetch_registers) PARAMS ((int));
+    void (*to_store_registers) PARAMS ((int));
+    void (*to_prepare_to_store) PARAMS ((void));
+
+    /* Transfer LEN bytes of memory between GDB address MYADDR and
+       target address MEMADDR.  If WRITE, transfer them to the target, else
+       transfer them from the target.  TARGET is the target from which we
+       get this function.
+
+       Return value, N, is one of the following:
+
+       0 means that we can't handle this.  If errno has been set, it is the
+       error which prevented us from doing it (FIXME: What about bfd_error?).
+
+       positive (call it N) means that we have transferred N bytes
+       starting at MEMADDR.  We might be able to handle more bytes
+       beyond this length, but no promises.
+
+       negative (call its absolute value N) means that we cannot
+       transfer right at MEMADDR, but we could transfer at least
+       something at MEMADDR + N.  */
+
+    int (*to_xfer_memory) PARAMS ((CORE_ADDR memaddr, char *myaddr,
+                                  int len, int write,
+                                  struct target_ops * target));
 
 #if 0
-  /* Enable this after 4.12.  */
+    /* Enable this after 4.12.  */
 
-  /* Search target memory.  Start at STARTADDR and take LEN bytes of
-     target memory, and them with MASK, and compare to DATA.  If they
-     match, set *ADDR_FOUND to the address we found it at, store the data
-     we found at LEN bytes starting at DATA_FOUND, and return.  If
-     not, add INCREMENT to the search address and keep trying until
-     the search address is outside of the range [LORANGE,HIRANGE).
+    /* Search target memory.  Start at STARTADDR and take LEN bytes of
+       target memory, and them with MASK, and compare to DATA.  If they
+       match, set *ADDR_FOUND to the address we found it at, store the data
+       we found at LEN bytes starting at DATA_FOUND, and return.  If
+       not, add INCREMENT to the search address and keep trying until
+       the search address is outside of the range [LORANGE,HIRANGE).
 
-     If we don't find anything, set *ADDR_FOUND to (CORE_ADDR)0 and return.  */
-  void (*to_search) PARAMS ((int len, char *data, char *mask,
-                            CORE_ADDR startaddr, int increment,
-                            CORE_ADDR lorange, CORE_ADDR hirange,
-                            CORE_ADDR *addr_found, char *data_found));
+       If we don't find anything, set *ADDR_FOUND to (CORE_ADDR)0 and return.  */
+    void (*to_search) PARAMS ((int len, char *data, char *mask,
+                              CORE_ADDR startaddr, int increment,
+                              CORE_ADDR lorange, CORE_ADDR hirange,
+                              CORE_ADDR * addr_found, char *data_found));
 
 #define        target_search(len, data, mask, startaddr, increment, lorange, hirange, addr_found, data_found)  \
   (*current_target.to_search) (len, data, mask, startaddr, increment, \
                                lorange, hirange, addr_found, data_found)
-#endif /* 0 */
-
-  void               (*to_files_info) PARAMS ((struct target_ops *));
-  int                (*to_insert_breakpoint) PARAMS ((CORE_ADDR, char *));
-  int        (*to_remove_breakpoint) PARAMS ((CORE_ADDR, char *));
-  void               (*to_terminal_init) PARAMS ((void));
-  void               (*to_terminal_inferior) PARAMS ((void));
-  void               (*to_terminal_ours_for_output) PARAMS ((void));
-  void               (*to_terminal_ours) PARAMS ((void));
-  void               (*to_terminal_info) PARAMS ((char *, int));
-  void               (*to_kill) PARAMS ((void));
-  void               (*to_load) PARAMS ((char *, int));
-  int        (*to_lookup_symbol) PARAMS ((char *, CORE_ADDR *));
-  void               (*to_create_inferior) PARAMS ((char *, char *, char **));
-  void        (*to_post_startup_inferior) PARAMS ((int));
-  void        (*to_acknowledge_created_inferior) PARAMS ((int));
-  void        (*to_clone_and_follow_inferior) PARAMS ((int, int *));
-  void        (*to_post_follow_inferior_by_clone) PARAMS ((void));
-  int         (*to_insert_fork_catchpoint) PARAMS ((int));
-  int         (*to_remove_fork_catchpoint) PARAMS ((int));
-  int         (*to_insert_vfork_catchpoint) PARAMS ((int));
-  int         (*to_remove_vfork_catchpoint) PARAMS ((int));
-  int         (*to_has_forked) PARAMS ((int, int *));
-  int         (*to_has_vforked) PARAMS ((int, int *));
-  int         (*to_can_follow_vfork_prior_to_exec) PARAMS ((void));
-  void        (*to_post_follow_vfork) PARAMS ((int, int, int, int));
-  int         (*to_insert_exec_catchpoint) PARAMS ((int));
-  int         (*to_remove_exec_catchpoint) PARAMS ((int));
-  int         (*to_has_execd) PARAMS ((int, char **));
-  int         (*to_reported_exec_events_per_exec_call) PARAMS ((void));
-  int         (*to_has_syscall_event) PARAMS ((int, enum target_waitkind *, int *));
-  int         (*to_has_exited) PARAMS ((int, int, int *));
-  void               (*to_mourn_inferior) PARAMS ((void));
-  int        (*to_can_run) PARAMS ((void));
-  void       (*to_notice_signals) PARAMS ((int pid));
-  int        (*to_thread_alive) PARAMS ((int pid));
-  void       (*to_stop) PARAMS ((void));
-  int        (*to_query) PARAMS ((int/*char*/, char *, char *, int *));
-  struct symtab_and_line * (*to_enable_exception_callback) PARAMS ((enum exception_event_kind, int));
-  struct exception_event_record * (*to_get_current_exception_event) PARAMS ((void));
-  char *      (*to_pid_to_exec_file) PARAMS ((int pid));
-  char *      (*to_core_file_to_sym_file) PARAMS ((char *));
-  enum strata   to_stratum;
-  struct target_ops
-               *DONT_USE;      /* formerly to_next */
-  int          to_has_all_memory;
-  int          to_has_memory;
-  int          to_has_stack;
-  int          to_has_registers;
-  int          to_has_execution;
-  int          to_has_thread_control;  /* control thread execution */
-  struct section_table
-              *to_sections;
-  struct section_table
-              *to_sections_end;
-  int          to_magic;
-  /* Need sub-structure for target machine related rather than comm related? */
-};
+#endif                         /* 0 */
+
+    void (*to_files_info) PARAMS ((struct target_ops *));
+    int (*to_insert_breakpoint) PARAMS ((CORE_ADDR, char *));
+    int (*to_remove_breakpoint) PARAMS ((CORE_ADDR, char *));
+    void (*to_terminal_init) PARAMS ((void));
+    void (*to_terminal_inferior) PARAMS ((void));
+    void (*to_terminal_ours_for_output) PARAMS ((void));
+    void (*to_terminal_ours) PARAMS ((void));
+    void (*to_terminal_info) PARAMS ((char *, int));
+    void (*to_kill) PARAMS ((void));
+    void (*to_load) PARAMS ((char *, int));
+    int (*to_lookup_symbol) PARAMS ((char *, CORE_ADDR *));
+    void (*to_create_inferior) PARAMS ((char *, char *, char **));
+    void (*to_post_startup_inferior) PARAMS ((int));
+    void (*to_acknowledge_created_inferior) PARAMS ((int));
+    void (*to_clone_and_follow_inferior) PARAMS ((int, int *));
+    void (*to_post_follow_inferior_by_clone) PARAMS ((void));
+    int (*to_insert_fork_catchpoint) PARAMS ((int));
+    int (*to_remove_fork_catchpoint) PARAMS ((int));
+    int (*to_insert_vfork_catchpoint) PARAMS ((int));
+    int (*to_remove_vfork_catchpoint) PARAMS ((int));
+    int (*to_has_forked) PARAMS ((int, int *));
+    int (*to_has_vforked) PARAMS ((int, int *));
+    int (*to_can_follow_vfork_prior_to_exec) PARAMS ((void));
+    void (*to_post_follow_vfork) PARAMS ((int, int, int, int));
+    int (*to_insert_exec_catchpoint) PARAMS ((int));
+    int (*to_remove_exec_catchpoint) PARAMS ((int));
+    int (*to_has_execd) PARAMS ((int, char **));
+    int (*to_reported_exec_events_per_exec_call) PARAMS ((void));
+    int (*to_has_syscall_event) PARAMS ((int, enum target_waitkind *, int *));
+    int (*to_has_exited) PARAMS ((int, int, int *));
+    void (*to_mourn_inferior) PARAMS ((void));
+    int (*to_can_run) PARAMS ((void));
+    void (*to_notice_signals) PARAMS ((int pid));
+    int (*to_thread_alive) PARAMS ((int pid));
+    void (*to_find_new_threads) PARAMS ((void));
+    void (*to_stop) PARAMS ((void));
+    int (*to_query) PARAMS ((int /*char */ , char *, char *, int *));
+    void (*to_rcmd) (char *command, struct gdb_file *output);
+    struct symtab_and_line *(*to_enable_exception_callback) PARAMS ((enum exception_event_kind, int));
+    struct exception_event_record *(*to_get_current_exception_event) PARAMS ((void));
+    char *(*to_pid_to_exec_file) PARAMS ((int pid));
+    char *(*to_core_file_to_sym_file) PARAMS ((char *));
+    enum strata to_stratum;
+    struct target_ops
+     *DONT_USE;                        /* formerly to_next */
+    int to_has_all_memory;
+    int to_has_memory;
+    int to_has_stack;
+    int to_has_registers;
+    int to_has_execution;
+    int to_has_thread_control; /* control thread execution */
+    struct section_table
+     *to_sections;
+    struct section_table
+     *to_sections_end;
+    /* ASYNC target controls */
+    int (*to_can_async_p) (void);
+    int (*to_is_async_p) (void);
+    void (*to_async) (void (*cb) (int error, void *context, int fd), void *context);
+    int to_magic;
+    /* Need sub-structure for target machine related rather than comm related? */
+  };
 
 /* Magic number for checking ops size.  If a struct doesn't end with this
    number, somebody changed the declaration but didn't change all the
@@ -388,15 +418,15 @@ struct target_ops
 /* The ops structure for our "current" target process.  This should
    never be NULL.  If there is no target, it points to the dummy_target.  */
 
-extern struct target_ops       current_target;
+extern struct target_ops current_target;
 
 /* An item on the target stack.  */
 
 struct target_stack_item
-{
-  struct target_stack_item *next;
-  struct target_ops *target_ops;
-};
+  {
+    struct target_stack_item *next;
+    struct target_ops *target_ops;
+  };
 
 /* The target stack.  */
 
@@ -440,7 +470,7 @@ extern struct target_stack_item *target_stack;
 
    This operation provides a target-specific hook that allows the
    necessary bookkeeping to be performed after an attach completes.
  */
+ */
 #define target_post_attach(pid) \
         (*current_target.to_post_attach) (pid)
 
@@ -508,7 +538,7 @@ target_detach PARAMS ((char *, int));
 
    This operation provides a target-specific hook that allows the
    necessary bookkeeping to be performed to track such sequences.
  */
+ */
 
 #define target_post_wait(pid, status) \
         (*current_target.to_post_wait) (pid, status)
@@ -541,7 +571,7 @@ target_read_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len));
 
 extern int
 target_read_memory_section PARAMS ((CORE_ADDR memaddr, char *myaddr, int len,
-                                   asection *bfd_section));
+                                   asection * bfd_section));
 
 extern int
 target_read_memory_partial PARAMS ((CORE_ADDR, char *, int, int *));
@@ -556,10 +586,10 @@ extern int
 child_xfer_memory PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *));
 
 extern char *
-child_pid_to_exec_file PARAMS ((int));
+  child_pid_to_exec_file PARAMS ((int));
 
 extern char *
-child_core_file_to_sym_file PARAMS ((char *));
+  child_core_file_to_sym_file PARAMS ((char *));
 
 #if defined(CHILD_POST_ATTACH)
 extern void
@@ -720,7 +750,7 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
    ALLARGS is a string containing the arguments to the program.
    ENV is the environment vector to pass.  Errors reported with error().
    On VxWorks and various standalone systems, we ignore exec_file.  */
+
 #define        target_create_inferior(exec_file, args, env)    \
        (*current_target.to_create_inferior) (exec_file, args, env)
 
@@ -732,15 +762,15 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
    if the shell init file has commands in it, the shell will fork and
    exec for each of those commands, and we will see each such fork
    event.  Very bad.)
-   
+
    Such targets will supply an appropriate definition for this function.
  */
+ */
 #define target_post_startup_inferior(pid) \
         (*current_target.to_post_startup_inferior) (pid)
 
 /* On some targets, the sequence of starting up an inferior requires
    some synchronization between gdb and the new inferior process, PID.
  */
+ */
 #define target_acknowledge_created_inferior(pid) \
         (*current_target.to_acknowledge_created_inferior) (pid)
 
@@ -754,7 +784,7 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 
    (This is not a terribly useful feature without a GUI to prevent
    the two debuggers from competing for shell input.)
  */
+ */
 #define target_clone_and_follow_inferior(child_pid,followed_child) \
         (*current_target.to_clone_and_follow_inferior) (child_pid, followed_child)
 
@@ -767,14 +797,14 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 
    On some targets, this requires a bit of cleanup to make it work
    correctly.
  */
+ */
 #define target_post_follow_inferior_by_clone() \
         (*current_target.to_post_follow_inferior_by_clone) ()
 
 /* On some targets, we can catch an inferior fork or vfork event when it
    occurs.  These functions insert/remove an already-created catchpoint for
    such events.
  */
+ */
 #define target_insert_fork_catchpoint(pid) \
         (*current_target.to_insert_fork_catchpoint) (pid)
 
@@ -790,14 +820,14 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 /* Returns TRUE if PID has invoked the fork() system call.  And,
    also sets CHILD_PID to the process id of the other ("child")
    inferior process that was created by that call.
  */
+ */
 #define target_has_forked(pid,child_pid) \
         (*current_target.to_has_forked) (pid,child_pid)
 
 /* Returns TRUE if PID has invoked the vfork() system call.  And,
    also sets CHILD_PID to the process id of the other ("child")
    inferior process that was created by that call.
  */
+ */
 #define target_has_vforked(pid,child_pid) \
         (*current_target.to_has_vforked) (pid,child_pid)
 
@@ -809,7 +839,7 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
    This function should be defined to return 1 by those targets
    which can allow the debugger to immediately follow a vforked
    child, and 0 if they cannot.
  */
+ */
 #define target_can_follow_vfork_prior_to_exec() \
         (*current_target.to_can_follow_vfork_prior_to_exec) ()
 
@@ -820,44 +850,44 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
    If so, this function should be defined by those targets that
    require the debugger to perform cleanup or initialization after
    the vfork follow.
  */
+ */
 #define target_post_follow_vfork(parent_pid,followed_parent,child_pid,followed_child) \
         (*current_target.to_post_follow_vfork) (parent_pid,followed_parent,child_pid,followed_child)
 
 /* On some targets, we can catch an inferior exec event when it
    occurs.  These functions insert/remove an already-created catchpoint
    for such events.
  */
+ */
 #define target_insert_exec_catchpoint(pid) \
         (*current_target.to_insert_exec_catchpoint) (pid)
+
 #define target_remove_exec_catchpoint(pid) \
         (*current_target.to_remove_exec_catchpoint) (pid)
 
 /* Returns TRUE if PID has invoked a flavor of the exec() system call.
    And, also sets EXECD_PATHNAME to the pathname of the executable file
    that was passed to exec(), and is now being executed.
  */
+ */
 #define target_has_execd(pid,execd_pathname) \
         (*current_target.to_has_execd) (pid,execd_pathname)
 
 /* Returns the number of exec events that are reported when a process
    invokes a flavor of the exec() system call on this target, if exec
    events are being reported.
  */
+ */
 #define target_reported_exec_events_per_exec_call() \
         (*current_target.to_reported_exec_events_per_exec_call) ()
 
 /* Returns TRUE if PID has reported a syscall event.  And, also sets
    KIND to the appropriate TARGET_WAITKIND_, and sets SYSCALL_ID to
    the unique integer ID of the syscall.
  */
+ */
 #define target_has_syscall_event(pid,kind,syscall_id) \
   (*current_target.to_has_syscall_event) (pid,kind,syscall_id)
 
 /* Returns TRUE if PID has exited.  And, also sets EXIT_STATUS to the
    exit code of PID, if any.
  */
+ */
 #define target_has_exited(pid,wait_status,exit_status) \
         (*current_target.to_has_exited) (pid,wait_status,exit_status)
 
@@ -865,7 +895,7 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
    some process event that must be processed.  This function should
    be defined by those targets that require the debugger to perform
    cleanup or internal state changes in response to the process event.
  */
+ */
 
 /* The inferior process has died.  Do what is right.  */
 
@@ -887,6 +917,14 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 #define target_thread_alive(pid) \
        (*current_target.to_thread_alive) (pid)
 
+/* Query for new threads and add them to the thread list.  */
+
+#define target_find_new_threads() \
+     do { \
+       if (current_target.to_find_new_threads) \
+         (*current_target.to_find_new_threads) (); \
+     } while (0);
+
 /* Make target stop in a continuable fashion.  (For instance, under Unix, this
    should act like SIGSTOP).  This function is normally used by GUIs to
    implement a stop button.  */
@@ -899,10 +937,18 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
    information is desired and the third is a buffer that carries back the 
    response from the target side. The fourth parameter is the size of the
    output buffer supplied. */
+
 #define        target_query(query_type, query, resp_buffer, bufffer_size)      \
        (*current_target.to_query) (query_type, query, resp_buffer, bufffer_size)
 
+/* Send the specified COMMAND to the target's monitor
+   (shell,interpreter) for execution.  The result of the query is
+   placed in OUTBUF. */
+
+#define target_rcmd(command, outbuf) \
+     (*current_target.to_rcmd) (command, outbuf)
+
+
 /* Get the symbol information for a breakpointable routine called when
    an exception event occurs. 
    Intended mainly for C++, and for those
@@ -914,7 +960,7 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
         (*current_target.to_enable_exception_callback) (kind, enable)
 
 /* Get the current exception event kind -- throw or catch, etc. */
-   
+
 #define target_get_current_exception_event() \
         (*current_target.to_get_current_exception_event) ()
 
@@ -937,7 +983,7 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 
 /* Does the target have a stack?  (Exec files don't, VxWorks doesn't, until
    we start a process.)  */
-   
+
 #define        target_has_stack        \
        (current_target.to_has_stack)
 
@@ -966,6 +1012,15 @@ print_section_info PARAMS ((struct target_ops *, bfd *));
 #define target_can_switch_threads \
        (current_target.to_has_thread_control & tc_switch)
 
+/* Can the target support asynchronous execution? */
+#define target_can_async_p() (current_target.to_can_async_p ())
+
+/* Is the target in asynchronous execution mode? */
+#define target_is_async_p() (current_target.to_is_async_p())
+
+/* Put the target in async mode with the specified callback function. */
+#define target_async(CALLBACK,CONTEXT) (current_target.to_async((CALLBACK), (CONTEXT)))
+
 extern void target_link PARAMS ((char *, CORE_ADDR *));
 
 /* Converts a process id to a string.  Usually, the string just contains
@@ -983,7 +1038,7 @@ extern char *normal_pid_to_str PARAMS ((int pid));
         normal_pid_to_str (PID)
 extern char *normal_pid_to_str PARAMS ((int pid));
 #endif
+
 
 #ifndef target_new_objfile
 #define target_new_objfile(OBJFILE)
@@ -998,14 +1053,14 @@ extern char *normal_pid_to_str PARAMS ((int pid));
    that was run to create a specified process.
 
    The process PID must be stopped when this operation is used.
-   
+
    If the executable file cannot be determined, NULL is returned.
 
    Else, a pointer to a character string containing the pathname
    is returned.  This string should be copied into a buffer by
    the client if the string will not be immediately used, or if
    it must persist.
  */
+ */
 
 #define target_pid_to_exec_file(pid) \
        (current_target.to_pid_to_exec_file) (pid)
@@ -1035,7 +1090,7 @@ extern char *normal_pid_to_str PARAMS ((int pid));
 /* HP-UX supplies these operations, which respectively disable and enable
    the memory page-protections that are used to implement hardware watchpoints
    on that platform.  See wait_for_inferior's use of these.
  */
+ */
 #if !defined(TARGET_DISABLE_HW_WATCHPOINTS)
 #define TARGET_DISABLE_HW_WATCHPOINTS(pid)
 #endif
@@ -1066,7 +1121,7 @@ extern char *normal_pid_to_str PARAMS ((int pid));
    severe performance penalties, such that we might as well use regular
    watchpoints, and save (possibly precious) hardware watchpoints for other
    locations.
  */
+ */
 #if !defined(TARGET_RANGE_PROFITABLE_FOR_HW_WATCHPOINT)
 #define TARGET_RANGE_PROFITABLE_FOR_HW_WATCHPOINT(pid,start,len) 0
 #endif
@@ -1101,7 +1156,7 @@ extern char *normal_pid_to_str PARAMS ((int pid));
    from a minimal symbol, but the value really means, essentially,
    "This is an index into a table which is populated when the inferior
    is run.  Therefore, do not attempt to use this as a PC."
  */
+ */
 #if !defined(PC_REQUIRES_RUN_BEFORE_USE)
 #define PC_REQUIRES_RUN_BEFORE_USE(pc) (0)
 #endif
@@ -1113,7 +1168,7 @@ extern char *normal_pid_to_str PARAMS ((int pid));
    child process after it has exec'd, causes the parent process to resume as
    well.  To prevent the parent from running spontaneously, such targets should
    define this to a function that prevents that from happening.
  */
+ */
 #if !defined(ENSURE_VFORKING_PARENT_REMAINS_STOPPED)
 #define ENSURE_VFORKING_PARENT_REMAINS_STOPPED(PID) (0)
 #endif
@@ -1124,7 +1179,7 @@ extern char *normal_pid_to_str PARAMS ((int pid));
    On some targets (such as HP-UX 10.20 and earlier), a newly vforked child
    process must be resumed when it delivers its exec event, before the parent
    vfork event will be delivered to us.
  */
+ */
 #if !defined(RESUME_EXECD_VFORKING_CHILD_TO_GET_PARENT_VFORK)
 #define RESUME_EXECD_VFORKING_CHILD_TO_GET_PARENT_VFORK() (0)
 #endif
@@ -1134,15 +1189,15 @@ extern char *normal_pid_to_str PARAMS ((int pid));
    add_target:   Add a target to the list of all possible targets.
 
    push_target:  Make this target the top of the stack of currently used
-                targets, within its particular stratum of the stack.  Result
-                is 0 if now atop the stack, nonzero if not on top (maybe
-                should warn user).
+   targets, within its particular stratum of the stack.  Result
+   is 0 if now atop the stack, nonzero if not on top (maybe
+   should warn user).
 
    unpush_target: Remove this from the stack of currently used targets,
-                no matter where it is on the list.  Returns 0 if no
-                change, 1 if removed from stack.
+   no matter where it is on the list.  Returns 0 if no
+   change, 1 if removed from stack.
 
-   pop_target:  Remove the top thing on the stack of current targets.  */
+   pop_target:   Remove the top thing on the stack of current targets.  */
 
 extern void
 add_target PARAMS ((struct target_ops *));
@@ -1163,14 +1218,15 @@ pop_target PARAMS ((void));
    mostly used with BFD files, but can be used without (e.g. for handling
    raw disks, or files not in formats handled by BFD).  */
 
-struct section_table {
-  CORE_ADDR addr;              /* Lowest address in section */
-  CORE_ADDR endaddr;           /* 1+highest address in section */
+struct section_table
+  {
+    CORE_ADDR addr;            /* Lowest address in section */
+    CORE_ADDR endaddr;         /* 1+highest address in section */
 
-  sec_ptr the_bfd_section;
+    sec_ptr the_bfd_section;
 
-  bfd     *bfd;                /* BFD file pointer */
-};
+    bfd *bfd;                  /* BFD file pointer */
+  };
 
 /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
    Returns 0 if OK, 1 on error.  */
@@ -1217,7 +1273,10 @@ find_default_clone_and_follow_inferior PARAMS ((int, int *));
 extern struct target_ops *find_run_target PARAMS ((void));
 
 extern struct target_ops *
-find_core_target PARAMS ((void));
+  find_core_target PARAMS ((void));
+
+int
+target_resize_to_sections PARAMS ((struct target_ops *target, int num_added));
 \f
 /* Stuff that should be shared among the various remote targets.  */
 
@@ -1265,4 +1324,4 @@ void target_ignore PARAMS ((void));
    do { *(REGP) = FP_REGNUM; *(OFFP) =  0; } while (0)
 #endif /* TARGET_VIRTUAL_FRAME_POINTER */
 
-#endif /* !defined (TARGET_H) */
+#endif /* !defined (TARGET_H) */
This page took 0.03861 seconds and 4 git commands to generate.