PR symtab/19914 fix handling of dwp + split debug
[deliverable/binutils-gdb.git] / gdb / vax-tdep.c
index e3ac15d62375aa12e64a7ce1c5d44ad3a8c80c71..b7f418524f89147a5babf4f4e01e64c4dca75a16 100644 (file)
@@ -1,7 +1,6 @@
 /* Target-dependent code for the VAX.
 
-   Copyright (C) 1986, 1989, 1991-1992, 1995-1996, 1998-2000, 2002-2005,
-   2007-2012 Free Software Foundation, Inc.
+   Copyright (C) 1986-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,8 +32,6 @@
 #include "trad-frame.h"
 #include "value.h"
 
-#include "gdb_string.h"
-
 #include "vax-tdep.h"
 
 /* Return the name of register REGNUM.  */
@@ -74,7 +71,7 @@ static void
 vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
                    int regnum, const void *gregs, size_t len)
 {
-  const gdb_byte *regs = gregs;
+  const gdb_byte *regs = (const gdb_byte *) gregs;
   int i;
 
   for (i = 0; i < VAX_NUM_REGS; i++)
@@ -86,23 +83,21 @@ vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
 
 /* VAX register set.  */
 
-static struct regset vax_gregset =
+static const struct regset vax_gregset =
 {
   NULL,
   vax_supply_gregset
 };
 
-/* Return the appropriate register set for the core section identified
-   by SECT_NAME and SECT_SIZE.  */
+/* Iterate over core file register note sections.  */
 
-static const struct regset *
-vax_regset_from_core_section (struct gdbarch *gdbarch,
-                             const char *sect_name, size_t sect_size)
+static void
+vax_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                 iterate_over_regset_sections_cb *cb,
+                                 void *cb_data,
+                                 const struct regcache *regcache)
 {
-  if (strcmp (sect_name, ".reg") == 0 && sect_size >= VAX_NUM_REGS * 4)
-    return &vax_gregset;
-
-  return NULL;
+  cb (".reg", VAX_NUM_REGS * 4, &vax_gregset, NULL, cb_data);
 }
 \f
 /* The VAX UNIX calling convention uses R1 to pass a structure return
@@ -208,6 +203,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *type, struct regcache *regcache,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
+  int len = TYPE_LENGTH (type);
   gdb_byte buf[8];
 
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT
@@ -223,7 +219,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
          ULONGEST addr;
 
          regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr);
-         read_memory (addr, readbuf, TYPE_LENGTH (type));
+         read_memory (addr, readbuf, len);
        }
 
       return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@@ -233,16 +229,16 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
     {
       /* Read the contents of R0 and (if necessary) R1.  */
       regcache_cooked_read (regcache, VAX_R0_REGNUM, buf);
-      if (TYPE_LENGTH (type) > 4)
+      if (len > 4)
        regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4);
-      memcpy (readbuf, buf, TYPE_LENGTH (type));
+      memcpy (readbuf, buf, len);
     }
   if (writebuf)
     {
       /* Read the contents to R0 and (if necessary) R1.  */
-      memcpy (buf, writebuf, TYPE_LENGTH (type));
+      memcpy (buf, writebuf, len);
       regcache_cooked_write (regcache, VAX_R0_REGNUM, buf);
-      if (TYPE_LENGTH (type) > 4)
+      if (len > 4)
        regcache_cooked_write (regcache, VAX_R1_REGNUM, buf + 4);
     }
 
@@ -322,7 +318,7 @@ vax_frame_cache (struct frame_info *this_frame, void **this_cache)
   int regnum;
 
   if (*this_cache)
-    return *this_cache;
+    return (struct vax_frame_cache *) *this_cache;
 
   /* Allocate a new cache.  */
   cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache);
@@ -485,8 +481,8 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
   set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
 
-  set_gdbarch_regset_from_core_section
-    (gdbarch, vax_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, vax_iterate_over_regset_sections);
 
   /* Frame and stack info */
   set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
This page took 0.025598 seconds and 4 git commands to generate.