don't let bin2hex call strlen
[deliverable/binutils-gdb.git] / gdb / vaxobsd-tdep.c
index 289510dd7dcc8358047599c382008afb4db29fa5..802016126ce71777a713939fc5eff864cfdbd75b 100644 (file)
@@ -1,12 +1,12 @@
 /* Target-dependent code for OpenBSD/vax.
 
 /* Target-dependent code for OpenBSD/vax.
 
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    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
 
    This file is part of GDB.
 
    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,
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -15,9 +15,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    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"
 
 #include "defs.h"
 #include "arch-utils.h"
@@ -29,7 +27,7 @@
 
 #include "vax-tdep.h"
 
 
 #include "vax-tdep.h"
 
-#include "gdb_string.h"
+#include <string.h>
 
 /* Signal trampolines.  */
 
 
 /* Signal trampolines.  */
 
@@ -59,20 +57,22 @@ static const gdb_byte vaxobsd_sigreturn[] = {
 };
 
 static int
 };
 
 static int
-vaxobsd_sigtramp_p (struct frame_info *next_frame)
+vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
+                         struct frame_info *this_frame,
+                         void **this_cache)
 {
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
   CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
   CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
   gdb_byte *buf;
   CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
   CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
   gdb_byte *buf;
-  char *name;
+  const char *name;
 
   find_pc_partial_function (pc, &name, NULL, NULL);
   if (name)
     return 0;
 
   buf = alloca(sizeof vaxobsd_sigreturn);
 
   find_pc_partial_function (pc, &name, NULL, NULL);
   if (name)
     return 0;
 
   buf = alloca(sizeof vaxobsd_sigreturn);
-  if (!safe_frame_unwind_memory (next_frame, sigreturn_addr,
+  if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
                                 buf, sizeof vaxobsd_sigreturn))
     return 0;
 
                                 buf, sizeof vaxobsd_sigreturn))
     return 0;
 
@@ -83,7 +83,7 @@ vaxobsd_sigtramp_p (struct frame_info *next_frame)
 }
 
 static struct trad_frame_cache *
 }
 
 static struct trad_frame_cache *
-vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
+vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct trad_frame_cache *cache;
   CORE_ADDR addr, base, func;
 {
   struct trad_frame_cache *cache;
   CORE_ADDR addr, base, func;
@@ -91,14 +91,14 @@ vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
   if (*this_cache)
     return *this_cache;
 
   if (*this_cache)
     return *this_cache;
 
-  cache = trad_frame_cache_zalloc (next_frame);
+  cache = trad_frame_cache_zalloc (this_frame);
   *this_cache = cache;
 
   *this_cache = cache;
 
-  func = frame_pc_unwind (next_frame);
+  func = get_frame_pc (this_frame);
   func &= ~(vaxobsd_page_size - 1);
 
   func &= ~(vaxobsd_page_size - 1);
 
-  base = frame_unwind_register_unsigned (next_frame, VAX_SP_REGNUM);
-  addr = get_frame_memory_unsigned (next_frame, base - 4, 4);
+  base = get_frame_register_unsigned (this_frame, VAX_SP_REGNUM);
+  addr = get_frame_memory_unsigned (this_frame, base - 4, 4);
 
   trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
   trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
 
   trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
   trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
@@ -113,43 +113,33 @@ vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
 }
 
 static void
 }
 
 static void
-vaxobsd_sigtramp_frame_this_id (struct frame_info *next_frame,
+vaxobsd_sigtramp_frame_this_id (struct frame_info *this_frame,
                                void **this_cache, struct frame_id *this_id)
 {
   struct trad_frame_cache *cache =
                                void **this_cache, struct frame_id *this_id)
 {
   struct trad_frame_cache *cache =
-    vaxobsd_sigtramp_frame_cache (next_frame, this_cache);
+    vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
 
   trad_frame_get_id (cache, this_id);
 }
 
 
   trad_frame_get_id (cache, this_id);
 }
 
-static void
-vaxobsd_sigtramp_frame_prev_register (struct frame_info *next_frame,
-                                     void **this_cache, int regnum,
-                                     int *optimizedp, enum lval_type *lvalp,
-                                     CORE_ADDR *addrp, int *realnump,
-                                     gdb_byte *valuep)
+static struct value *
+vaxobsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
+                                     void **this_cache, int regnum)
 {
   struct trad_frame_cache *cache =
 {
   struct trad_frame_cache *cache =
-    vaxobsd_sigtramp_frame_cache (next_frame, this_cache);
+    vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
 
 
-  trad_frame_get_register (cache, next_frame, regnum,
-                          optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_register (cache, this_frame, regnum);
 }
 
 static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
   SIGTRAMP_FRAME,
 }
 
 static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
   SIGTRAMP_FRAME,
+  default_frame_unwind_stop_reason,
   vaxobsd_sigtramp_frame_this_id,
   vaxobsd_sigtramp_frame_this_id,
-  vaxobsd_sigtramp_frame_prev_register
+  vaxobsd_sigtramp_frame_prev_register,
+  NULL,
+  vaxobsd_sigtramp_sniffer
 };
 };
-
-static const struct frame_unwind *
-vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
-{
-  if (vaxobsd_sigtramp_p (next_frame))
-    return &vaxobsd_sigtramp_frame_unwind;
-
-  return NULL;
-}
 \f
 
 /* OpenBSD a.out.  */
 \f
 
 /* OpenBSD a.out.  */
@@ -157,7 +147,7 @@ vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
 static void
 vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
 static void
 vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  frame_unwind_append_sniffer (gdbarch, vaxobsd_sigtramp_frame_sniffer);
+  frame_unwind_append_unwinder (gdbarch, &vaxobsd_sigtramp_frame_unwind);
 }
 
 /* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are
 }
 
 /* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are
This page took 0.026338 seconds and 4 git commands to generate.