handle lower cased cpsr and spsr
[deliverable/binutils-gdb.git] / gdb / gdbarch.c
index aa62d1302eb73ccd2e48665d59fc7d85cd953568..bd705f913902a336aadbba2d4f8d5c169ff975fb 100644 (file)
 
 /* This file was created with the aid of ``gdbarch.sh''.
 
-   The bourn shell script ``gdbarch.sh'' creates the files
+   The Bourne shell script ``gdbarch.sh'' creates the files
    ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
    against the existing ``gdbarch.[hc]''.  Any differences found
    being reported.
 
    If editing this file, please also run gdbarch.sh and merge any
-   changes into that script. Conversely, when makeing sweeping changes
+   changes into that script. Conversely, when making sweeping changes
    to this file, modifying gdbarch.sh and using its output may prove
    easier. */
 
@@ -136,6 +136,7 @@ struct gdbarch
   int double_bit;
   int long_double_bit;
   int ptr_bit;
+  int addr_bit;
   int bfd_vma_bit;
   int ieee_float;
   gdbarch_read_pc_ftype *read_pc;
@@ -231,6 +232,7 @@ struct gdbarch
   const struct floatformat * float_format;
   const struct floatformat * double_format;
   const struct floatformat * long_double_format;
+  gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
 };
 
 
@@ -258,6 +260,7 @@ struct gdbarch startup_gdbarch =
   8 * sizeof (long double),
   8 * sizeof (void*),
   8 * sizeof (void*),
+  8 * sizeof (void*),
   0,
   0,
   0,
@@ -352,6 +355,7 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
+  0,
   /* startup_gdbarch() */
 };
 
@@ -427,6 +431,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->frame_args_skip = -1;
   gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
   gdbarch->extra_stack_alignment_needed = 1;
+  gdbarch->convert_from_func_ptr_addr = default_convert_from_func_ptr_addr;
   /* gdbarch_alloc() */
 
   return gdbarch;
@@ -469,6 +474,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of double_bit, invalid_p == 0 */
   /* Skip verify of long_double_bit, invalid_p == 0 */
   /* Skip verify of ptr_bit, invalid_p == 0 */
+  if (gdbarch->addr_bit == 0)
+    gdbarch->addr_bit = TARGET_PTR_BIT;
   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
   /* Skip verify of ieee_float, invalid_p == 0 */
   /* Skip verify of read_pc, invalid_p == 0 */
@@ -661,6 +668,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
     gdbarch->double_format = default_double_format (gdbarch);
   if (gdbarch->long_double_format == 0)
     gdbarch->long_double_format = &floatformat_unknown;
+  /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
 }
 
 
@@ -728,6 +736,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: TARGET_PTR_BIT # %s\n",
                       XSTRING (TARGET_PTR_BIT));
 #endif
+#ifdef TARGET_ADDR_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_ADDR_BIT # %s\n",
+                      XSTRING (TARGET_ADDR_BIT));
+#endif
 #ifdef TARGET_BFD_VMA_BIT
   fprintf_unfiltered (file,
                       "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
@@ -1284,6 +1297,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n",
                       XSTRING (TARGET_LONG_DOUBLE_FORMAT));
 #endif
+#ifdef CONVERT_FROM_FUNC_PTR_ADDR
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "CONVERT_FROM_FUNC_PTR_ADDR(addr)",
+                      XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr)));
+#endif
 #ifdef TARGET_ARCHITECTURE
   if (TARGET_ARCHITECTURE != NULL)
     fprintf_unfiltered (file,
@@ -1335,6 +1354,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: TARGET_PTR_BIT = %ld\n",
                       (long) TARGET_PTR_BIT);
 #endif
+#ifdef TARGET_ADDR_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_ADDR_BIT = %ld\n",
+                      (long) TARGET_ADDR_BIT);
+#endif
 #ifdef TARGET_BFD_VMA_BIT
   fprintf_unfiltered (file,
                       "gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n",
@@ -1934,6 +1958,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT = %ld\n",
                       (long) TARGET_LONG_DOUBLE_FORMAT);
+#endif
+#ifdef CONVERT_FROM_FUNC_PTR_ADDR
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: CONVERT_FROM_FUNC_PTR_ADDR = 0x%08lx\n",
+                        (long) current_gdbarch->convert_from_func_ptr_addr
+                        /*CONVERT_FROM_FUNC_PTR_ADDR ()*/);
 #endif
   if (current_gdbarch->dump_tdep != NULL)
     current_gdbarch->dump_tdep (current_gdbarch, file);
@@ -2092,6 +2123,23 @@ set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
   gdbarch->ptr_bit = ptr_bit;
 }
 
+int
+gdbarch_addr_bit (struct gdbarch *gdbarch)
+{
+  if (gdbarch->addr_bit == 0)
+    internal_error ("gdbarch: gdbarch_addr_bit invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
+  return gdbarch->addr_bit;
+}
+
+void
+set_gdbarch_addr_bit (struct gdbarch *gdbarch,
+                      int addr_bit)
+{
+  gdbarch->addr_bit = addr_bit;
+}
+
 int
 gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
 {
@@ -3706,6 +3754,23 @@ set_gdbarch_long_double_format (struct gdbarch *gdbarch,
   gdbarch->long_double_format = long_double_format;
 }
 
+CORE_ADDR
+gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+  if (gdbarch->convert_from_func_ptr_addr == 0)
+    internal_error ("gdbarch: gdbarch_convert_from_func_ptr_addr invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
+  return gdbarch->convert_from_func_ptr_addr (addr);
+}
+
+void
+set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+                                        gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
+{
+  gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
+}
+
 
 /* Keep a registrary of per-architecture data-pointers required by GDB
    modules. */
@@ -3780,7 +3845,7 @@ gdbarch_data (struct gdbarch_data *data)
 
 
 
-/* Keep a registrary of swaped data required by GDB modules. */
+/* Keep a registrary of swapped data required by GDB modules. */
 
 struct gdbarch_swap
 {
This page took 0.031878 seconds and 4 git commands to generate.