]> Git Repo - binutils.git/blobdiff - gdb/core.c
Change GDB over to GNU General Public License version 2.
[binutils.git] / gdb / core.c
index 4f3c61797db08007c22e861cb9f8dbef78c804ca..a452e23e9872654cf1cc0bd2a64fc1ff0d7260d0 100644 (file)
@@ -3,19 +3,19 @@
 
 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 <stdio.h>
 #include <errno.h>
@@ -56,6 +56,7 @@ extern struct target_ops core_ops;
 /* Discard all vestiges of any previous core file
    and mark data and stack spaces as empty.  */
 
+/* ARGSUSED */
 void
 core_close (quitting)
      int quitting;
@@ -64,6 +65,9 @@ core_close (quitting)
     free (bfd_get_filename (core_bfd));
     bfd_close (core_bfd);
     core_bfd = NULL;
+#ifdef CLEAR_SOLIB
+    CLEAR_SOLIB ();
+#endif
   }
 }
 
@@ -124,6 +128,7 @@ core_open (filename, from_tty)
           bfd_errmsg (bfd_error));
 
   ontop = !push_target (&core_ops);
+  make_cleanup (unpush_target, &core_ops);
 
   p = bfd_core_file_failing_command (core_bfd);
   if (p)
@@ -137,10 +142,14 @@ core_open (filename, from_tty)
   if (ontop) {
     /* Fetch all registers from core file */
     target_fetch_registers (-1);
+    /* Add symbols for any shared libraries that were in use */
+#ifdef SOLIB_ADD
+    SOLIB_ADD (NULL, from_tty);
+#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);
-    /* FIXME, handle shared library reading here.  */
     print_sel_frame (0);       /* Print the top frame and source line */
   } else {
     printf (
@@ -370,15 +379,23 @@ core_xfer_memory (memaddr, myaddr, len, write)
      int len;
      int write;
 {
-  return xfer_memory (memaddr, myaddr, len, write,
+  int res;
+  res = xfer_memory (memaddr, myaddr, len, write,
                      core_bfd, core_sections, core_sections_end);
+#ifdef SOLIB_XFER_MEMORY
+  if (res == 0)
+    res = SOLIB_XFER_MEMORY (memaddr, myaddr, len, write);
+#endif
+  return res;
 }
 \f
 /* 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.  */
 
-static int
+/* We just get all the registers, so we don't use regno.  */
+/* ARGSUSED */
+static void
 get_core_registers (regno)
      int regno;
 {
@@ -417,7 +434,6 @@ get_core_registers (regno)
       }
   }
   registers_fetched();
-  return 0;  /* FIXME, what result goes here?  */
 }
 \f
 struct target_ops core_ops = {
This page took 0.026981 seconds and 4 git commands to generate.