gdb/linux-record: Fix newfstatat handling
[deliverable/binutils-gdb.git] / gdb / score-tdep.c
index d61faf0ec62cec0d9af31438b1e0a30f3b216cb7..7e563914bf80987a734b5aab01a6b17cae91a477 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for the S+core architecture, for GDB,
    the GNU Debugger.
 
-   Copyright (C) 2006-2014 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 Free Software Foundation, Inc.
 
    Contributed by Qinwei (qinwei@sunnorth.com.cn)
    Contributed by Ching-Peng Lin (cplin@sunplus.com)
@@ -737,8 +737,10 @@ score3_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc;
 }
 
+/* Implement the stack_frame_destroyed_p gdbarch method. */
+
 static int
-score7_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
+score7_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
 {
   inst_t *inst = score7_fetch_inst (gdbarch, cur_pc, NULL);
 
@@ -761,8 +763,10 @@ score7_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
     return 0;
 }
 
+/* Implement the stack_frame_destroyed_p gdbarch method. */
+
 static int
-score3_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
+score3_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
 {
   CORE_ADDR pc = cur_pc;
   inst_t *inst
@@ -821,7 +825,7 @@ score7_malloc_and_get_memblock (CORE_ADDR addr, CORE_ADDR size)
   else if (size == 0)
     return NULL;
 
-  memblock = xmalloc (size);
+  memblock = (gdb_byte *) xmalloc (size);
   memset (memblock, 0, size);
   ret = target_read_memory (addr & ~0x3, memblock, size);
   if (ret)
@@ -1318,7 +1322,7 @@ score_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
   struct score_frame_cache *cache;
 
   if ((*this_cache) != NULL)
-    return (*this_cache);
+    return (struct score_frame_cache *) (*this_cache);
 
   cache = FRAME_OBSTACK_ZALLOC (struct score_frame_cache);
   (*this_cache) = cache;
@@ -1334,15 +1338,17 @@ score_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
       return cache;
 
     if (target_mach == bfd_mach_score3)
-      score3_analyze_prologue (start_addr, pc, this_frame, *this_cache);
+      score3_analyze_prologue (start_addr, pc, this_frame,
+                              (struct score_frame_cache *) *this_cache);
     else
-      score7_analyze_prologue (start_addr, pc, this_frame, *this_cache);
+      score7_analyze_prologue (start_addr, pc, this_frame,
+                              (struct score_frame_cache *) *this_cache);
   }
 
   /* Save SP.  */
   trad_frame_set_value (cache->saved_regs, SCORE_SP_REGNUM, cache->base);
 
-  return (*this_cache);
+  return (struct score_frame_cache *) (*this_cache);
 }
 
 static void
@@ -1445,21 +1451,16 @@ static const struct regset score7_linux_gregset =
     regcache_collect_regset
   };
 
-/* Return the appropriate register set from the core section identified
-   by SECT_NAME and SECT_SIZE.  */
+/* Iterate over core file register note sections.  */
 
-static const struct regset *
-score7_linux_regset_from_core_section(struct gdbarch *gdbarch,
-                    const char *sect_name, size_t sect_size)
+static void
+score7_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                          iterate_over_regset_sections_cb *cb,
+                                          void *cb_data,
+                                          const struct regcache *regcache)
 {
-  gdb_assert (gdbarch != NULL);
-  gdb_assert (sect_name != NULL);
-
-  if (strcmp(sect_name, ".reg") == 0
-      && sect_size == SCORE7_LINUX_SIZEOF_GREGSET)
-    return &score7_linux_gregset;
-
-  return NULL;
+  cb (".reg", SCORE7_LINUX_SIZEOF_GREGSET, &score7_linux_gregset,
+      NULL, cb_data);
 }
 
 static struct gdbarch *
@@ -1499,20 +1500,20 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case bfd_mach_score7:
       set_gdbarch_breakpoint_from_pc (gdbarch, score7_breakpoint_from_pc);
       set_gdbarch_skip_prologue (gdbarch, score7_skip_prologue);
-      set_gdbarch_in_function_epilogue_p (gdbarch,
-                                         score7_in_function_epilogue_p);
+      set_gdbarch_stack_frame_destroyed_p (gdbarch,
+                                          score7_stack_frame_destroyed_p);
       set_gdbarch_register_name (gdbarch, score7_register_name);
       set_gdbarch_num_regs (gdbarch, SCORE7_NUM_REGS);
       /* Core file support.  */
-      set_gdbarch_regset_from_core_section (gdbarch,
-                                           score7_linux_regset_from_core_section);
+      set_gdbarch_iterate_over_regset_sections
+       (gdbarch, score7_linux_iterate_over_regset_sections);
       break;
 
     case bfd_mach_score3:
       set_gdbarch_breakpoint_from_pc (gdbarch, score3_breakpoint_from_pc);
       set_gdbarch_skip_prologue (gdbarch, score3_skip_prologue);
-      set_gdbarch_in_function_epilogue_p (gdbarch,
-                                         score3_in_function_epilogue_p);
+      set_gdbarch_stack_frame_destroyed_p (gdbarch,
+                                          score3_stack_frame_destroyed_p);
       set_gdbarch_register_name (gdbarch, score3_register_name);
       set_gdbarch_num_regs (gdbarch, SCORE3_NUM_REGS);
       break;
This page took 0.025874 seconds and 4 git commands to generate.