2003-06-08 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / target.c
index 561e1032ddd9abbba7b575c398392e92f12e1011..fd0165a19ba9129011486db90892eb50cb445ccb 100644 (file)
@@ -44,8 +44,6 @@ static void cleanup_target (struct target_ops *);
 
 static void maybe_kill_then_create_inferior (char *, char *, char **);
 
-static void default_clone_and_follow_inferior (int, int *);
-
 static void maybe_kill_then_attach (char *, int);
 
 static void kill_or_be_killed (int);
@@ -84,8 +82,8 @@ static void normal_target_post_startup_inferior (ptid_t ptid);
    partial transfers, try either target_read_memory_partial or
    target_write_memory_partial).  */
 
-static int
-target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write);
+static int target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+                              int write);
 
 static void init_dummy_target (void);
 
@@ -348,12 +346,6 @@ maybe_kill_then_create_inferior (char *exec, char *args, char **env)
   target_create_inferior (exec, args, env);
 }
 
-static void
-default_clone_and_follow_inferior (int child_pid, int *followed_child)
-{
-  target_clone_and_follow_inferior (child_pid, followed_child);
-}
-
 /* Clean up a target struct so it no longer has any zero pointers in it.
    We default entries, at least to stubs that print error messages.  */
 
@@ -376,14 +368,9 @@ cleanup_target (struct target_ops *t)
   de_fault (to_post_attach, 
            (void (*) (int)) 
            target_ignore);
-  de_fault (to_require_attach, 
-           maybe_kill_then_attach);
   de_fault (to_detach, 
            (void (*) (char *, int)) 
            target_ignore);
-  de_fault (to_require_detach, 
-           (void (*) (int, char *, int)) 
-           target_ignore);
   de_fault (to_resume, 
            (void (*) (ptid_t, int, enum target_signal)) 
            noprocess);
@@ -469,11 +456,6 @@ cleanup_target (struct target_ops *t)
   de_fault (to_acknowledge_created_inferior, 
            (void (*) (int)) 
            target_ignore);
-  de_fault (to_clone_and_follow_inferior, 
-           default_clone_and_follow_inferior);
-  de_fault (to_post_follow_inferior_by_clone, 
-           (void (*) (void)) 
-           target_ignore);
   de_fault (to_insert_fork_catchpoint, 
            (int (*) (int)) 
            tcomplain);
@@ -486,8 +468,8 @@ cleanup_target (struct target_ops *t)
   de_fault (to_remove_vfork_catchpoint, 
            (int (*) (int)) 
            tcomplain);
-  de_fault (to_post_follow_vfork, 
-           (void (*) (int, int, int, int)) 
+  de_fault (to_follow_fork,
+           (int (*) (int)) 
            target_ignore);
   de_fault (to_insert_exec_catchpoint, 
            (int (*) (int)) 
@@ -573,9 +555,7 @@ update_current_target (void)
       INHERIT (to_close, t);
       INHERIT (to_attach, t);
       INHERIT (to_post_attach, t);
-      INHERIT (to_require_attach, t);
       INHERIT (to_detach, t);
-      INHERIT (to_require_detach, t);
       INHERIT (to_resume, t);
       INHERIT (to_wait, t);
       INHERIT (to_post_wait, t);
@@ -593,6 +573,7 @@ update_current_target (void)
       INHERIT (to_remove_watchpoint, t);
       INHERIT (to_stopped_data_address, t);
       INHERIT (to_stopped_by_watchpoint, t);
+      INHERIT (to_have_continuable_watchpoint, t);
       INHERIT (to_region_size_ok_for_hw_watchpoint, t);
       INHERIT (to_terminal_init, t);
       INHERIT (to_terminal_inferior, t);
@@ -606,13 +587,11 @@ update_current_target (void)
       INHERIT (to_create_inferior, t);
       INHERIT (to_post_startup_inferior, t);
       INHERIT (to_acknowledge_created_inferior, t);
-      INHERIT (to_clone_and_follow_inferior, t);
-      INHERIT (to_post_follow_inferior_by_clone, t);
       INHERIT (to_insert_fork_catchpoint, t);
       INHERIT (to_remove_fork_catchpoint, t);
       INHERIT (to_insert_vfork_catchpoint, t);
       INHERIT (to_remove_vfork_catchpoint, t);
-      INHERIT (to_post_follow_vfork, t);
+      INHERIT (to_follow_fork, t);
       INHERIT (to_insert_exec_catchpoint, t);
       INHERIT (to_remove_exec_catchpoint, t);
       INHERIT (to_reported_exec_events_per_exec_call, t);
@@ -631,7 +610,6 @@ update_current_target (void)
       INHERIT (to_get_current_exception_event, t);
       INHERIT (to_pid_to_exec_file, t);
       INHERIT (to_stratum, t);
-      INHERIT (DONT_USE, t);
       INHERIT (to_has_all_memory, t);
       INHERIT (to_has_memory, t);
       INHERIT (to_has_stack, t);
@@ -1224,26 +1202,6 @@ find_default_attach (char *args, int from_tty)
   return;
 }
 
-void
-find_default_require_attach (char *args, int from_tty)
-{
-  struct target_ops *t;
-
-  t = find_default_run_target ("require_attach");
-  (t->to_require_attach) (args, from_tty);
-  return;
-}
-
-void
-find_default_require_detach (int pid, char *args, int from_tty)
-{
-  struct target_ops *t;
-
-  t = find_default_run_target ("require_detach");
-  (t->to_require_detach) (pid, args, from_tty);
-  return;
-}
-
 void
 find_default_create_inferior (char *exec_file, char *allargs, char **env)
 {
@@ -1254,20 +1212,10 @@ find_default_create_inferior (char *exec_file, char *allargs, char **env)
   return;
 }
 
-void
-find_default_clone_and_follow_inferior (int child_pid, int *followed_child)
-{
-  struct target_ops *t;
-
-  t = find_default_run_target ("run");
-  (t->to_clone_and_follow_inferior) (child_pid, followed_child);
-  return;
-}
-
 static int
 default_region_size_ok_for_hw_watchpoint (int byte_count)
 {
-  return (byte_count <= REGISTER_SIZE);
+  return (byte_count <= DEPRECATED_REGISTER_SIZE);
 }
 
 static int
@@ -1561,10 +1509,7 @@ init_dummy_target (void)
   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_find_memory_regions = dummy_find_memory_regions;
@@ -1608,15 +1553,6 @@ debug_to_post_attach (int 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)
 {
@@ -1625,15 +1561,6 @@ debug_to_detach (char *args, int 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 (ptid_t ptid, int step, enum target_signal siggnal)
 {
@@ -1713,7 +1640,7 @@ debug_print_register (const char * func, int regno)
   if (regno >= 0)
     {
       int i;
-      unsigned char *buf = alloca (MAX_REGISTER_RAW_SIZE);
+      unsigned char buf[MAX_REGISTER_SIZE];
       deprecated_read_register_gen (regno, buf);
       fprintf_unfiltered (gdb_stdlog, " = ");
       for (i = 0; i < REGISTER_RAW_SIZE (regno); i++)
@@ -2038,24 +1965,6 @@ debug_to_acknowledge_created_inferior (int pid)
                      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)
 {
@@ -2108,15 +2017,15 @@ debug_to_remove_vfork_catchpoint (int pid)
   return retval;
 }
 
-static void
-debug_to_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
-                           int followed_child)
+static int
+debug_to_follow_fork (int follow_child)
 {
-  debug_target.to_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child);
+  int retval =  debug_target.to_follow_fork (follow_child);
 
-  fprintf_unfiltered (gdb_stdlog,
-                     "target_post_follow_vfork (%d, %d, %d, %d)\n",
-                   parent_pid, followed_parent, child_pid, followed_child);
+  fprintf_unfiltered (gdb_stdlog, "target_follow_fork (%d) = %d\n",
+                     follow_child, retval);
+
+  return retval;
 }
 
 static int
@@ -2292,9 +2201,7 @@ setup_target_debug (void)
   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;
@@ -2325,13 +2232,11 @@ setup_target_debug (void)
   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_post_follow_vfork = debug_to_post_follow_vfork;
+  current_target.to_follow_fork = debug_to_follow_fork;
   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_reported_exec_events_per_exec_call = debug_to_reported_exec_events_per_exec_call;
This page took 0.027661 seconds and 4 git commands to generate.