-enum strata {
- dummy_stratum, /* The lowest of the low */
- file_stratum, /* Executable files, etc */
- core_stratum, /* Core dump files */
- process_stratum, /* Executing processes */
-};
-
-struct target_ops {
- char *to_shortname; /* Name this target type */
- char *to_longname; /* Name for printing */
- /* Documentation. Does not include trailing newline, and
- starts with a one-line description (probably similar to
- to_longname). */
- char *to_doc;
-#ifdef __STDC__
- void (*to_open) (char *name, int from_tty);
- void (*to_close) (int quitting);
- void (*to_attach) (char *name, int from_tty);
- void (*to_detach) (char *args, int from_tty);
- void (*to_resume) (int step, int siggnal);
- int (*to_wait) (int *status);
- int (*to_fetch_registers) (int regno);
- int (*to_store_registers) (int regno);
- void (*to_prepare_to_store) ();
- void (*to_convert_to_virtual) (int regnum, char *from, char *to);
- void (*to_convert_from_virtual) (int regnum, char *from, char *to);
- int (*to_xfer_memory) (CORE_ADDR memaddr, char *myaddr, int len, int w);
- void (*to_files_info) ();
- int (*to_insert_breakpoint) (CORE_ADDR addr, char *save);
- int (*to_remove_breakpoint) (CORE_ADDR addr, char *save);
- void (*to_terminal_init) ();
- void (*to_terminal_inferior) ();
- void (*to_terminal_ours_for_output) ();
- void (*to_terminal_ours) ();
- void (*to_terminal_info) (char *arg, int from_tty);
- void (*to_kill) (char *arg, int from_tty);
- void (*to_load) (char *arg, int from_tty);
- void (*to_add_syms) (char *arg, int from_tty);
-struct value *(*to_call_function) (struct value *function,
- int nargs, struct value **args);
- int (*to_lookup_symbol) (char *name, CORE_ADDR *addrp);
- void (*to_create_inferior) (char *exec, char *args, char **env);
- void (*to_mourn_inferior) ();
- enum strata to_stratum;
-struct target_ops *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_magic;
-/* Need sub-structure for target machine related rather than comm related? */
-#else /* STDC */
- void (*to_open) ();
- void (*to_close) ();
- void (*to_attach) ();
- void (*to_detach) ();
- void (*to_resume) ();
- int (*to_wait) ();
- int (*to_fetch_registers) ();
- int (*to_store_registers) ();
- void (*to_prepare_to_store) ();
- void (*to_convert_to_virtual) ();
- void (*to_convert_from_virtual) ();
- int (*to_xfer_memory) ();
- void (*to_files_info) ();
- int (*to_insert_breakpoint) ();
- int (*to_remove_breakpoint) ();
- void (*to_terminal_init) ();
- void (*to_terminal_inferior) ();
- void (*to_terminal_ours_for_output) ();
- void (*to_terminal_ours) ();
- void (*to_terminal_info) ();
- void (*to_kill) ();
- void (*to_load) ();
- void (*to_add_syms) ();
-struct value *(*to_call_function) ();
- int (*to_lookup_symbol) ();
- void (*to_create_inferior) ();
- void (*to_mourn_inferior) ();
+#include "bfd.h"
+#include "symtab.h"
+#include "dcache.h"
+#include "memattr.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 */
+ 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. */
+ };
+
+/* 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,
+
+ /* 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 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. */
+
+ TARGET_WAITKIND_FORKED,
+
+ /* The program has vforked. A "related" process's ID is in
+ value.related_pid. */
+
+ TARGET_WAITKIND_VFORKED,
+
+ /* The program has exec'ed a new executable file. The new file's
+ pathname is pointed to by value.execd_pathname. */
+
+ 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 */
+
+ 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,
+
+ /* This is used for target async and extended-async
+ only. Remote_async_wait() returns this when there is an event
+ on the inferior, but the rest of the world is not interested in
+ it. The inferior has not stopped, but has just sent some output
+ to the console, for instance. In this case, we want to go back
+ to the event loop and wait there for another event from the
+ inferior, rather than being stuck in the remote_async_wait()
+ function. This way the event loop is responsive to other events,
+ like for instance the user typing. */
+ TARGET_WAITKIND_IGNORE
+ };
+
+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;
+ };
+
+/* Possible types of events that the inferior handler will have to
+ deal with. */
+enum inferior_event_type
+ {
+ /* There is a request to quit the inferior, abandon it. */
+ INF_QUIT_REQ,
+ /* Process a normal inferior event which will result in target_wait
+ being called. */
+ INF_REG_EVENT,
+ /* Deal with an error on the inferior. */
+ INF_ERROR,
+ /* We are called because a timer went off. */
+ INF_TIMER,
+ /* We are called to do stuff after the inferior stops. */
+ INF_EXEC_COMPLETE,
+ /* We are called to do some stuff after the inferior stops, but we
+ are expected to reenter the proceed() and
+ handle_inferior_event() functions. This is used only in case of
+ 'step n' like commands. */
+ INF_EXEC_CONTINUE
+ };
+
+/* Return the string for a signal. */
+extern char *target_signal_to_string (enum target_signal);
+
+/* Return the name (SIGHUP, etc.) for a signal. */
+extern char *target_signal_to_name (enum target_signal);
+
+/* Given a name (SIGHUP, etc.), return its signal. */
+enum target_signal target_signal_from_name (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
+ on TARGET_ACTIVITY_FD. */
+extern int target_activity_fd;
+/* Returns zero to leave the inferior alone, one to interrupt it. */
+extern int (*target_activity_function) (void);
+\f
+struct thread_info; /* fwd decl for parameter list below: */
+
+struct target_ops
+ {
+ 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) (char *, int);
+ void (*to_close) (int);
+ void (*to_attach) (char *, int);
+ void (*to_post_attach) (int);
+ void (*to_require_attach) (char *, int);
+ void (*to_detach) (char *, int);
+ void (*to_require_detach) (int, char *, int);
+ void (*to_resume) (ptid_t, int, enum target_signal);
+ ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
+ void (*to_post_wait) (ptid_t, int);
+ void (*to_fetch_registers) (int);
+ void (*to_store_registers) (int);
+ void (*to_prepare_to_store) (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) (CORE_ADDR memaddr, char *myaddr,
+ int len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target);
+
+#if 0
+ /* 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).
+
+ If we don't find anything, set *ADDR_FOUND to (CORE_ADDR)0 and
+ return. */
+
+ void (*to_search) (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) (struct target_ops *);
+ int (*to_insert_breakpoint) (CORE_ADDR, char *);
+ int (*to_remove_breakpoint) (CORE_ADDR, char *);
+ void (*to_terminal_init) (void);
+ void (*to_terminal_inferior) (void);
+ void (*to_terminal_ours_for_output) (void);
+ void (*to_terminal_ours) (void);
+ void (*to_terminal_info) (char *, int);
+ void (*to_kill) (void);
+ void (*to_load) (char *, int);
+ int (*to_lookup_symbol) (char *, CORE_ADDR *);
+ void (*to_create_inferior) (char *, char *, char **);
+ void (*to_post_startup_inferior) (ptid_t);
+ void (*to_acknowledge_created_inferior) (int);
+ void (*to_clone_and_follow_inferior) (int, int *);
+ void (*to_post_follow_inferior_by_clone) (void);
+ int (*to_insert_fork_catchpoint) (int);
+ int (*to_remove_fork_catchpoint) (int);
+ int (*to_insert_vfork_catchpoint) (int);
+ int (*to_remove_vfork_catchpoint) (int);
+ int (*to_has_forked) (int, int *);
+ int (*to_has_vforked) (int, int *);
+ int (*to_can_follow_vfork_prior_to_exec) (void);
+ void (*to_post_follow_vfork) (int, int, int, int);
+ int (*to_insert_exec_catchpoint) (int);
+ int (*to_remove_exec_catchpoint) (int);
+ int (*to_has_execd) (int, char **);
+ int (*to_reported_exec_events_per_exec_call) (void);
+ int (*to_has_syscall_event) (int, enum target_waitkind *, int *);
+ int (*to_has_exited) (int, int, int *);
+ void (*to_mourn_inferior) (void);
+ int (*to_can_run) (void);
+ void (*to_notice_signals) (ptid_t ptid);
+ int (*to_thread_alive) (ptid_t ptid);
+ void (*to_find_new_threads) (void);
+ char *(*to_pid_to_str) (ptid_t);
+ char *(*to_extra_thread_info) (struct thread_info *);
+ void (*to_stop) (void);
+ int (*to_query) (int /*char */ , char *, char *, int *);
+ void (*to_rcmd) (char *command, struct ui_file *output);
+ struct symtab_and_line *(*to_enable_exception_callback) (enum
+ exception_event_kind,
+ int);
+ struct exception_event_record *(*to_get_current_exception_event) (void);
+ char *(*to_pid_to_exec_file) (int pid);