Set default LANGUAGE to english/us.
[deliverable/binutils-gdb.git] / gdb / gdbarch.c
index 8467d414237e96c42e55dd9a94211f54b7efc414..1775d8b27bcfd9a04972fd3992a4be6eb2f3a6fe 100644 (file)
@@ -74,13 +74,6 @@ static void init_gdbarch_swap (struct gdbarch *);
 static void swapout_gdbarch_swap (struct gdbarch *);
 static void swapin_gdbarch_swap (struct gdbarch *);
 
-/* Convenience macro for allocting typesafe memory. */
-
-#ifndef XMALLOC
-#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
-#endif
-
-
 /* Non-zero if we want to trace architecture code.  */
 
 #ifndef GDBARCH_DEBUG
@@ -148,7 +141,6 @@ struct gdbarch
   gdbarch_read_pc_ftype *read_pc;
   gdbarch_write_pc_ftype *write_pc;
   gdbarch_read_fp_ftype *read_fp;
-  gdbarch_write_fp_ftype *write_fp;
   gdbarch_read_sp_ftype *read_sp;
   gdbarch_write_sp_ftype *write_sp;
   gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
@@ -159,6 +151,7 @@ struct gdbarch
   int sp_regnum;
   int fp_regnum;
   int pc_regnum;
+  int ps_regnum;
   int fp0_regnum;
   int npc_regnum;
   int nnpc_regnum;
@@ -301,10 +294,10 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
-  0,
-  0,
-  0,
-  0,
+  -1,
+  -1,
+  -1,
+  -1,
   0,
   0,
   0,
@@ -419,6 +412,7 @@ void
 initialize_non_multiarch ()
 {
   alloc_gdbarch_data (&startup_gdbarch);
+  init_gdbarch_swap (&startup_gdbarch);
   init_gdbarch_data (&startup_gdbarch);
 }
 
@@ -460,7 +454,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
   current_gdbarch->read_pc = generic_target_read_pc;
   current_gdbarch->write_pc = generic_target_write_pc;
   current_gdbarch->read_fp = generic_target_read_fp;
-  current_gdbarch->write_fp = generic_target_write_fp;
   current_gdbarch->read_sp = generic_target_read_sp;
   current_gdbarch->write_sp = generic_target_write_sp;
   current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
@@ -468,6 +461,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   current_gdbarch->sp_regnum = -1;
   current_gdbarch->fp_regnum = -1;
   current_gdbarch->pc_regnum = -1;
+  current_gdbarch->ps_regnum = -1;
   current_gdbarch->fp0_regnum = -1;
   current_gdbarch->npc_regnum = -1;
   current_gdbarch->nnpc_regnum = -1;
@@ -514,6 +508,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
   current_gdbarch->frame_args_skip = -1;
   current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
+  current_gdbarch->frame_chain_valid = func_frame_chain_valid;
   current_gdbarch->extra_stack_alignment_needed = 1;
   current_gdbarch->convert_from_func_ptr_addr = core_addr_identity;
   current_gdbarch->addr_bits_remove = core_addr_identity;
@@ -582,7 +577,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of read_pc, invalid_p == 0 */
   /* Skip verify of write_pc, invalid_p == 0 */
   /* Skip verify of read_fp, invalid_p == 0 */
-  /* Skip verify of write_fp, invalid_p == 0 */
   /* Skip verify of read_sp, invalid_p == 0 */
   /* Skip verify of write_sp, invalid_p == 0 */
   /* Skip verify of virtual_frame_pointer, invalid_p == 0 */
@@ -592,15 +586,10 @@ verify_gdbarch (struct gdbarch *gdbarch)
       && (gdbarch->num_regs == -1))
     fprintf_unfiltered (log, "\n\tnum_regs");
   /* Skip verify of num_pseudo_regs, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->sp_regnum == -1))
-    fprintf_unfiltered (log, "\n\tsp_regnum");
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->fp_regnum == -1))
-    fprintf_unfiltered (log, "\n\tfp_regnum");
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->pc_regnum == -1))
-    fprintf_unfiltered (log, "\n\tpc_regnum");
+  /* Skip verify of sp_regnum, invalid_p == 0 */
+  /* Skip verify of fp_regnum, invalid_p == 0 */
+  /* Skip verify of pc_regnum, invalid_p == 0 */
+  /* Skip verify of ps_regnum, invalid_p == 0 */
   /* Skip verify of fp0_regnum, invalid_p == 0 */
   /* Skip verify of npc_regnum, invalid_p == 0 */
   /* Skip verify of nnpc_regnum, invalid_p == 0 */
@@ -742,9 +731,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->frame_chain == 0))
     fprintf_unfiltered (log, "\n\tframe_chain");
-  if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->frame_chain_valid == 0))
-    fprintf_unfiltered (log, "\n\tframe_chain_valid");
+  /* Skip verify of frame_chain_valid, invalid_p == 0 */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->frame_saved_pc == 0))
     fprintf_unfiltered (log, "\n\tframe_saved_pc");
@@ -1543,6 +1530,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->prologue_frameless_p
                         /*PROLOGUE_FRAMELESS_P ()*/);
 #endif
+#ifdef PS_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: PS_REGNUM # %s\n",
+                      XSTRING (PS_REGNUM));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: PS_REGNUM = %d\n",
+                      PS_REGNUM);
+#endif
 #ifdef PUSH_ARGUMENTS
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -2097,20 +2092,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->virtual_frame_pointer
                         /*TARGET_VIRTUAL_FRAME_POINTER ()*/);
 #endif
-#ifdef TARGET_WRITE_FP
-#if GDB_MULTI_ARCH
-  /* Macro might contain `[{}]' when not multi-arch */
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "TARGET_WRITE_FP(val)",
-                      XSTRING (TARGET_WRITE_FP (val)));
-#endif
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: TARGET_WRITE_FP = 0x%08lx\n",
-                        (long) current_gdbarch->write_fp
-                        /*TARGET_WRITE_FP ()*/);
-#endif
 #ifdef TARGET_WRITE_PC
 #if GDB_MULTI_ARCH
   /* Macro might contain `[{}]' when not multi-arch */
@@ -2421,24 +2402,6 @@ set_gdbarch_read_fp (struct gdbarch *gdbarch,
   gdbarch->read_fp = read_fp;
 }
 
-void
-gdbarch_write_fp (struct gdbarch *gdbarch, CORE_ADDR val)
-{
-  if (gdbarch->write_fp == 0)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_write_fp invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_write_fp called\n");
-  gdbarch->write_fp (val);
-}
-
-void
-set_gdbarch_write_fp (struct gdbarch *gdbarch,
-                      gdbarch_write_fp_ftype write_fp)
-{
-  gdbarch->write_fp = write_fp;
-}
-
 CORE_ADDR
 gdbarch_read_sp (struct gdbarch *gdbarch)
 {
@@ -2578,9 +2541,7 @@ set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
 int
 gdbarch_sp_regnum (struct gdbarch *gdbarch)
 {
-  if (gdbarch->sp_regnum == -1)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_sp_regnum invalid");
+  /* Skip verify of sp_regnum, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_sp_regnum called\n");
   return gdbarch->sp_regnum;
@@ -2596,9 +2557,7 @@ set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
 int
 gdbarch_fp_regnum (struct gdbarch *gdbarch)
 {
-  if (gdbarch->fp_regnum == -1)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_fp_regnum invalid");
+  /* Skip verify of fp_regnum, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_fp_regnum called\n");
   return gdbarch->fp_regnum;
@@ -2614,9 +2573,7 @@ set_gdbarch_fp_regnum (struct gdbarch *gdbarch,
 int
 gdbarch_pc_regnum (struct gdbarch *gdbarch)
 {
-  if (gdbarch->pc_regnum == -1)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_pc_regnum invalid");
+  /* Skip verify of pc_regnum, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_pc_regnum called\n");
   return gdbarch->pc_regnum;
@@ -2629,6 +2586,22 @@ set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
   gdbarch->pc_regnum = pc_regnum;
 }
 
+int
+gdbarch_ps_regnum (struct gdbarch *gdbarch)
+{
+  /* Skip verify of ps_regnum, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_ps_regnum called\n");
+  return gdbarch->ps_regnum;
+}
+
+void
+set_gdbarch_ps_regnum (struct gdbarch *gdbarch,
+                       int ps_regnum)
+{
+  gdbarch->ps_regnum = ps_regnum;
+}
+
 int
 gdbarch_fp0_regnum (struct gdbarch *gdbarch)
 {
This page took 0.026656 seconds and 4 git commands to generate.