2007-09-04 Michael Snyder <msnyder@access-company.com>
[deliverable/binutils-gdb.git] / gdb / corelow.c
index f38934e2d4ecd55fc4f23fb0e9d0885dd8ec2f1a..408e95ac62f4b36656fe306839e35b7fd37e3773 100644 (file)
@@ -8,7 +8,7 @@
 
    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 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -17,9 +17,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "arch-utils.h"
@@ -82,7 +80,7 @@ static void core_close (int);
 
 static void core_close_cleanup (void *ignore);
 
-static void get_core_registers (int);
+static void get_core_registers (struct regcache *, int);
 
 static void add_to_thread_list (bfd *, asection *, void *);
 
@@ -375,7 +373,7 @@ core_open (char *filename, int from_tty)
   if (ontop)
     {
       /* Fetch all registers from core file.  */
-      target_fetch_registers (-1);
+      target_fetch_registers (get_current_regcache (), -1);
 
       /* Now, set up the frame cache, and print the top of stack.  */
       reinit_frame_cache ();
@@ -483,9 +481,9 @@ get_core_register_section (struct regcache *regcache,
 /* We just get all the registers, so we don't use regno.  */
 
 static void
-get_core_registers (int regno)
+get_core_registers (struct regcache *regcache, int regno)
 {
-  int status;
+  int i;
 
   if (!(core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
       && (core_vec == NULL || core_vec->core_read_registers == NULL))
@@ -495,14 +493,17 @@ get_core_registers (int regno)
       return;
     }
 
-  get_core_register_section (current_regcache,
+  get_core_register_section (regcache,
                             ".reg", 0, "general-purpose", 1);
-  get_core_register_section (current_regcache,
+  get_core_register_section (regcache,
                             ".reg2", 2, "floating-point", 0);
-  get_core_register_section (current_regcache,
+  get_core_register_section (regcache,
                             ".reg-xfp", 3, "extended floating-point", 0);
 
-  deprecated_registers_fetched ();
+  /* Supply dummy value for all registers not found in the core.  */
+  for (i = 0; i < gdbarch_num_regs (current_gdbarch); i++)
+    if (!regcache_valid_p (regcache, i))
+      regcache_raw_supply (regcache, i, NULL);
 }
 
 static void
@@ -520,11 +521,11 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
     {
     case TARGET_OBJECT_MEMORY:
       if (readbuf)
-       return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-                                              0/*write*/, NULL, ops);
+       return (*ops->deprecated_xfer_memory) (offset, readbuf,
+                                              len, 0/*write*/, NULL, ops);
       if (writebuf)
-       return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-                                              1/*write*/, NULL, ops);
+       return (*ops->deprecated_xfer_memory) (offset, (gdb_byte *) writebuf,
+                                              len, 1/*write*/, NULL, ops);
       return -1;
 
     case TARGET_OBJECT_AUXV:
@@ -591,6 +592,18 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
        }
       return -1;
 
+    case TARGET_OBJECT_LIBRARIES:
+      if (core_gdbarch
+         && gdbarch_core_xfer_shared_libraries_p (core_gdbarch))
+       {
+         if (writebuf)
+           return -1;
+         return
+           gdbarch_core_xfer_shared_libraries (core_gdbarch,
+                                               readbuf, offset, len);
+       }
+      /* FALL THROUGH */
+
     default:
       if (ops->beneath != NULL)
        return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
This page took 0.025305 seconds and 4 git commands to generate.