(sim_resume): Clarify use of SIGGNAL.
[deliverable/binutils-gdb.git] / gdb / gdbarch.c
index 17870d0e1c613a253a33cec2eb3eae7527ef9253..49d7bf4ca702c7bf449ef9595a59363b1a255591 100644 (file)
@@ -125,6 +125,7 @@ struct gdbarch
 
      */
 
+  int bfd_vma_bit;
   int ptr_bit;
   int short_bit;
   int int_bit;
@@ -192,6 +193,8 @@ struct gdbarch
   gdbarch_skip_prologue_ftype *skip_prologue;
   gdbarch_inner_than_ftype *inner_than;
   gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc;
+  gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
+  gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
   CORE_ADDR decr_pc_after_break;
   CORE_ADDR function_start_offset;
   gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
@@ -222,6 +225,7 @@ struct gdbarch default_gdbarch = {
   0, NULL, NULL,
   /* Multi-arch values */
   8 * sizeof (void*),
+  8 * sizeof (void*),
   8 * sizeof (short),
   8 * sizeof (int),
   8 * sizeof (long),
@@ -300,6 +304,8 @@ struct gdbarch default_gdbarch = {
   0,
   0,
   0,
+  0,
+  0,
   /* default_gdbarch() */
 };
 struct gdbarch *current_gdbarch = &default_gdbarch;
@@ -321,6 +327,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->byte_order = info->byte_order;
 
   /* Force the explicit initialization of these. */
+  gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
   gdbarch->num_regs = -1;
   gdbarch->sp_regnum = -1;
   gdbarch->fp_regnum = -1;
@@ -336,6 +343,8 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->call_dummy_length = -1;
   gdbarch->call_dummy_p = -1;
   gdbarch->call_dummy_stack_adjust_p = -1;
+  gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
+  gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->decr_pc_after_break = -1;
   gdbarch->function_start_offset = -1;
   gdbarch->frame_args_skip = -1;
@@ -359,6 +368,9 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if (gdbarch->bfd_arch_info == NULL)
     internal_error ("verify_gdbarch: bfd_arch_info unset");
   /* Check those that need to be defined for the given multi-arch level. */
+  if ((GDB_MULTI_ARCH >= 1)
+      && (0))
+    internal_error ("gdbarch: verify_gdbarch: bfd_vma_bit invalid");
   if ((GDB_MULTI_ARCH >= 1)
       && (gdbarch->ptr_bit == 0))
     internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid");
@@ -548,6 +560,12 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->breakpoint_from_pc == 0))
     internal_error ("gdbarch: verify_gdbarch: breakpoint_from_pc invalid");
+  if ((GDB_MULTI_ARCH >= 2)
+      && (0))
+    internal_error ("gdbarch: verify_gdbarch: memory_insert_breakpoint invalid");
+  if ((GDB_MULTI_ARCH >= 2)
+      && (0))
+    internal_error ("gdbarch: verify_gdbarch: memory_remove_breakpoint invalid");
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->decr_pc_after_break == -1))
     internal_error ("gdbarch: verify_gdbarch: decr_pc_after_break invalid");
@@ -599,6 +617,9 @@ gdbarch_dump (void)
   fprintf_unfiltered (gdb_stdlog,
                       "gdbarch_update: TARGET_BYTE_ORDER = %ld\n",
                       (long) TARGET_BYTE_ORDER);
+  fprintf_unfiltered (gdb_stdlog,
+                      "gdbarch_update: TARGET_BFD_VMA_BIT = %ld\n",
+                      (long) TARGET_BFD_VMA_BIT);
   fprintf_unfiltered (gdb_stdlog,
                       "gdbarch_update: TARGET_PTR_BIT = %ld\n",
                       (long) TARGET_PTR_BIT);
@@ -844,6 +865,14 @@ gdbarch_dump (void)
                       "gdbarch_update: BREAKPOINT_FROM_PC = 0x%08lx\n",
                       (long) current_gdbarch->breakpoint_from_pc
                       /*BREAKPOINT_FROM_PC ()*/);
+  fprintf_unfiltered (gdb_stdlog,
+                      "gdbarch_update: MEMORY_INSERT_BREAKPOINT = 0x%08lx\n",
+                      (long) current_gdbarch->memory_insert_breakpoint
+                      /*MEMORY_INSERT_BREAKPOINT ()*/);
+  fprintf_unfiltered (gdb_stdlog,
+                      "gdbarch_update: MEMORY_REMOVE_BREAKPOINT = 0x%08lx\n",
+                      (long) current_gdbarch->memory_remove_breakpoint
+                      /*MEMORY_REMOVE_BREAKPOINT ()*/);
   fprintf_unfiltered (gdb_stdlog,
                       "gdbarch_update: DECR_PC_AFTER_BREAK = %ld\n",
                       (long) DECR_PC_AFTER_BREAK);
@@ -919,6 +948,24 @@ gdbarch_byte_order (struct gdbarch *gdbarch)
   return gdbarch->byte_order;
 }
 
+int
+gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
+{
+  if (0)
+    internal_error ("gdbarch: gdbarch_bfd_vma_bit invalid");
+  if (gdbarch_debug >= 2)
+    /* FIXME: gdb_std??? */
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
+  return gdbarch->bfd_vma_bit;
+}
+
+void
+set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
+                         int bfd_vma_bit)
+{
+  gdbarch->bfd_vma_bit = bfd_vma_bit;
+}
+
 int
 gdbarch_ptr_bit (struct gdbarch *gdbarch)
 {
@@ -2117,6 +2164,42 @@ set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
   gdbarch->breakpoint_from_pc = breakpoint_from_pc;
 }
 
+int
+gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache)
+{
+  if (gdbarch->memory_insert_breakpoint == 0)
+    internal_error ("gdbarch: gdbarch_memory_insert_breakpoint invalid");
+  if (gdbarch_debug >= 2)
+    /* FIXME: gdb_std??? */
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
+  return gdbarch->memory_insert_breakpoint (addr, contents_cache);
+}
+
+void
+set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
+                                      gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
+{
+  gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
+}
+
+int
+gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache)
+{
+  if (gdbarch->memory_remove_breakpoint == 0)
+    internal_error ("gdbarch: gdbarch_memory_remove_breakpoint invalid");
+  if (gdbarch_debug >= 2)
+    /* FIXME: gdb_std??? */
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
+  return gdbarch->memory_remove_breakpoint (addr, contents_cache);
+}
+
+void
+set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
+                                      gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
+{
+  gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
+}
+
 CORE_ADDR
 gdbarch_decr_pc_after_break (struct gdbarch *gdbarch)
 {
@@ -3105,6 +3188,35 @@ int sizeof_call_dummy_words = sizeof (call_dummy_words);
 #endif
 
 
+/* Initialize the current architecture.  */
+void
+initialize_current_architecture ()
+{
+  if (GDB_MULTI_ARCH)
+    {
+      struct gdbarch_init_registration *rego;
+      const struct bfd_arch_info *chosen = NULL;
+      for (rego = gdbarch_init_registrary; rego != NULL; rego = rego->next)
+       {
+         const struct bfd_arch_info *ap
+           = bfd_lookup_arch (rego->bfd_architecture, 0);
+
+         /* Choose the first architecture alphabetically.  */
+         if (chosen == NULL
+             || strcmp (ap->printable_name, chosen->printable_name) < 0)
+           chosen = ap;
+       }
+
+      if (chosen != NULL)
+       {
+         struct gdbarch_info info;
+         memset (&info, 0, sizeof info);
+         info.bfd_arch_info = chosen;
+         gdbarch_update (info);
+       }
+    }
+}
+
 extern void _initialize_gdbarch (void);
 void
 _initialize_gdbarch ()
This page took 0.026081 seconds and 4 git commands to generate.