]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2009-07-26 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Mon, 27 Jul 2009 02:23:53 +0000 (02:23 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 27 Jul 2009 02:23:53 +0000 (02:23 +0000)
Nearly working.

* target.h (struct target_ops): Change func args of
checkpoint methods.

checkpoint.c (checkpoint_command): Use target method,
bail if it isn't implemented.
(delete_checkpoint_command): Ditto.
(info_checkpoints_command): Ditto.
(restart_command): Ditto.

linux-fork.c (fork_list): Delete, use checkpoint list instead.
(forks_exist_p): Check checkpoint list instead of fork_list.
(delete_fork): Ditto.
(find_fork_ptid): Ditto.
(find_fork_id): Ditto.
(find_fork_pid): Ditto.
(add_fork): Ditto.
(linux_fork_killall): Ditto.
(linux_fork_mourn_inferior): Ditto.
(linux_fork_detach): Ditto.
(init_fork_list): Delete, no longer needed.
(delete_checkpoint_command): Ditto.
(info_checkpoints_command): Ditto.
(checkpoint_command): Ditto.
(restart_command): Ditto.
(linux_unset_checkpoint): New function (target method).
(linux_show_checkpoints_info): Ditto.
(linux_set_checkpoint): Ditto.
(linux_restore_checkpoint): Ditto.
(_initialize_linux_fork): Use new target methods.

* record.c (init_record_ops): Use new target methods.

gdb/ChangeLog
gdb/checkpoint.c
gdb/linux-fork.c
gdb/record.c
gdb/target.h

index 82093e63b302e167dec5d9ef0e16974416a0adc0..be96609feb5a94920c1f9d52db44fda16b47f122 100644 (file)
@@ -1,3 +1,39 @@
+2009-07-26  Michael Snyder  <msnyder@vmware.com>
+
+       Nearly working.
+
+       * target.h (struct target_ops): Change func args of
+       checkpoint methods.
+
+       checkpoint.c (checkpoint_command): Use target method, 
+       bail if it isn't implemented.
+       (delete_checkpoint_command): Ditto.
+       (info_checkpoints_command): Ditto.
+       (restart_command): Ditto.
+
+       linux-fork.c (fork_list): Delete, use checkpoint list instead.
+       (forks_exist_p): Check checkpoint list instead of fork_list.
+       (delete_fork): Ditto.
+       (find_fork_ptid): Ditto.
+       (find_fork_id): Ditto.
+       (find_fork_pid): Ditto.
+       (add_fork): Ditto.
+       (linux_fork_killall): Ditto.
+       (linux_fork_mourn_inferior): Ditto.
+       (linux_fork_detach): Ditto.
+       (init_fork_list): Delete, no longer needed.
+       (delete_checkpoint_command): Ditto.
+       (info_checkpoints_command): Ditto.
+       (checkpoint_command): Ditto.
+       (restart_command): Ditto.
+       (linux_unset_checkpoint): New function (target method).
+       (linux_show_checkpoints_info): Ditto.
+       (linux_set_checkpoint): Ditto.
+       (linux_restore_checkpoint): Ditto.
+       (_initialize_linux_fork): Use new target methods.
+
+       * record.c (init_record_ops): Use new target methods.
+
 2009-07-26  Michael Snyder  <msnyder@vmware.com>
 
        In-flux state: target methods temporarily broken.
index f6f974ff14edc10be237de4b90c978995baf3b2a..e6896c901a6b333494ef9632722be9f221fe5fae 100644 (file)
@@ -158,24 +158,21 @@ info_checkpoints_command (char *args, int from_tty)
 }
 
 #else
-/* FIXME replace by target method.  */
-extern void *record_insert_checkpoint (struct checkpoint_info *, int);
-extern void  record_delete_checkpoint (struct checkpoint_info *, int);
-extern void  record_show_checkpoint_info (struct checkpoint_info *, int);
-extern void  record_restore_checkpoint (struct checkpoint_info *, int);
-
 
 static void
 checkpoint_command (char *args, int from_tty)
 {
-  struct checkpoint_info *cp = checkpoint_insert (NULL);
+  struct checkpoint_info *cp;
+
+  if (!target_set_checkpoint)
+    error (_("checkpoint command not implemented for this target."));
 
+  cp = checkpoint_insert (NULL);
   if (cp != NULL)
     {
       if (from_tty)
        printf_filtered (_("Adding checkpoint #%d"), cp->checkpoint_id);
-      /* FIXME: here's the target method.  */
-      cp->client_data = record_insert_checkpoint (cp, from_tty);
+      cp->client_data = target_set_checkpoint (cp, from_tty);
       if (from_tty)
        puts_filtered (_("\n"));
     }
@@ -188,6 +185,9 @@ delete_checkpoint_command (char *args, int from_tty)
 {
   struct checkpoint_info *cp;
 
+  if (!target_unset_checkpoint)
+    error (_("delete checkpoint command not implemented for this target."));
+
   if (!args || !*args)
     error (_("Requires argument (checkpoint id to delete)"));
 
@@ -196,17 +196,21 @@ delete_checkpoint_command (char *args, int from_tty)
   if (cp == NULL)
     error (_("Not found: checkpoint id %s"), args);
 
-  /* FIXME: here's the target method.  */
-  record_delete_checkpoint (cp, from_tty);
+  target_unset_checkpoint (cp, from_tty);
   checkpoint_unlink (cp);
 }
 
 static void
 info_checkpoints_command (char *args, int from_tty)
 {
-  struct checkpoint_info *cp = checkpoint_first ();
+  struct checkpoint_info *cp;
   int requested = -1;
+  int printed = 0;
+
+  if (!target_info_checkpoints)
+    error (_("info checkpoint command not implemented for this target."));
 
+  cp = checkpoint_first ();
   if (cp == NULL)
     {
       printf_filtered ("No checkpoints.\n");
@@ -218,11 +222,16 @@ info_checkpoints_command (char *args, int from_tty)
 
   do
     {
-      /* Fixme: here's the target method.  */
       if (requested == -1 || requested == cp->checkpoint_id)
-       record_show_checkpoint_info (cp, from_tty);
+       {
+         target_info_checkpoints (cp, from_tty);
+         printed = 1;
+       }
       cp = checkpoint_next ();
     } while (cp != NULL);
+
+  if (!printed)
+    printf_filtered (_("No checkpoint number %d.\n"), requested);
 }
 
 static void
@@ -231,6 +240,9 @@ restart_command (char *args, int from_tty)
   extern void nullify_last_target_wait_ptid ();
   struct checkpoint_info *cp;
 
+  if (!target_restore_checkpoint)
+    error (_("restart command not implemented for this target."));
+
   if (!args || !*args)
     error (_("Requres argument (checkpoint id to restart)"));
 
@@ -238,8 +250,7 @@ restart_command (char *args, int from_tty)
   if (cp == NULL)
     error (_("Not found: checkpoint id %s"), args);
 
-  /* FIXME: here's the target method.  */
-  record_restore_checkpoint (cp, from_tty);
+  target_restore_checkpoint (cp, from_tty);
 
   registers_changed ();
   reinit_frame_cache ();
index fb7c6b4d3f56c64ea757b653773d0d866e8a1c08..6f1a3555b771cb3840fe40b912e0c1c7caf9d7ae 100644 (file)
@@ -36,9 +36,6 @@
 #include "gdb_dirent.h"
 #include <ctype.h>
 
-struct fork_info *fork_list;
-static int highest_fork_num;
-
 /* Prevent warning from -Wmissing-prototypes.  */
 extern void _initialize_linux_fork (void);
 
@@ -58,37 +55,12 @@ struct fork_info
   int maxfd;
 };
 
-/* Fork list methods:  */
+/* Fork list methods now use external checkpoint list.  */
 
 int
 forks_exist_p (void)
 {
-  return (fork_list != NULL);
-}
-
-/* Add a fork to the internal fork list.  */
-
-struct fork_info *
-add_fork (pid_t pid)
-{
-  struct fork_info *fp;
-
-  if (fork_list == NULL && pid != PIDGET (inferior_ptid))
-    {
-      /* Special case -- if this is the first fork in the list
-        (the list is hitherto empty), and if this new fork is
-        NOT the current inferior_ptid, then add inferior_ptid
-        first, as a special zeroeth fork id.  */
-      highest_fork_num = -1;
-      add_fork (PIDGET (inferior_ptid));       /* safe recursion */
-    }
-
-  fp = XZALLOC (struct fork_info);
-  fp->ptid = ptid_build (pid, pid, 0);
-  fp->num = ++highest_fork_num;
-  fp->next = fork_list;
-  fork_list = fp;
-  return fp;
+  return (checkpoint_first () != NULL);
 }
 
 static void
@@ -119,34 +91,36 @@ free_fork (struct fork_info *fp)
 static void
 delete_fork (ptid_t ptid)
 {
-  struct fork_info *fp, *fpprev;
-
-  fpprev = NULL;
+  struct fork_info *fp;
+  struct checkpoint_info *cp;
 
-  for (fp = fork_list; fp; fpprev = fp, fp = fp->next)
-    if (ptid_equal (fp->ptid, ptid))
-      break;
+  for (cp = checkpoint_first (); cp != NULL; cp = checkpoint_next ())
+    {
+      fp = cp->client_data;
+      if (fp && ptid_equal (fp->ptid, ptid))
+       break;
+    }
 
   if (!fp)
     return;
 
-  if (fpprev)
-    fpprev->next = fp->next;
-  else
-    fork_list = fp->next;
-
   free_fork (fp);
+  checkpoint_unlink (cp);
 
   /* Special case: if there is now only one process in the list,
      and if it is (hopefully!) the current inferior_ptid, then
      remove it, leaving the list empty -- we're now down to the
      default case of debugging a single process.  */
-  if (fork_list != NULL && fork_list->next == NULL &&
-      ptid_equal (fork_list->ptid, inferior_ptid))
+  if (checkpoint_first () != NULL  && checkpoint_next () == NULL)
     {
-      /* Last fork -- delete from list and handle as solo process
-        (should be a safe recursion).  */
-      delete_fork (inferior_ptid);
+      cp = checkpoint_first ();
+      fp = cp->client_data;
+      if (ptid_equal (fp->ptid, inferior_ptid))
+       {
+         /* Last fork -- delete from list and handle as solo process
+            (should be a safe recursion).  */
+         delete_fork (inferior_ptid);
+       }
     }
 }
 
@@ -155,11 +129,14 @@ static struct fork_info *
 find_fork_ptid (ptid_t ptid)
 {
   struct fork_info *fp;
+  struct checkpoint_info *cp;
 
-  for (fp = fork_list; fp; fp = fp->next)
-    if (ptid_equal (fp->ptid, ptid))
-      return fp;
-
+  for (cp = checkpoint_first (); cp != NULL; cp = checkpoint_next ())
+    {
+      fp = cp->client_data;
+      if (fp && ptid_equal (fp->ptid, ptid))
+       return fp;
+    }
   return NULL;
 }
 
@@ -167,12 +144,13 @@ find_fork_ptid (ptid_t ptid)
 static struct fork_info *
 find_fork_id (int num)
 {
-  struct fork_info *fp;
-
-  for (fp = fork_list; fp; fp = fp->next)
-    if (fp->num == num)
-      return fp;
+  struct checkpoint_info *cp;
 
+  for (cp = checkpoint_first (); cp != NULL; cp = checkpoint_next ())
+    {
+      if (cp->checkpoint_id == num)
+       return (struct fork_info *) cp->client_data;
+    }
   return NULL;
 }
 
@@ -181,14 +159,53 @@ extern struct fork_info *
 find_fork_pid (pid_t pid)
 {
   struct fork_info *fp;
+  struct checkpoint_info *cp;
 
-  for (fp = fork_list; fp; fp = fp->next)
-    if (pid == ptid_get_pid (fp->ptid))
-      return fp;
-
+  for (cp = checkpoint_first (); cp != NULL; cp = checkpoint_next ())
+    {
+      fp = cp->client_data;
+      if (fp && pid == ptid_get_pid (fp->ptid))
+       return fp;
+    }
   return NULL;
 }
 
+/* Add a fork to the external checkpoint list.  */
+
+struct fork_info *
+add_fork (pid_t pid)
+{
+  struct checkpoint_info *cp_first = checkpoint_first ();
+  struct fork_info *fp;
+
+  if (pid != PIDGET (inferior_ptid) && !find_fork_ptid (inferior_ptid))
+    {
+      /* Special case -- if inferior_ptid is not in the list, then
+        add inferior_ptid first, as a special zeroeth fork id.  */
+      checkpoint_insert (NULL);
+      add_fork (PIDGET (inferior_ptid));       /* safe recursion */
+    }
+
+  fp = XZALLOC (struct fork_info);
+  fp->ptid = ptid_build (pid, pid, 0);
+  if (cp_first && cp_first->client_data == NULL)
+    cp_first->client_data = fp;
+  else
+    checkpoint_insert (fp);
+
+#if 0
+  fp = find_fork_pid (pid);
+  if (fp == NULL)
+    {
+      fp = XZALLOC (struct fork_info);
+      fp->ptid = ptid_build (pid, pid, 0);
+      checkpoint_insert (fp);
+    }
+#endif
+
+  return fp;
+}
+
 static ptid_t
 fork_id_to_ptid (int num)
 {
@@ -199,23 +216,6 @@ fork_id_to_ptid (int num)
     return pid_to_ptid (-1);
 }
 
-static void
-init_fork_list (void)
-{
-  struct fork_info *fp, *fpnext;
-
-  if (!fork_list)
-    return;
-
-  for (fp = fork_list; fp; fp = fpnext)
-    {
-      fpnext = fp->next;
-      free_fork (fp);
-    }
-
-  fork_list = NULL;
-}
-
 /* Fork list <-> gdb interface.  */
 
 /* Utility function for fork_load/fork_save.
@@ -328,11 +328,16 @@ linux_fork_killall (void)
      or a parent, so may get a SIGCHLD from a previously
      killed child.  Wait them all out.  */
   struct fork_info *fp;
+  struct checkpoint_info *cp;
   pid_t pid, ret;
   int status;
 
-  for (fp = fork_list; fp; fp = fp->next)
+  for (cp = checkpoint_first (); cp != NULL; cp = checkpoint_next ())
     {
+      fp = cp->client_data;
+      if (!fp)
+       continue;
+
       pid = PIDGET (fp->ptid);
       do {
        /* Use SIGKILL instead of PTRACE_KILL because the former works
@@ -345,8 +350,9 @@ linux_fork_killall (void)
         aggravated by the first kill above - a child has just
         died.  MVS comment cut-and-pasted from linux-nat.  */
       } while (ret == pid && WIFSTOPPED (status));
+      free_fork (fp);
+      checkpoint_unlink (cp);
     }
-  init_fork_list ();   /* Clear list, prepare to start fresh.  */
 }
 
 /* The current inferior_ptid has exited, but there are other viable
@@ -364,22 +370,22 @@ linux_fork_mourn_inferior (void)
 
   waitpid (ptid_get_pid (inferior_ptid), &status, 0);
 
-  /* OK, presumably inferior_ptid is the one who has exited.
-     We need to delete that one from the fork_list, and switch
-     to the next available fork.  */
+  /* OK, presumably inferior_ptid is the one who has exited.  
+     We need to delete that one from the checkpoint list, and 
+     switch to the next available fork.  */
   delete_fork (inferior_ptid);
 
   /* There should still be a fork - if there's only one left,
      delete_fork won't remove it, because we haven't updated
      inferior_ptid yet.  */
-  gdb_assert (fork_list);
+  gdb_assert (checkpoint_first ());
 
-  fork_load_infrun_state (fork_list);
+  fork_load_infrun_state (checkpoint_first ()->client_data);
   printf_filtered (_("[Switching to %s]\n"),
                   target_pid_to_str (inferior_ptid));
 
   /* If there's only one fork, switch back to non-fork mode.  */
-  if (fork_list->next == NULL)
+  if (checkpoint_next () == NULL)
     delete_fork (inferior_ptid);
 }
 
@@ -390,9 +396,9 @@ linux_fork_mourn_inferior (void)
 void
 linux_fork_detach (char *args, int from_tty)
 {
-  /* OK, inferior_ptid is the one we are detaching from.  We need to
-     delete it from the fork_list, and switch to the next available
-     fork.  */
+  /* OK, inferior_ptid is the one we are detaching from.  We need
+     to delete it from the checkpoint list, and switch to the next
+     available fork.  */
 
   if (ptrace (PTRACE_DETACH, PIDGET (inferior_ptid), 0, 0))
     error (_("Unable to detach %s"), target_pid_to_str (inferior_ptid));
@@ -402,35 +408,27 @@ linux_fork_detach (char *args, int from_tty)
   /* There should still be a fork - if there's only one left,
      delete_fork won't remove it, because we haven't updated
      inferior_ptid yet.  */
-  gdb_assert (fork_list);
+  gdb_assert (checkpoint_first ());
 
-  fork_load_infrun_state (fork_list);
+  fork_load_infrun_state (checkpoint_first ()->client_data);
 
   if (from_tty)
     printf_filtered (_("[Switching to %s]\n"),
                     target_pid_to_str (inferior_ptid));
 
   /* If there's only one fork, switch back to non-fork mode.  */
-  if (fork_list->next == NULL)
+  if (checkpoint_next () == NULL)
     delete_fork (inferior_ptid);
 }
 
-/* Fork list <-> user interface.  */
+/* Fork checkpoint list <-> target interface.  */
 
-/* Delete checkpoint command: kill the process and remove it from
-   the fork list.  */
+/* target_unset_checkpoint == linux_unset_checkpoint.  */
 
 static void
-delete_checkpoint_command (char *args, int from_tty)
+linux_unset_checkpoint (struct checkpoint_info *cp, int from_tty)
 {
-  ptid_t ptid;
-
-  if (!args || !*args)
-    error (_("Requires argument (checkpoint id to delete)"));
-
-  ptid = fork_id_to_ptid (parse_and_eval_long (args));
-  if (ptid_equal (ptid, minus_one_ptid))
-    error (_("No such checkpoint id, %s"), args);
+  ptid_t ptid = ((struct fork_info *) cp->client_data)->ptid;
 
   if (ptid_equal (ptid, inferior_ptid))
     error (_("\
@@ -470,77 +468,57 @@ Please switch to another checkpoint before detaching the current one"));
   delete_fork (ptid);
 }
 
-/* Info checkpoints command: list all forks/checkpoints
-   currently under gdb's control.  */
+/* target_info_checkpoints == linux_show_checkpoints_info.  */
 
 static void
-info_checkpoints_command (char *arg, int from_tty)
+linux_show_checkpoints_info (struct checkpoint_info *cp, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
   struct frame_info *cur_frame;
   struct symtab_and_line sal;
   struct symtab *cur_symtab;
-  struct fork_info *fp;
+  struct fork_info *fp = cp->client_data;
   int cur_line;
   ULONGEST pc;
-  int requested = -1;
-  struct fork_info *printed = NULL;
-
-  if (arg && *arg)
-    requested = (int) parse_and_eval_long (arg);
 
-  for (fp = fork_list; fp; fp = fp->next)
+  if (ptid_equal (fp->ptid, inferior_ptid))
     {
-      if (requested > 0 && fp->num != requested)
-       continue;
+      printf_filtered ("* ");
+      pc = regcache_read_pc (get_current_regcache ());
+    }
+  else
+    {
+      printf_filtered ("  ");
+      pc = regcache_read_pc (fp->savedregs);
+    }
+  printf_filtered ("%d %s", cp->checkpoint_id, target_pid_to_str (fp->ptid));
+  if (cp->checkpoint_id == 0)
+    printf_filtered (_(" (main process)"));
+  printf_filtered (_(" at "));
+  fputs_filtered (paddress (gdbarch, pc), gdb_stdout);
+
+  sal = find_pc_line (pc, 0);
+  if (sal.symtab)
+    {
+      char *tmp = strrchr (sal.symtab->filename, '/');
 
-      printed = fp;
-      if (ptid_equal (fp->ptid, inferior_ptid))
-       {
-         printf_filtered ("* ");
-         pc = regcache_read_pc (get_current_regcache ());
-       }
+      if (tmp)
+       printf_filtered (_(", file %s"), tmp + 1);
       else
-       {
-         printf_filtered ("  ");
-         pc = regcache_read_pc (fp->savedregs);
-       }
-      printf_filtered ("%d %s", fp->num, target_pid_to_str (fp->ptid));
-      if (fp->num == 0)
-       printf_filtered (_(" (main process)"));
-      printf_filtered (_(" at "));
-      fputs_filtered (paddress (gdbarch, pc), gdb_stdout);
-
-      sal = find_pc_line (pc, 0);
-      if (sal.symtab)
-       {
-         char *tmp = strrchr (sal.symtab->filename, '/');
-
-         if (tmp)
-           printf_filtered (_(", file %s"), tmp + 1);
-         else
-           printf_filtered (_(", file %s"), sal.symtab->filename);
-       }
-      if (sal.line)
-       printf_filtered (_(", line %d"), sal.line);
-      if (!sal.symtab && !sal.line)
-       {
-         struct minimal_symbol *msym;
-
-         msym = lookup_minimal_symbol_by_pc (pc);
-         if (msym)
-           printf_filtered (", <%s>", SYMBOL_LINKAGE_NAME (msym));
-       }
-
-      putchar_filtered ('\n');
+       printf_filtered (_(", file %s"), sal.symtab->filename);
     }
-  if (printed == NULL)
+  if (sal.line)
+    printf_filtered (_(", line %d"), sal.line);
+  if (!sal.symtab && !sal.line)
     {
-      if (requested > 0)
-       printf_filtered (_("No checkpoint number %d.\n"), requested);
-      else
-       printf_filtered (_("No checkpoints.\n"));
+      struct minimal_symbol *msym;
+
+      msym = lookup_minimal_symbol_by_pc (pc);
+      if (msym)
+       printf_filtered (", <%s>", SYMBOL_LINKAGE_NAME (msym));
     }
+
+  putchar_filtered ('\n');
 }
 
 /* The PID of the process we're checkpointing.  */
@@ -552,11 +530,10 @@ linux_fork_checkpointing_p (int pid)
   return (checkpointing_pid == pid);
 }
 
-/* checkpoint_command: create a fork of the inferior process
-   and set it aside for later debugging.  */
+/* target_set_checkpoint == linux_set_checkpoint.  */
 
-static void
-checkpoint_command (char *args, int from_tty)
+static void *
+linux_set_checkpoint (struct checkpoint_info *cp, int from_tty)
 {
   struct objfile *fork_objf;
   struct gdbarch *gdbarch;
@@ -596,7 +573,7 @@ checkpoint_command (char *args, int from_tty)
     {
       int parent_pid;
 
-      printf_filtered (_("checkpoint: fork returned pid %ld.\n"),
+      printf_filtered (_(": fork returned pid %ld.\n"),
                       (long) retpid);
       if (info_verbose)
        {
@@ -612,46 +589,16 @@ checkpoint_command (char *args, int from_tty)
   if (!fp)
     error (_("Failed to find new fork"));
   fork_save_infrun_state (fp, 1);
-}
 
-static void
-linux_fork_context (struct fork_info *newfp, int from_tty)
-{
-  /* Now we attempt to switch processes.  */
-  struct fork_info *oldfp;
-  ptid_t ptid;
-  int id, i;
-
-  gdb_assert (newfp != NULL);
-
-  oldfp = find_fork_ptid (inferior_ptid);
-  gdb_assert (oldfp != NULL);
-
-  fork_save_infrun_state (oldfp, 1);
-  remove_breakpoints ();
-  fork_load_infrun_state (newfp);
-  insert_breakpoints ();
-
-  printf_filtered (_("Switching to %s\n"),
-                  target_pid_to_str (inferior_ptid));
-
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  return fp;
 }
 
-/* Switch inferior process (checkpoint) context, by checkpoint id.  */
+/* target_restore_checkpoint == linux_restore_checkpoint.  */
 
 static void
-restart_command (char *args, int from_tty)
+linux_restore_checkpoint (struct checkpoint_info *cp, int from_tty)
 {
-  struct fork_info *fp;
-
-  if (!args || !*args)
-    error (_("Requires argument (checkpoint id to restart)"));
-
-  if ((fp = find_fork_id (parse_and_eval_long (args))) == NULL)
-    error (_("Not found: checkpoint id %s"), args);
-
-  linux_fork_context (fp, from_tty);
+  linux_fork_context ((struct fork_info *) cp->client_data, from_tty);
 }
 
 void
@@ -659,8 +606,6 @@ _initialize_linux_fork (void)
 {
   struct target_ops *t;
 
-  init_fork_list ();
-
   /* Set/show detach-on-fork: user-settable mode.  */
 
   add_setshow_boolean_cmd ("detach-on-fork", class_obscure, &detach_fork, _("\
@@ -679,10 +624,10 @@ Detach from a checkpoint (experimental)."),
   /* Get the linux target vector.  */
   t = linux_target ();
   /* Add checkpoint target methods.  */
-  t->to_set_checkpoint = checkpoint_command;
-  t->to_unset_checkpoint = delete_checkpoint_command;
-  t->to_restore_checkpoint = restart_command;
-  t->to_info_checkpoints = info_checkpoints_command;
+  t->to_set_checkpoint = linux_set_checkpoint;
+  t->to_unset_checkpoint = linux_unset_checkpoint;
+  t->to_restore_checkpoint = linux_restore_checkpoint;
+  t->to_info_checkpoints = linux_show_checkpoints_info;
 
   /* Activate the checkpoint module.  */
   checkpoint_init ();
index 49adb5df7d77567378ecef80e4bc697a6ffe3b37..d383f4198faa0bb6075818a5c005088cb4c62648 100644 (file)
@@ -118,6 +118,13 @@ static int (*record_beneath_to_insert_breakpoint) (struct gdbarch *,
 static int (*record_beneath_to_remove_breakpoint) (struct gdbarch *,
                                                   struct bp_target_info *);
 
+/* Checkpoint target methods.  */
+
+static void *record_insert_checkpoint (struct checkpoint_info *, int);
+static void record_delete_checkpoint (struct checkpoint_info *, int);
+static void record_show_checkpoint_info (struct checkpoint_info *, int);
+static void record_restore_checkpoint (struct checkpoint_info *, int);
+
 static void
 record_list_release (struct record_entry *rec)
 {
@@ -1109,6 +1116,11 @@ init_record_ops (void)
   record_ops.to_remove_breakpoint = record_remove_breakpoint;
   record_ops.to_can_execute_reverse = record_can_execute_reverse;
   record_ops.to_stratum = record_stratum;
+  /* Checkpoints */
+  record_ops.to_set_checkpoint = record_insert_checkpoint;
+  record_ops.to_unset_checkpoint = record_delete_checkpoint;
+  record_ops.to_info_checkpoints = record_show_checkpoint_info;
+  record_ops.to_restore_checkpoint = record_restore_checkpoint;
   record_ops.to_magic = OPS_MAGIC;
 }
 
@@ -1226,7 +1238,7 @@ struct record_checkpoint_info
   CORE_ADDR pc;                                /* program counter of checkpoint */
 };
 
-void *
+static void *
 record_insert_checkpoint (struct checkpoint_info *cp, int from_tty)
 {
   struct record_checkpoint_info *rp;
@@ -1244,13 +1256,13 @@ record_insert_checkpoint (struct checkpoint_info *cp, int from_tty)
   return rp;
 }
 
-void
+static void
 record_delete_checkpoint (struct checkpoint_info *cp, int from_tty)
 {
   xfree (cp->client_data);
 }
 
-void
+static void
 record_show_checkpoint_info (struct checkpoint_info *cp, int from_tty)
 {
   struct record_checkpoint_info *re = cp->client_data;
@@ -1333,7 +1345,7 @@ record_goto_checkpoint (struct record_entry *checkpoint,
   do_cleanups (set_cleanups);
 }
 
-void
+static void
 record_restore_checkpoint (struct checkpoint_info *cp, int from_tty)
 {
   int i = 0, checkpoint_index = 0, current_index = 0;
index 81808532cce0e048868cd04366eced310b77492f..cd5a495f2a9dec181fdd04daa9157a2938394546 100644 (file)
@@ -308,7 +308,9 @@ extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
                                            CORE_ADDR addr, int len,
                                            enum bfd_endian byte_order);
 \f
-struct thread_info;            /* fwd decl for parameter list below: */
+/* Forward decls for parameter list below.  */
+struct thread_info;
+struct checkpoint_info;
 
 struct target_ops
   {
@@ -556,16 +558,16 @@ struct target_ops
     struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t);
 
     /* Set a checkpoint.  */
-    void (*to_set_checkpoint) (char *, int);
+    void *(*to_set_checkpoint) (struct checkpoint_info *, int);
 
     /* Unset a checkpoint.  */
-    void (*to_unset_checkpoint) (char *, int);
+    void (*to_unset_checkpoint) (struct checkpoint_info *, int);
 
     /* Restore a checkpoint.  */
-    void (*to_restore_checkpoint) (char *, int);
+    void (*to_restore_checkpoint) (struct checkpoint_info *, int);
 
     /* List checkpoints.  */
-    void (*to_info_checkpoints) (char *, int);
+    void (*to_info_checkpoints) (struct checkpoint_info *, int);
 
     int to_magic;
     /* Need sub-structure for target machine related rather than comm related?