Add end_psymtab_common, have all debug info readers call it.
[deliverable/binutils-gdb.git] / gdb / arm-linux-tdep.c
index 3d524c9b9d33f9d3db390fabdfd525b162bbc64a..4772d822acd02cda42d0c290f818c81cb6c85a3b 100644 (file)
@@ -1,6 +1,6 @@
 /* GNU/Linux on ARM target support.
 
-   Copyright (C) 1999-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -731,44 +731,26 @@ static const struct regset arm_linux_vfpregset =
     NULL, arm_linux_supply_vfp, arm_linux_collect_vfp
   };
 
-/* 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 *
-arm_linux_regset_from_core_section (struct gdbarch *gdbarch,
-                                   const char *sect_name, size_t sect_size)
+static void
+arm_linux_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 == ARM_LINUX_SIZEOF_GREGSET)
-    return &arm_linux_gregset;
-
-  if (strcmp (sect_name, ".reg2") == 0
-      && sect_size == ARM_LINUX_SIZEOF_NWFPE)
-    return &arm_linux_fpregset;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  if (strcmp (sect_name, ".reg-arm-vfp") == 0
-      && sect_size == ARM_LINUX_SIZEOF_VFP)
-    return &arm_linux_vfpregset;
+  cb (".reg", ARM_LINUX_SIZEOF_GREGSET, &arm_linux_gregset, NULL, cb_data);
 
-  return NULL;
+  if (tdep->vfp_register_count > 0)
+    cb (".reg-arm-vfp", ARM_LINUX_SIZEOF_VFP, &arm_linux_vfpregset,
+       "VFP floating-point", cb_data);
+  else if (tdep->have_fpa_registers)
+    cb (".reg2", ARM_LINUX_SIZEOF_NWFPE, &arm_linux_fpregset,
+       "FPA floating-point", cb_data);
 }
 
-/* Core file register set sections.  */
-
-static struct core_regset_section arm_linux_fpa_regset_sections[] =
-{
-  { ".reg", ARM_LINUX_SIZEOF_GREGSET, "general-purpose" },
-  { ".reg2", ARM_LINUX_SIZEOF_NWFPE, "FPA floating-point" },
-  { NULL, 0}
-};
-
-static struct core_regset_section arm_linux_vfp_regset_sections[] =
-{
-  { ".reg", ARM_LINUX_SIZEOF_GREGSET, "general-purpose" },
-  { ".reg-arm-vfp", ARM_LINUX_SIZEOF_VFP, "VFP floating-point" },
-  { NULL, 0}
-};
-
 /* Determine target description from core file.  */
 
 static const struct target_desc *
@@ -957,7 +939,6 @@ arm_linux_cleanup_svc (struct gdbarch *gdbarch,
                       struct regcache *regs,
                       struct displaced_step_closure *dsc)
 {
-  CORE_ADDR from = dsc->insn_addr;
   ULONGEST apparent_pc;
   int within_scratch;
 
@@ -978,7 +959,8 @@ arm_linux_cleanup_svc (struct gdbarch *gdbarch,
     }
 
   if (within_scratch)
-    displaced_write_reg (regs, dsc, ARM_PC_REGNUM, from + 4, BRANCH_WRITE_PC);
+    displaced_write_reg (regs, dsc, ARM_PC_REGNUM,
+                        dsc->insn_addr + dsc->insn_size, BRANCH_WRITE_PC);
 }
 
 static int
@@ -998,54 +980,54 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
                                                 &return_to, &is_thumb);
   if (is_sigreturn)
     {
-         struct symtab_and_line sal;
-
-         if (debug_displaced)
-           fprintf_unfiltered (gdb_stdlog, "displaced: found "
-             "sigreturn/rt_sigreturn SVC call.  PC in frame = %lx\n",
-             (unsigned long) get_frame_pc (frame));
-
-         if (debug_displaced)
-           fprintf_unfiltered (gdb_stdlog, "displaced: unwind pc = %lx.  "
-             "Setting momentary breakpoint.\n", (unsigned long) return_to);
-
-         gdb_assert (inferior_thread ()->control.step_resume_breakpoint
-                     == NULL);
-
-         sal = find_pc_line (return_to, 0);
-         sal.pc = return_to;
-         sal.section = find_pc_overlay (return_to);
-         sal.explicit_pc = 1;
-
-         frame = get_prev_frame (frame);
-
-         if (frame)
-           {
-             inferior_thread ()->control.step_resume_breakpoint
-               = set_momentary_breakpoint (gdbarch, sal, get_frame_id (frame),
-                                           bp_step_resume);
-
-             /* set_momentary_breakpoint invalidates FRAME.  */
-             frame = NULL;
-
-             /* We need to make sure we actually insert the momentary
-                breakpoint set above.  */
-             insert_breakpoints ();
-           }
-         else if (debug_displaced)
-           fprintf_unfiltered (gdb_stderr, "displaced: couldn't find previous "
-                               "frame to set momentary breakpoint for "
-                               "sigreturn/rt_sigreturn\n");
+      struct symtab_and_line sal;
+
+      if (debug_displaced)
+       fprintf_unfiltered (gdb_stdlog, "displaced: found "
+                           "sigreturn/rt_sigreturn SVC call.  PC in "
+                           "frame = %lx\n",
+                           (unsigned long) get_frame_pc (frame));
+
+      if (debug_displaced)
+       fprintf_unfiltered (gdb_stdlog, "displaced: unwind pc = %lx.  "
+                           "Setting momentary breakpoint.\n",
+                           (unsigned long) return_to);
+
+      gdb_assert (inferior_thread ()->control.step_resume_breakpoint
+                 == NULL);
+
+      sal = find_pc_line (return_to, 0);
+      sal.pc = return_to;
+      sal.section = find_pc_overlay (return_to);
+      sal.explicit_pc = 1;
+
+      frame = get_prev_frame (frame);
+
+      if (frame)
+       {
+         inferior_thread ()->control.step_resume_breakpoint
+           = set_momentary_breakpoint (gdbarch, sal, get_frame_id (frame),
+                                       bp_step_resume);
+
+         /* set_momentary_breakpoint invalidates FRAME.  */
+         frame = NULL;
+
+         /* We need to make sure we actually insert the momentary
+            breakpoint set above.  */
+         insert_breakpoints ();
        }
       else if (debug_displaced)
-       fprintf_unfiltered (gdb_stdlog, "displaced: sigreturn/rt_sigreturn "
-                           "SVC call not in signal trampoline frame\n");
-    
+       fprintf_unfiltered (gdb_stderr, "displaced: couldn't find previous "
+                           "frame to set momentary breakpoint for "
+                           "sigreturn/rt_sigreturn\n");
+    }
+  else if (debug_displaced)
+    fprintf_unfiltered (gdb_stdlog, "displaced: found SVC call\n");
 
   /* Preparation: If we detect sigreturn, set momentary breakpoint at resume
                  location, else nothing.
      Insn: unmodified svc.
-     Cleanup: if pc lands in scratch space, pc <- insn_addr + 4
+     Cleanup: if pc lands in scratch space, pc <- insn_addr + insn_size
               else leave pc alone.  */
 
 
@@ -1285,7 +1267,7 @@ arm_canonicalize_syscall (int syscall)
   else if (syscall >= 248 && syscall <= 253)
     return syscall + 4;
 
-  return -1;
+  return gdb_sys_no_syscall;
 }
 
 /* Record all registers but PC register for process-record.  */
@@ -1317,7 +1299,7 @@ arm_linux_syscall_record (struct regcache *regcache, unsigned long svc_number)
 
   syscall_gdb = arm_canonicalize_syscall (svc_number);
 
-  if (syscall_gdb < 0)
+  if (syscall_gdb == gdb_sys_no_syscall)
     {
       printf_unfiltered (_("Process record and replay target doesn't "
                            "support syscall number %s\n"),
@@ -1379,7 +1361,7 @@ arm_linux_init_abi (struct gdbarch_info info,
   linux_init_abi (info, gdbarch);
 
   tdep->lowest_pc = 0x8000;
-  if (info.byte_order == BFD_ENDIAN_BIG)
+  if (info.byte_order_for_code == BFD_ENDIAN_BIG)
     {
       if (tdep->arm_abi == ARM_ABI_AAPCS)
        tdep->arm_breakpoint = eabi_linux_arm_be_breakpoint;
@@ -1454,24 +1436,17 @@ arm_linux_init_abi (struct gdbarch_info info,
                                &arm_kernel_linux_restart_syscall_tramp_frame);
 
   /* Core file support.  */
-  set_gdbarch_regset_from_core_section (gdbarch,
-                                       arm_linux_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, arm_linux_iterate_over_regset_sections);
   set_gdbarch_core_read_description (gdbarch, arm_linux_core_read_description);
 
-  if (tdep->have_vfp_registers)
-    set_gdbarch_core_regset_sections (gdbarch, arm_linux_vfp_regset_sections);
-  else if (tdep->have_fpa_registers)
-    set_gdbarch_core_regset_sections (gdbarch, arm_linux_fpa_regset_sections);
-
-  set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
-
   /* Displaced stepping.  */
   set_gdbarch_displaced_step_copy_insn (gdbarch,
                                        arm_linux_displaced_step_copy_insn);
   set_gdbarch_displaced_step_fixup (gdbarch, arm_displaced_step_fixup);
   set_gdbarch_displaced_step_free_closure (gdbarch,
                                           simple_displaced_step_free_closure);
-  set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point);
+  set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
 
   /* Reversible debugging, process record.  */
   set_gdbarch_process_record (gdbarch, arm_process_record);
@@ -1491,7 +1466,7 @@ arm_linux_init_abi (struct gdbarch_info info,
   tdep->syscall_next_pc = arm_linux_syscall_next_pc;
 
   /* `catch syscall' */
-  set_xml_syscall_file_name ("syscalls/arm-linux.xml");
+  set_xml_syscall_file_name (gdbarch, "syscalls/arm-linux.xml");
   set_gdbarch_get_syscall_number (gdbarch, arm_linux_get_syscall_number);
 
   /* Syscall record.  */
This page took 0.027585 seconds and 4 git commands to generate.