+ if (WIFEXITED (hoststatus))
+ {
+ ourstatus->kind = TARGET_WAITKIND_EXITED;
+ ourstatus->value.integer = WEXITSTATUS (hoststatus);
+ }
+ else if (!WIFSTOPPED (hoststatus))
+ {
+ ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+ ourstatus->value.sig = target_signal_from_host (WTERMSIG (hoststatus));
+ }
+ else
+ {
+ ourstatus->kind = TARGET_WAITKIND_STOPPED;
+ ourstatus->value.sig = target_signal_from_host (WSTOPSIG (hoststatus));
+ }
+}
+\f
+/* In some circumstances we allow a command to specify a numeric
+ signal. The idea is to keep these circumstances limited so that
+ users (and scripts) develop portable habits. For comparison,
+ POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
+ numeric signal at all is obsolescent. We are slightly more
+ lenient and allow 1-15 which should match host signal numbers on
+ most systems. Use of symbolic signal names is strongly encouraged. */
+
+enum target_signal
+target_signal_from_command (int num)
+{
+ if (num >= 1 && num <= 15)
+ return (enum target_signal) num;
+ error ("Only signals 1-15 are valid as numeric signals.\n\
+Use \"info signals\" for a list of symbolic signals.");
+}
+\f
+/* Returns zero to leave the inferior alone, one to interrupt it. */
+int (*target_activity_function) (void);
+int target_activity_fd;
+\f
+/* Convert a normal process ID to a string. Returns the string in a static
+ buffer. */
+
+char *
+normal_pid_to_str (int pid)
+{
+ static char buf[30];
+
+ if (STREQ (current_target.to_shortname, "remote"))
+ sprintf (buf, "thread %d", pid);
+ else
+ sprintf (buf, "process %d", pid);
+
+ return buf;
+}
+
+/* Some targets (such as ttrace-based HPUX) don't allow us to request
+ notification of inferior events such as fork and vork immediately
+ after the inferior is created. (This because of how gdb gets an
+ inferior created via invoking a shell to do it. In such a scenario,
+ 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.)
+
+ This function is used by all targets that allow us to request
+ notification of forks, etc at inferior creation time; e.g., in
+ target_acknowledge_forked_child.
+ */
+static void
+normal_target_post_startup_inferior (int pid)
+{
+ /* This space intentionally left blank. */
+}
+
+/* Set up the handful of non-empty slots needed by the dummy target
+ vector. */
+
+static void
+init_dummy_target (void)
+{
+ dummy_target.to_shortname = "None";
+ dummy_target.to_longname = "None";
+ dummy_target.to_doc = "";
+ dummy_target.to_attach = find_default_attach;
+ dummy_target.to_require_attach = find_default_require_attach;
+ dummy_target.to_require_detach = find_default_require_detach;
+ dummy_target.to_create_inferior = find_default_create_inferior;
+ dummy_target.to_clone_and_follow_inferior = find_default_clone_and_follow_inferior;
+ dummy_target.to_pid_to_str = normal_pid_to_str;
+ dummy_target.to_stratum = dummy_stratum;
+ dummy_target.to_magic = OPS_MAGIC;
+}
+\f
+
+static struct target_ops debug_target;
+
+static void
+debug_to_open (char *args, int from_tty)
+{
+ debug_target.to_open (args, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog, "target_open (%s, %d)\n", args, from_tty);
+}
+
+static void
+debug_to_close (int quitting)
+{
+ debug_target.to_close (quitting);
+
+ fprintf_unfiltered (gdb_stdlog, "target_close (%d)\n", quitting);
+}
+
+static void
+debug_to_attach (char *args, int from_tty)
+{
+ debug_target.to_attach (args, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog, "target_attach (%s, %d)\n", args, from_tty);
+}
+
+
+static void
+debug_to_post_attach (int pid)
+{
+ debug_target.to_post_attach (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_post_attach (%d)\n", pid);
+}
+
+static void
+debug_to_require_attach (char *args, int from_tty)
+{
+ debug_target.to_require_attach (args, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_require_attach (%s, %d)\n", args, from_tty);
+}
+
+static void
+debug_to_detach (char *args, int from_tty)
+{
+ debug_target.to_detach (args, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog, "target_detach (%s, %d)\n", args, from_tty);
+}
+
+static void
+debug_to_require_detach (int pid, char *args, int from_tty)
+{
+ debug_target.to_require_detach (pid, args, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_require_detach (%d, %s, %d)\n", pid, args, from_tty);
+}
+
+static void
+debug_to_resume (int pid, int step, enum target_signal siggnal)
+{
+ debug_target.to_resume (pid, step, siggnal);
+
+ fprintf_unfiltered (gdb_stdlog, "target_resume (%d, %s, %s)\n", pid,
+ step ? "step" : "continue",
+ target_signal_to_name (siggnal));
+}
+
+static int
+debug_to_wait (int pid, struct target_waitstatus *status)
+{
+ int retval;
+
+ retval = debug_target.to_wait (pid, status);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_wait (%d, status) = %d, ", pid, retval);
+ fprintf_unfiltered (gdb_stdlog, "status->kind = ");
+ switch (status->kind)
+ {
+ case TARGET_WAITKIND_EXITED:
+ fprintf_unfiltered (gdb_stdlog, "exited, status = %d\n",
+ status->value.integer);
+ break;
+ case TARGET_WAITKIND_STOPPED:
+ fprintf_unfiltered (gdb_stdlog, "stopped, signal = %s\n",
+ target_signal_to_name (status->value.sig));
+ break;
+ case TARGET_WAITKIND_SIGNALLED:
+ fprintf_unfiltered (gdb_stdlog, "signalled, signal = %s\n",
+ target_signal_to_name (status->value.sig));
+ break;
+ case TARGET_WAITKIND_LOADED:
+ fprintf_unfiltered (gdb_stdlog, "loaded\n");
+ break;
+ case TARGET_WAITKIND_FORKED:
+ fprintf_unfiltered (gdb_stdlog, "forked\n");
+ break;
+ case TARGET_WAITKIND_VFORKED:
+ fprintf_unfiltered (gdb_stdlog, "vforked\n");
+ break;
+ case TARGET_WAITKIND_EXECD:
+ fprintf_unfiltered (gdb_stdlog, "execd\n");
+ break;
+ case TARGET_WAITKIND_SPURIOUS:
+ fprintf_unfiltered (gdb_stdlog, "spurious\n");
+ break;
+ default:
+ fprintf_unfiltered (gdb_stdlog, "unknown???\n");
+ break;
+ }
+
+ return retval;
+}
+
+static void
+debug_to_post_wait (int pid, int status)
+{
+ debug_target.to_post_wait (pid, status);
+
+ fprintf_unfiltered (gdb_stdlog, "target_post_wait (%d, %d)\n",
+ pid, status);
+}
+
+static void
+debug_to_fetch_registers (int regno)
+{
+ debug_target.to_fetch_registers (regno);
+
+ fprintf_unfiltered (gdb_stdlog, "target_fetch_registers (%s)",
+ regno != -1 ? REGISTER_NAME (regno) : "-1");
+ if (regno != -1)
+ fprintf_unfiltered (gdb_stdlog, " = 0x%lx %ld",
+ (unsigned long) read_register (regno),
+ (unsigned long) read_register (regno));
+ fprintf_unfiltered (gdb_stdlog, "\n");
+}
+
+static void
+debug_to_store_registers (int regno)
+{
+ debug_target.to_store_registers (regno);
+
+ if (regno >= 0 && regno < NUM_REGS)
+ fprintf_unfiltered (gdb_stdlog, "target_store_registers (%s) = 0x%lx %ld\n",
+ REGISTER_NAME (regno),
+ (unsigned long) read_register (regno),
+ (unsigned long) read_register (regno));
+ else
+ fprintf_unfiltered (gdb_stdlog, "target_store_registers (%d)\n", regno);
+}
+
+static void
+debug_to_prepare_to_store (void)
+{
+ debug_target.to_prepare_to_store ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
+}
+
+static int
+debug_to_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct target_ops *target)
+{
+ int retval;
+
+ retval = debug_target.to_xfer_memory (memaddr, myaddr, len, write, target);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
+ (unsigned int) memaddr, /* possable truncate long long */
+ len, write ? "write" : "read", retval);
+
+
+
+ if (retval > 0)
+ {
+ int i;
+
+ fputs_unfiltered (", bytes =", gdb_stdlog);
+ for (i = 0; i < retval; i++)
+ {
+ if ((((long) &(myaddr[i])) & 0xf) == 0)
+ fprintf_unfiltered (gdb_stdlog, "\n");
+ fprintf_unfiltered (gdb_stdlog, " %02x", myaddr[i] & 0xff);
+ }
+ }
+
+ fputc_unfiltered ('\n', gdb_stdlog);
+
+ return retval;
+}
+
+static void
+debug_to_files_info (struct target_ops *target)
+{
+ debug_target.to_files_info (target);
+
+ fprintf_unfiltered (gdb_stdlog, "target_files_info (xxx)\n");
+}
+
+static int
+debug_to_insert_breakpoint (CORE_ADDR addr, char *save)
+{
+ int retval;
+
+ retval = debug_target.to_insert_breakpoint (addr, save);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_insert_breakpoint (0x%lx, xxx) = %ld\n",
+ (unsigned long) addr,
+ (unsigned long) retval);
+ return retval;
+}
+
+static int
+debug_to_remove_breakpoint (CORE_ADDR addr, char *save)
+{
+ int retval;
+
+ retval = debug_target.to_remove_breakpoint (addr, save);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_remove_breakpoint (0x%lx, xxx) = %ld\n",
+ (unsigned long) addr,
+ (unsigned long) retval);
+ return retval;
+}
+
+static void
+debug_to_terminal_init (void)
+{
+ debug_target.to_terminal_init ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_terminal_init ()\n");
+}
+
+static void
+debug_to_terminal_inferior (void)
+{
+ debug_target.to_terminal_inferior ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_terminal_inferior ()\n");
+}
+
+static void
+debug_to_terminal_ours_for_output (void)
+{
+ debug_target.to_terminal_ours_for_output ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_terminal_ours_for_output ()\n");
+}
+
+static void
+debug_to_terminal_ours (void)
+{
+ debug_target.to_terminal_ours ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_terminal_ours ()\n");
+}
+
+static void
+debug_to_terminal_info (char *arg, int from_tty)
+{
+ debug_target.to_terminal_info (arg, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog, "target_terminal_info (%s, %d)\n", arg,
+ from_tty);
+}
+
+static void
+debug_to_kill (void)
+{
+ debug_target.to_kill ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_kill ()\n");
+}
+
+static void
+debug_to_load (char *args, int from_tty)
+{
+ debug_target.to_load (args, from_tty);
+
+ fprintf_unfiltered (gdb_stdlog, "target_load (%s, %d)\n", args, from_tty);
+}
+
+static int
+debug_to_lookup_symbol (char *name, CORE_ADDR *addrp)
+{
+ int retval;
+
+ retval = debug_target.to_lookup_symbol (name, addrp);
+
+ fprintf_unfiltered (gdb_stdlog, "target_lookup_symbol (%s, xxx)\n", name);
+
+ return retval;
+}
+
+static void
+debug_to_create_inferior (char *exec_file, char *args, char **env)
+{
+ debug_target.to_create_inferior (exec_file, args, env);
+
+ fprintf_unfiltered (gdb_stdlog, "target_create_inferior (%s, %s, xxx)\n",
+ exec_file, args);
+}
+
+static void
+debug_to_post_startup_inferior (int pid)
+{
+ debug_target.to_post_startup_inferior (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_post_startup_inferior (%d)\n",
+ pid);
+}
+
+static void
+debug_to_acknowledge_created_inferior (int pid)
+{
+ debug_target.to_acknowledge_created_inferior (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_acknowledge_created_inferior (%d)\n",
+ pid);
+}
+
+static void
+debug_to_clone_and_follow_inferior (int child_pid, int *followed_child)
+{
+ debug_target.to_clone_and_follow_inferior (child_pid, followed_child);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_clone_and_follow_inferior (%d, %d)\n",
+ child_pid, *followed_child);
+}
+
+static void
+debug_to_post_follow_inferior_by_clone (void)
+{
+ debug_target.to_post_follow_inferior_by_clone ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_post_follow_inferior_by_clone ()\n");
+}
+
+static int
+debug_to_insert_fork_catchpoint (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_insert_fork_catchpoint (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d) = %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static int
+debug_to_remove_fork_catchpoint (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_remove_fork_catchpoint (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_remove_fork_catchpoint (%d) = %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static int
+debug_to_insert_vfork_catchpoint (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_insert_vfork_catchpoint (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_insert_vfork_catchpoint (%d)= %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static int
+debug_to_remove_vfork_catchpoint (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_remove_vfork_catchpoint (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_remove_vfork_catchpoint (%d) = %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static int
+debug_to_has_forked (int pid, int *child_pid)
+{
+ int has_forked;
+
+ has_forked = debug_target.to_has_forked (pid, child_pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_has_forked (%d, %d) = %d\n",
+ pid, *child_pid, has_forked);
+
+ return has_forked;
+}
+
+static int
+debug_to_has_vforked (int pid, int *child_pid)
+{
+ int has_vforked;
+
+ has_vforked = debug_target.to_has_vforked (pid, child_pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_has_vforked (%d, %d) = %d\n",
+ pid, *child_pid, has_vforked);
+
+ return has_vforked;
+}
+
+static int
+debug_to_can_follow_vfork_prior_to_exec (void)
+{
+ int can_immediately_follow_vfork;
+
+ can_immediately_follow_vfork = debug_target.to_can_follow_vfork_prior_to_exec ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_can_follow_vfork_prior_to_exec () = %d\n",
+ can_immediately_follow_vfork);
+
+ return can_immediately_follow_vfork;
+}
+
+static void
+debug_to_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
+ int followed_child)
+{
+ debug_target.to_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child);
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_post_follow_vfork (%d, %d, %d, %d)\n",
+ parent_pid, followed_parent, child_pid, followed_child);
+}
+
+static int
+debug_to_insert_exec_catchpoint (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_insert_exec_catchpoint (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_insert_exec_catchpoint (%d) = %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static int
+debug_to_remove_exec_catchpoint (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_remove_exec_catchpoint (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_remove_exec_catchpoint (%d) = %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static int
+debug_to_has_execd (int pid, char **execd_pathname)
+{
+ int has_execd;
+
+ has_execd = debug_target.to_has_execd (pid, execd_pathname);
+
+ fprintf_unfiltered (gdb_stdlog, "target_has_execd (%d, %s) = %d\n",
+ pid, (*execd_pathname ? *execd_pathname : "<NULL>"),
+ has_execd);
+
+ return has_execd;
+}
+
+static int
+debug_to_reported_exec_events_per_exec_call (void)
+{
+ int reported_exec_events;
+
+ reported_exec_events = debug_target.to_reported_exec_events_per_exec_call ();
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_reported_exec_events_per_exec_call () = %d\n",
+ reported_exec_events);
+
+ return reported_exec_events;
+}
+
+static int
+debug_to_has_syscall_event (int pid, enum target_waitkind *kind,
+ int *syscall_id)
+{
+ int has_syscall_event;
+ char *kind_spelling = "??";
+
+ has_syscall_event = debug_target.to_has_syscall_event (pid, kind, syscall_id);
+ if (has_syscall_event)
+ {
+ switch (*kind)
+ {
+ case TARGET_WAITKIND_SYSCALL_ENTRY:
+ kind_spelling = "SYSCALL_ENTRY";
+ break;
+ case TARGET_WAITKIND_SYSCALL_RETURN:
+ kind_spelling = "SYSCALL_RETURN";
+ break;
+ default:
+ break;
+ }
+ }
+
+ fprintf_unfiltered (gdb_stdlog,
+ "target_has_syscall_event (%d, %s, %d) = %d\n",
+ pid, kind_spelling, *syscall_id, has_syscall_event);
+
+ return has_syscall_event;
+}
+
+static int
+debug_to_has_exited (int pid, int wait_status, int *exit_status)
+{
+ int has_exited;
+
+ has_exited = debug_target.to_has_exited (pid, wait_status, exit_status);
+
+ fprintf_unfiltered (gdb_stdlog, "target_has_exited (%d, %d, %d) = %d\n",
+ pid, wait_status, *exit_status, has_exited);
+
+ return has_exited;
+}
+
+static void
+debug_to_mourn_inferior (void)
+{
+ debug_target.to_mourn_inferior ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
+}
+
+static int
+debug_to_can_run (void)
+{
+ int retval;
+
+ retval = debug_target.to_can_run ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_can_run () = %d\n", retval);
+
+ return retval;
+}
+
+static void
+debug_to_notice_signals (int pid)
+{
+ debug_target.to_notice_signals (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_notice_signals (%d)\n", pid);
+}
+
+static int
+debug_to_thread_alive (int pid)
+{
+ int retval;
+
+ retval = debug_target.to_thread_alive (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_thread_alive (%d) = %d\n",
+ pid, retval);
+
+ return retval;
+}
+
+static void
+debug_to_find_new_threads (void)
+{
+ debug_target.to_find_new_threads ();
+
+ fputs_unfiltered ("target_find_new_threads ()\n", gdb_stdlog);
+}
+
+static void
+debug_to_stop (void)
+{
+ debug_target.to_stop ();
+
+ fprintf_unfiltered (gdb_stdlog, "target_stop ()\n");
+}
+
+static int
+debug_to_query (int type, char *req, char *resp, int *siz)
+{
+ int retval;
+
+ retval = debug_target.to_query (type, req, resp, siz);
+
+ fprintf_unfiltered (gdb_stdlog, "target_query (%c, %s, %s, %d) = %d\n", type, req, resp, *siz, retval);
+
+ return retval;
+}
+
+static void
+debug_to_rcmd (char *command,
+ struct ui_file *outbuf)
+{
+ debug_target.to_rcmd (command, outbuf);
+ fprintf_unfiltered (gdb_stdlog, "target_rcmd (%s, ...)\n", command);
+}
+
+static struct symtab_and_line *
+debug_to_enable_exception_callback (enum exception_event_kind kind, int enable)
+{
+ struct symtab_and_line *result;
+ result = debug_target.to_enable_exception_callback (kind, enable);
+ fprintf_unfiltered (gdb_stdlog,
+ "target get_exception_callback_sal (%d, %d)\n",
+ kind, enable);
+ return result;
+}
+
+static struct exception_event_record *
+debug_to_get_current_exception_event (void)
+{
+ struct exception_event_record *result;
+ result = debug_target.to_get_current_exception_event ();
+ fprintf_unfiltered (gdb_stdlog, "target get_current_exception_event ()\n");
+ return result;
+}
+
+static char *
+debug_to_pid_to_exec_file (int pid)
+{
+ char *exec_file;
+
+ exec_file = debug_target.to_pid_to_exec_file (pid);
+
+ fprintf_unfiltered (gdb_stdlog, "target_pid_to_exec_file (%d) = %s\n",
+ pid, exec_file);
+
+ return exec_file;
+}
+
+static char *
+debug_to_core_file_to_sym_file (char *core)
+{
+ char *sym_file;
+
+ sym_file = debug_target.to_core_file_to_sym_file (core);
+
+ fprintf_unfiltered (gdb_stdlog, "target_core_file_to_sym_file (%s) = %s\n",
+ core, sym_file);
+
+ return sym_file;
+}
+
+static void
+setup_target_debug (void)
+{
+ memcpy (&debug_target, ¤t_target, sizeof debug_target);
+
+ current_target.to_open = debug_to_open;
+ current_target.to_close = debug_to_close;
+ current_target.to_attach = debug_to_attach;
+ current_target.to_post_attach = debug_to_post_attach;
+ current_target.to_require_attach = debug_to_require_attach;
+ current_target.to_detach = debug_to_detach;
+ current_target.to_require_detach = debug_to_require_detach;
+ current_target.to_resume = debug_to_resume;
+ current_target.to_wait = debug_to_wait;
+ current_target.to_post_wait = debug_to_post_wait;
+ current_target.to_fetch_registers = debug_to_fetch_registers;
+ current_target.to_store_registers = debug_to_store_registers;
+ current_target.to_prepare_to_store = debug_to_prepare_to_store;
+ current_target.to_xfer_memory = debug_to_xfer_memory;
+ current_target.to_files_info = debug_to_files_info;
+ current_target.to_insert_breakpoint = debug_to_insert_breakpoint;
+ current_target.to_remove_breakpoint = debug_to_remove_breakpoint;
+ current_target.to_terminal_init = debug_to_terminal_init;
+ current_target.to_terminal_inferior = debug_to_terminal_inferior;
+ current_target.to_terminal_ours_for_output = debug_to_terminal_ours_for_output;
+ current_target.to_terminal_ours = debug_to_terminal_ours;
+ current_target.to_terminal_info = debug_to_terminal_info;
+ current_target.to_kill = debug_to_kill;
+ current_target.to_load = debug_to_load;
+ current_target.to_lookup_symbol = debug_to_lookup_symbol;
+ current_target.to_create_inferior = debug_to_create_inferior;
+ current_target.to_post_startup_inferior = debug_to_post_startup_inferior;
+ current_target.to_acknowledge_created_inferior = debug_to_acknowledge_created_inferior;
+ current_target.to_clone_and_follow_inferior = debug_to_clone_and_follow_inferior;
+ current_target.to_post_follow_inferior_by_clone = debug_to_post_follow_inferior_by_clone;
+ current_target.to_insert_fork_catchpoint = debug_to_insert_fork_catchpoint;
+ current_target.to_remove_fork_catchpoint = debug_to_remove_fork_catchpoint;
+ current_target.to_insert_vfork_catchpoint = debug_to_insert_vfork_catchpoint;
+ current_target.to_remove_vfork_catchpoint = debug_to_remove_vfork_catchpoint;
+ current_target.to_has_forked = debug_to_has_forked;
+ current_target.to_has_vforked = debug_to_has_vforked;
+ current_target.to_can_follow_vfork_prior_to_exec = debug_to_can_follow_vfork_prior_to_exec;
+ current_target.to_post_follow_vfork = debug_to_post_follow_vfork;
+ current_target.to_insert_exec_catchpoint = debug_to_insert_exec_catchpoint;
+ current_target.to_remove_exec_catchpoint = debug_to_remove_exec_catchpoint;
+ current_target.to_has_execd = debug_to_has_execd;
+ current_target.to_reported_exec_events_per_exec_call = debug_to_reported_exec_events_per_exec_call;
+ current_target.to_has_syscall_event = debug_to_has_syscall_event;
+ current_target.to_has_exited = debug_to_has_exited;
+ current_target.to_mourn_inferior = debug_to_mourn_inferior;
+ current_target.to_can_run = debug_to_can_run;
+ current_target.to_notice_signals = debug_to_notice_signals;
+ current_target.to_thread_alive = debug_to_thread_alive;
+ current_target.to_find_new_threads = debug_to_find_new_threads;
+ current_target.to_stop = debug_to_stop;
+ current_target.to_query = debug_to_query;
+ current_target.to_rcmd = debug_to_rcmd;
+ current_target.to_enable_exception_callback = debug_to_enable_exception_callback;
+ current_target.to_get_current_exception_event = debug_to_get_current_exception_event;
+ current_target.to_pid_to_exec_file = debug_to_pid_to_exec_file;
+ current_target.to_core_file_to_sym_file = debug_to_core_file_to_sym_file;
+
+}
+\f
+
+static char targ_desc[] =
+"Names of targets and files being debugged.\n\
+Shows the entire stack of targets currently in use (including the exec-file,\n\
+core-file, and process, if any), as well as the symbol file name.";
+
+static void
+do_monitor_command (char *cmd,
+ int from_tty)
+{
+ if ((current_target.to_rcmd
+ == (void (*) (char *, struct ui_file *)) tcomplain)
+ || (current_target.to_rcmd == debug_to_rcmd
+ && (debug_target.to_rcmd
+ == (void (*) (char *, struct ui_file *)) tcomplain)))
+ {
+ error ("\"monitor\" command not supported by this target.\n");
+ }
+ target_rcmd (cmd, gdb_stdtarg);
+}
+
+void
+initialize_targets (void)
+{
+ init_dummy_target ();
+ push_target (&dummy_target);
+
+ add_info ("target", target_info, targ_desc);
+ add_info ("files", target_info, targ_desc);
+
+ add_show_from_set (
+ add_set_cmd ("target", class_maintenance, var_zinteger,
+ (char *) &targetdebug,
+ "Set target debugging.\n\
+When non-zero, target debugging is enabled.", &setdebuglist),
+ &showdebuglist);
+
+
+ add_com ("monitor", class_obscure, do_monitor_command,
+ "Send a command to the remote monitor (remote targets only).");