doc/gdbinv-s.m4.in: remove text on special procedures to continue after
[deliverable/binutils-gdb.git] / gdb / core.c
index 40e44fead78215b9a1a6ff6bfe199e285dc5bdf1..9c7d27ea6a8fc367dfed62ad87c64e1ac4ec845f 100644 (file)
 /* Work with core dump and executable files, for GDB.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
-GDB is free software; you can redistribute it and/or modify
+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 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-GDB is distributed in the hope that it will be useful,
+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 GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
-#include "param.h"
+#include <errno.h>
+#include <signal.h>
+#include <fcntl.h>
 #include "frame.h"  /* required by inferior.h */
 #include "inferior.h"
-
-#ifdef USG
-#include <sys/types.h>
-#include <fcntl.h>
+#include "symtab.h"
+#include "command.h"
+#include "bfd.h"
+#include "target.h"
+#include "gdbcore.h"
+
+#ifdef SOLIB_ADD
+static int 
+solib_add_stub PARAMS ((char *));
 #endif
 
-#ifdef COFF_ENCAPSULATE
-#include "a.out.encap.h"
-#else
-#include <a.out.h>
-#endif
-#ifndef N_MAGIC
-#ifdef COFF_FORMAT
-#define N_MAGIC(exec) ((exec).magic)
-#else
-#define N_MAGIC(exec) ((exec).a_magic)
-#endif
-#endif
-#include <stdio.h>
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#ifdef UMAX_CORE
-#include <sys/ptrace.h>
-#else
-#include <sys/user.h>
-#endif
+static void
+core_close PARAMS ((int));
 
-#ifndef N_TXTADDR
-#define N_TXTADDR(hdr) 0
-#endif /* no N_TXTADDR */
+static void
+core_open PARAMS ((char *, int));
 
-#ifndef N_DATADDR
-#define N_DATADDR(hdr) hdr.a_text
-#endif /* no N_DATADDR */
+static void
+core_detach PARAMS ((char *, int));
 
-#ifndef COFF_FORMAT
-#ifndef AOUTHDR
-#define AOUTHDR                struct exec
-#endif
-#endif
+static void
+get_core_registers PARAMS ((int));
 
-extern char *sys_siglist[];
+static void
+core_files_info PARAMS ((struct target_ops *));
 
-extern core_file_command (), exec_file_command ();
+extern char registers[];
 
 /* Hook for `exec_file_command' command to call.  */
 
-void (*exec_file_display_hook) ();
-   
-/* File names of core file and executable file.  */
+void (*exec_file_display_hook) PARAMS ((char *)) = NULL;
 
-char *corefile;
-char *execfile;
+/* Binary file diddling handle for the core file.  */
 
-/* Descriptors on which core file and executable file are open.
-   Note that the execchan is closed when an inferior is created
-   and reopened if the inferior dies or is killed.  */
+bfd *core_bfd = NULL;
 
-int corechan;
-int execchan;
+/* Forward decl */
+extern struct target_ops core_ops;
 
-/* Last modification time of executable file.
-   Also used in source.c to compare against mtime of a source file.  */
+\f
+/* Discard all vestiges of any previous core file
+   and mark data and stack spaces as empty.  */
 
-int exec_mtime;
+/* ARGSUSED */
+static void
+core_close (quitting)
+     int quitting;
+{
+  if (core_bfd) {
+    free (bfd_get_filename (core_bfd));
+    bfd_close (core_bfd);
+    core_bfd = NULL;
+#ifdef CLEAR_SOLIB
+    CLEAR_SOLIB ();
+#endif
+    if (core_ops.to_sections) {
+      free ((PTR)core_ops.to_sections);
+      core_ops.to_sections = NULL;
+      core_ops.to_sections_end = NULL;
+    }
+  }
+}
 
-/* Virtual addresses of bounds of the two areas of memory in the core file.  */
+#ifdef SOLIB_ADD
+/* Stub function for catch_errors around shared library hacking. */
 
-CORE_ADDR data_start;
-CORE_ADDR data_end;
-CORE_ADDR stack_start;
-CORE_ADDR stack_end;
+static int 
+solib_add_stub (from_tty)
+     char *from_tty;
+{
+    SOLIB_ADD (NULL, (int)from_tty, &core_ops);
+    return 0;
+}
+#endif /* SOLIB_ADD */
 
-/* Virtual addresses of bounds of two areas of memory in the exec file.
-   Note that the data area in the exec file is used only when there is no core file.  */
+/* This routine opens and sets up the core file bfd */
 
-CORE_ADDR text_start;
-CORE_ADDR text_end;
+static void
+core_open (filename, from_tty)
+     char *filename;
+     int from_tty;
+{
+  const char *p;
+  int siggy;
+  struct cleanup *old_chain;
+  char *temp;
+  bfd *temp_bfd;
+  int ontop;
+  int scratch_chan;
+
+  target_preopen (from_tty);
+  if (!filename)
+    {
+      error (core_bfd? 
+       "No core file specified.  (Use `detach' to stop debugging a core file.)"
+     : "No core file specified.");
+    }
 
-CORE_ADDR exec_data_start;
-CORE_ADDR exec_data_end;
+  filename = tilde_expand (filename);
+  if (filename[0] != '/') {
+    temp = concat (current_directory, "/", filename, NULL);
+    free (filename);
+    filename = temp;
+  }
 
-/* Offset within executable file of start of text area data.  */
+  old_chain = make_cleanup (free, filename);
 
-int text_offset;
+  scratch_chan = open (filename, write_files? O_RDWR: O_RDONLY, 0);
+  if (scratch_chan < 0)
+    perror_with_name (filename);
 
-/* Offset within executable file of start of data area data.  */
+  temp_bfd = bfd_fdopenr (filename, NULL, scratch_chan);
+  if (temp_bfd == NULL)
+    {
+      perror_with_name (filename);
+    }
+
+  if (!bfd_check_format (temp_bfd, bfd_core))
+    {
+      /* Do it after the err msg */
+      make_cleanup (bfd_close, temp_bfd);
+      error ("\"%s\" is not a core dump: %s", filename, bfd_errmsg(bfd_error));
+    }
 
-int exec_data_offset;
+  /* Looks semi-reasonable.  Toss the old core file and work on the new.  */
 
-/* Offset within core file of start of data area data.  */
+  discard_cleanups (old_chain);                /* Don't free filename any more */
+  unpush_target (&core_ops);
+  core_bfd = temp_bfd;
+  old_chain = make_cleanup (core_close, core_bfd);
 
-int data_offset;
+  validate_files ();
 
-/* Offset within core file of start of stack area data.  */
+  /* Find the data section */
+  if (build_section_table (core_bfd, &core_ops.to_sections,
+                          &core_ops.to_sections_end))
+    error ("Can't find sections in `%s': %s", bfd_get_filename(core_bfd),
+          bfd_errmsg (bfd_error));
 
-int stack_offset;
-  
-#ifdef COFF_FORMAT
-/* various coff data structures */
+  ontop = !push_target (&core_ops);
+  discard_cleanups (old_chain);
 
-FILHDR file_hdr;
-SCNHDR text_hdr;
-SCNHDR data_hdr;
+  p = bfd_core_file_failing_command (core_bfd);
+  if (p)
+    printf ("Core was generated by `%s'.\n", p);
 
-#endif /* not COFF_FORMAT */
+  siggy = bfd_core_file_failing_signal (core_bfd);
+  if (siggy > 0)
+    printf ("Program terminated with signal %d, %s.\n", siggy,
+           safe_strsignal (siggy));
 
-/* a.out header saved in core file.  */
-  
-AOUTHDR core_aouthdr;
+  if (ontop) {
+    /* Fetch all registers from core file */
+    target_fetch_registers (-1);
+
+    /* Add symbols and section mappings for any shared libraries */
+#ifdef SOLIB_ADD
+    catch_errors (solib_add_stub, (char *)from_tty, (char *)0);
+#endif
+
+    /* Now, set up the frame cache, and print the top of stack */
+    set_current_frame (create_new_frame (read_register (FP_REGNUM),
+                                        read_pc ()));
+    select_frame (get_current_frame (), 0);
+    print_stack_frame (selected_frame, selected_frame_level, 1);
+  } else {
+    warning (
+"you won't be able to access this core file until you terminate\n\
+your %s; do ``info files''", current_target->to_longname);
+  }
+}
+
+static void
+core_detach (args, from_tty)
+     char *args;
+     int from_tty;
+{
+  if (args)
+    error ("Too many arguments");
+  unpush_target (&core_ops);
+  if (from_tty)
+    printf ("No core file now.\n");
+}
 
-/* a.out header of exec file.  */
+/* Backward compatability with old way of specifying core files.  */
 
-AOUTHDR exec_aouthdr;
+void
+core_file_command (filename, from_tty)
+     char *filename;
+     int from_tty;
+{
+  dont_repeat ();                      /* Either way, seems bogus. */
+  if (!filename)
+    core_detach (filename, from_tty);
+  else
+    core_open (filename, from_tty);
+}
 
-void validate_files ();
-unsigned int register_addr ();
 \f
 /* Call this to specify the hook for exec_file_command to call back.
    This is called from the x-window display code.  */
 
 void
 specify_exec_file_hook (hook)
-     void (*hook) ();
+     void (*hook) PARAMS ((char *));
 {
   exec_file_display_hook = hook;
 }
@@ -160,41 +239,33 @@ specify_exec_file_hook (hook)
 void
 close_exec_file ()
 {
-  if (execchan >= 0)
-    close (execchan);
-  execchan = -1;
+#ifdef FIXME
+  if (exec_bfd)
+    bfd_tempclose (exec_bfd);
+#endif
 }
 
 void
 reopen_exec_file ()
 {
-  if (execchan < 0 && execfile != 0)
-    {
-      char *filename = concat (execfile, "", "");
-      exec_file_command (filename, 0);
-      free (filename);
-    }
+#ifdef FIXME
+  if (exec_bfd)
+    bfd_reopen (exec_bfd);
+#endif
 }
 \f
 /* If we have both a core file and an exec file,
-   print a warning if they don't go together.
-   This should really check that the core file came
-   from that exec file, but I don't know how to do it.  */
+   print a warning if they don't go together.  */
 
 void
 validate_files ()
 {
-  if (execfile != 0 && corefile != 0)
+  if (exec_bfd && core_bfd)
     {
-      struct stat st_core;
-
-      fstat (corechan, &st_core);
-
-      if (N_MAGIC (core_aouthdr) != 0
-         && bcmp (&core_aouthdr, &exec_aouthdr, sizeof core_aouthdr))
-       printf ("Warning: core file does not match specified executable file.\n");
-      else if (exec_mtime > st_core.st_mtime)
-       printf ("Warning: exec file is newer than core file.\n");
+      if (!core_file_matches_executable_p (core_bfd, exec_bfd))
+       warning ("core file may not match specified executable file.");
+      else if (bfd_get_mtime(exec_bfd) > bfd_get_mtime(core_bfd))
+       warning ("exec file is newer than core file.");
     }
 }
 
@@ -206,323 +277,183 @@ char *
 get_exec_file (err)
      int err;
 {
-  if (err && execfile == 0)
-    error ("No executable file specified.\n\
-Use the \"exec-file\" and \"symbol-file\" commands.");
-  return execfile;
+  if (exec_bfd) return bfd_get_filename(exec_bfd);
+  if (!err)     return NULL;
+
+  error ("No executable file specified.\n\
+Use the \"file\" or \"exec-file\" command.");
+  return NULL;
 }
 
-int
-have_core_file_p ()
+static void
+core_files_info (t)
+  struct target_ops *t;
 {
-  return corefile != 0;
+  print_section_info (t, core_bfd);
 }
+\f
+/* Report a memory error with error().  */
 
-static void
-files_info ()
+void
+memory_error (status, memaddr)
+     int status;
+     CORE_ADDR memaddr;
 {
-  char *symfile;
-  extern char *get_sym_file ();
 
-  if (execfile)
-    printf ("Executable file \"%s\".\n", execfile);
-  else
-    printf ("No executable file\n");
-  if (corefile == 0)
-    printf ("No core dump file\n");
+  if (status == EIO)
+    {
+      /* Actually, address between memaddr and memaddr + len
+        was out of bounds. */
+      error ("Cannot access memory at address %s.", local_hex_string(memaddr));
+    }
   else
-    printf ("Core dump file \"%s\".\n", corefile);
-
-  if (have_inferior_p ())
-    printf ("Using the running image of the program, rather than these files.\n");
-
-  symfile = get_sym_file ();
-  if (symfile != 0)
-    printf ("Symbols from \"%s\".\n", symfile);
-
-#ifdef FILES_INFO_HOOK
-  if (FILES_INFO_HOOK ())
-    return;
-#endif
-
-  if (! have_inferior_p ())
     {
-      if (execfile)
-       {
-         printf ("Text segment in executable from 0x%x to 0x%x.\n",
-                 text_start, text_end);
-         printf ("Data segment in executable from 0x%x to 0x%x.\n",
-                 exec_data_start, exec_data_end);
-         if (corefile)
-           printf ("(But since we have a core file, we're using...)\n");
-       }
-      if (corefile)
-       {
-         printf ("Data segment in core file from 0x%x to 0x%x.\n",
-                 data_start, data_end);
-         printf ("Stack segment in core file from 0x%x to 0x%x.\n",
-                 stack_start, stack_end);
-       }
+      error ("Error accessing memory address %s: %s.",
+            local_hex_string (memaddr), safe_strerror (status));
     }
 }
-\f
-/* Read "memory data" from core file and/or executable file.
-   Returns zero if successful, 1 if xfer_core_file failed, errno value if
-   ptrace failed. */
 
-int
+/* Same as target_read_memory, but report an error if can't read.  */
+void
 read_memory (memaddr, myaddr, len)
      CORE_ADDR memaddr;
      char *myaddr;
      int len;
 {
-  if (len == 0)
-    return 0;
-
-  if (have_inferior_p ())
-    {
-      if (remote_debugging)
-       return remote_read_inferior_memory (memaddr, myaddr, len);
-      else
-       return read_inferior_memory (memaddr, myaddr, len);
-    }
-  else
-      return xfer_core_file (memaddr, myaddr, len);
+  int status;
+  status = target_read_memory (memaddr, myaddr, len);
+  if (status != 0)
+    memory_error (status, memaddr);
 }
 
-/* Write LEN bytes of data starting at address MYADDR
-   into debugged program memory at address MEMADDR.
-   Returns zero if successful, or an errno value if ptrace failed.  */
-
-int
+/* Same as target_write_memory, but report an error if can't write.  */
+void
 write_memory (memaddr, myaddr, len)
      CORE_ADDR memaddr;
      char *myaddr;
      int len;
 {
-  if (have_inferior_p ())
-    {
-      if (remote_debugging)
-       return remote_write_inferior_memory (memaddr, myaddr, len);
-      else
-       return write_inferior_memory (memaddr, myaddr, len);
-    }
-  else
-    error ("Can write memory only when program being debugged is running.");
-}
+  int status;
 
-#ifndef XFER_CORE_FILE
-/* Read from the program's memory (except for inferior processes).
-   This function is misnamed, since it only reads, never writes; and
-   since it will use the core file and/or executable file as necessary.
-
-   It should be extended to write as well as read, FIXME, for patching files.
+  status = target_write_memory (memaddr, myaddr, len);
+  if (status != 0)
+    memory_error (status, memaddr);
+}
 
-   Return 0 if address could be read, 1 if not. */
+/* Read an integer from debugged memory, given address and number of bytes.  */
 
-int
-xfer_core_file (memaddr, myaddr, len)
+long
+read_memory_integer (memaddr, len)
      CORE_ADDR memaddr;
-     char *myaddr;
      int len;
 {
-  register int i;
-  register int val;
-  int xferchan;
-  char **xferfile;
-  int fileptr;
-  int returnval = 0;
-
-  while (len > 0)
+  char cbuf;
+  short sbuf;
+  int ibuf;
+  long lbuf;
+
+  if (len == sizeof (char))
     {
-      xferfile = 0;
-      xferchan = 0;
-
-      /* Determine which file the next bunch of addresses reside in,
-        and where in the file.  Set the file's read/write pointer
-        to point at the proper place for the desired address
-        and set xferfile and xferchan for the correct file.
-
-        If desired address is nonexistent, leave them zero.
-
-        i is set to the number of bytes that can be handled
-        along with the next address.
-
-        We put the most likely tests first for efficiency.  */
-
-      /* Note that if there is no core file
-        data_start and data_end are equal.  */
-      if (memaddr >= data_start && memaddr < data_end)
-       {
-         i = min (len, data_end - memaddr);
-         fileptr = memaddr - data_start + data_offset;
-         xferfile = &corefile;
-         xferchan = corechan;
-       }
-      /* Note that if there is no core file
-        stack_start and stack_end are equal.  */
-      else if (memaddr >= stack_start && memaddr < stack_end)
-       {
-         i = min (len, stack_end - memaddr);
-         fileptr = memaddr - stack_start + stack_offset;
-         xferfile = &corefile;
-         xferchan = corechan;
-       }
-      else if (corechan < 0
-              && memaddr >= exec_data_start && memaddr < exec_data_end)
-       {
-         i = min (len, exec_data_end - memaddr);
-         fileptr = memaddr - exec_data_start + exec_data_offset;
-         xferfile = &execfile;
-         xferchan = execchan;
-       }
-      else if (memaddr >= text_start && memaddr < text_end)
-       {
-         i = min (len, text_end - memaddr);
-         fileptr = memaddr - text_start + text_offset;
-         xferfile = &execfile;
-         xferchan = execchan;
-       }
-      else if (memaddr < text_start)
-       {
-         i = min (len, text_start - memaddr);
-       }
-      else if (memaddr >= text_end
-              && memaddr < (corechan >= 0? data_start : exec_data_start))
-       {
-         i = min (len, data_start - memaddr);
-       }
-      else if (corechan >= 0
-              && memaddr >= data_end && memaddr < stack_start)
-       {
-         i = min (len, stack_start - memaddr);
-       }
-      else if (corechan < 0 && memaddr >= exec_data_end)
-       {
-         /* Since there is nothing at higher addresses than data
-            (without a core file or an inferior, there is no
-            stack, set i to do the rest of the operation now.  */
-         i = len;
-       }
-      else if (memaddr >= stack_end && stack_end != 0)
-       {
-         /* Since there is nothing at higher addresses than
-            the stack, set i to do the rest of the operation now.  */
-         i = len;
-       }
-      else
-       {
-         /* Address did not classify into one of the known ranges.
-            This shouldn't happen; we catch the endpoints.  */
-         fatal ("Internal: Bad case logic in xfer_core_file.");
-       }
-
-      /* Now we know which file to use.
-        Set up its pointer and transfer the data.  */
-      if (xferfile)
-       {
-         if (*xferfile == 0)
-           if (xferfile == &execfile)
-             error ("No program file to examine.");
-           else
-             error ("No core dump file or running program to examine.");
-         val = lseek (xferchan, fileptr, 0);
-         if (val < 0)
-           perror_with_name (*xferfile);
-         val = myread (xferchan, myaddr, i);
-         if (val < 0)
-           perror_with_name (*xferfile);
-       }
-      /* If this address is for nonexistent memory,
-        read zeros if reading, or do nothing if writing.
-        Actually, we never right.  */
-      else
-       {
-         bzero (myaddr, i);
-         returnval = 1;
-       }
-
-      memaddr += i;
-      myaddr += i;
-      len -= i;
+      read_memory (memaddr, &cbuf, len);
+      return cbuf;
     }
-  return returnval;
-}
-#endif /* XFER_CORE_FILE */
-\f
-/* My replacement for the read system call.
-   Used like `read' but keeps going if `read' returns too soon.  */
-
-int
-myread (desc, addr, len)
-     int desc;
-     char *addr;
-     int len;
-{
-  register int val;
-  int orglen = len;
-
-  while (len > 0)
+  if (len == sizeof (short))
+    {
+      read_memory (memaddr, (char *)&sbuf, len);
+      SWAP_TARGET_AND_HOST (&sbuf, sizeof (short));
+      return sbuf;
+    }
+  if (len == sizeof (int))
+    {
+      read_memory (memaddr, (char *)&ibuf, len);
+      SWAP_TARGET_AND_HOST (&ibuf, sizeof (int));
+      return ibuf;
+    }
+  if (len == sizeof (lbuf))
     {
-      val = read (desc, addr, len);
-      if (val < 0)
-       return val;
-      if (val == 0)
-       return orglen - len;
-      len -= val;
-      addr += val;
+      read_memory (memaddr, (char *)&lbuf, len);
+      SWAP_TARGET_AND_HOST (&lbuf, sizeof (lbuf));
+      return lbuf;
     }
-  return orglen;
+  error ("Cannot handle integers of %d bytes.", len);
+  return -1;   /* for lint */
 }
 \f
-#ifdef REGISTER_U_ADDR
-
-/* Return the address in the core dump or inferior of register REGNO.
-   BLOCKEND is the address of the end of the user structure.  */
+/* Get the registers out of a core file.  This is the machine-
+   independent part.  Fetch_core_registers is the machine-dependent
+   part, typically implemented in the xm-file for each architecture.  */
 
-unsigned int
-register_addr (regno, blockend)
+/* We just get all the registers, so we don't use regno.  */
+/* ARGSUSED */
+static void
+get_core_registers (regno)
      int regno;
-     int blockend;
 {
-  int addr;
-
-  if (regno < 0 || regno >= NUM_REGS)
-    error ("Invalid register number %d.", regno);
-
-  REGISTER_U_ADDR (addr, blockend, regno);
+  sec_ptr reg_sec;
+  unsigned size;
+  char *the_regs;
+
+  reg_sec = bfd_get_section_by_name (core_bfd, ".reg");
+  if (!reg_sec) goto cant;
+  size = bfd_section_size (core_bfd, reg_sec);
+  the_regs = alloca (size);
+  if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0, size))
+    {
+      fetch_core_registers (the_regs, size, 0,
+                           (unsigned) bfd_section_vma (abfd,reg_sec));
+    }
+  else
+    {
+cant:
+      fprintf (stderr, "Couldn't fetch registers from core file: %s\n",
+              bfd_errmsg (bfd_error));
+    }
 
-  return addr;
+  /* Now do it again for the float registers, if they exist.  */
+  reg_sec = bfd_get_section_by_name (core_bfd, ".reg2");
+  if (reg_sec) {
+    size = bfd_section_size (core_bfd, reg_sec);
+    the_regs = alloca (size);
+    if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0,
+                                 size))
+      {
+       fetch_core_registers (the_regs, size, 2,
+                             (unsigned) bfd_section_vma (abfd,reg_sec));
+      }
+    else
+      {
+       fprintf (stderr, "Couldn't fetch register set 2 from core file: %s\n",
+                bfd_errmsg (bfd_error));
+      }
+  }
+  registers_fetched();
 }
-
-#endif /* REGISTER_U_ADDR */
 \f
+struct target_ops core_ops = {
+       "core", "Local core dump file",
+       "Use a core file as a target.  Specify the filename of the core file.",
+       core_open, core_close,
+       child_attach, core_detach, 0, 0, /* resume, wait */
+       get_core_registers, 
+       0, 0, 0, 0, /* store_regs, prepare_to_store, conv_to, conv_from */
+       xfer_memory, core_files_info,
+       0, 0, /* core_insert_breakpoint, core_remove_breakpoint, */
+       0, 0, 0, 0, 0, /* terminal stuff */
+       0, 0, 0, /* kill, load, lookup sym */
+       child_create_inferior, 0, /* mourn_inferior */
+       core_stratum, 0, /* next */
+       0, 1, 1, 1, 0,  /* all mem, mem, stack, regs, exec */
+       0, 0,                   /* section pointers */
+       OPS_MAGIC,              /* Always the last thing */
+};
+
 void
 _initialize_core()
 {
-  corechan = -1;
-  execchan = -1;
-  corefile = 0;
-  execfile = 0;
-  exec_file_display_hook = 0;
-
-  text_start = 0;
-  text_end = 0;
-  data_start = 0;
-  data_end = 0;
-  exec_data_start = 0;
-  exec_data_end = 0;
-  stack_start = STACK_END_ADDR;
-  stack_end = STACK_END_ADDR;
 
   add_com ("core-file", class_files, core_file_command,
           "Use FILE as core dump for examining memory and registers.\n\
-No arg means have no core file.");
-  add_com ("exec-file", class_files, exec_file_command,
-          "Use FILE as program for getting contents of pure memory.\n\
-If FILE cannot be found as specified, your execution directory path\n\
-is searched for a command of that name.\n\
-No arg means have no executable file.");
-  add_info ("files", files_info, "Names of files being debugged.");
+No arg means have no core file.  This command has been superseded by the\n\
+`target core' and `detach' commands.");
+  add_target (&core_ops);
 }
-
This page took 0.030785 seconds and 4 git commands to generate.