* ltconfig, ltmain.sh: Upgrade to libtool 1.4a 1.641.2.256.
[deliverable/binutils-gdb.git] / gdb / gdbarch.c
index 8145d99a755b604933c8012c593fb11005e8f66f..2bd957f6e018a66e80b7a73eb9c195a8b413a91a 100644 (file)
@@ -226,6 +226,7 @@ struct gdbarch
   gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
   gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
   CORE_ADDR decr_pc_after_break;
+  gdbarch_prepare_to_proceed_ftype *prepare_to_proceed;
   CORE_ADDR function_start_offset;
   gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
   CORE_ADDR frame_args_skip;
@@ -246,6 +247,7 @@ struct gdbarch
   const struct floatformat * double_format;
   const struct floatformat * long_double_format;
   gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
+  gdbarch_software_single_step_ftype *software_single_step;
 };
 
 
@@ -378,6 +380,8 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
+  0,
+  0,
   /* startup_gdbarch() */
 };
 
@@ -455,6 +459,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->decr_pc_after_break = -1;
+  gdbarch->prepare_to_proceed = default_prepare_to_proceed;
   gdbarch->function_start_offset = -1;
   gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
   gdbarch->frame_args_skip = -1;
@@ -708,6 +713,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
       && (gdbarch->decr_pc_after_break == -1))
     internal_error (__FILE__, __LINE__,
                     "gdbarch: verify_gdbarch: decr_pc_after_break invalid");
+  /* Skip verify of prepare_to_proceed, invalid_p == 0 */
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->function_start_offset == -1))
     internal_error (__FILE__, __LINE__,
@@ -757,6 +763,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if (gdbarch->long_double_format == 0)
     gdbarch->long_double_format = &floatformat_unknown;
   /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
+  /* Skip verify of software_single_step, has predicate */
 }
 
 
@@ -842,15 +849,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
 #ifdef TARGET_READ_PC
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "TARGET_READ_PC(pid)",
-                      XSTRING (TARGET_READ_PC (pid)));
+                      "TARGET_READ_PC(ptid)",
+                      XSTRING (TARGET_READ_PC (ptid)));
 #endif
 #if defined (TARGET_WRITE_PC) && GDB_MULTI_ARCH
   /* Macro might contain `[{}]' when not multi-arch */
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "TARGET_WRITE_PC(val, pid)",
-                      XSTRING (TARGET_WRITE_PC (val, pid)));
+                      "TARGET_WRITE_PC(val, ptid)",
+                      XSTRING (TARGET_WRITE_PC (val, ptid)));
 #endif
 #ifdef TARGET_READ_FP
   fprintf_unfiltered (file,
@@ -1317,6 +1324,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n",
                       XSTRING (DECR_PC_AFTER_BREAK));
 #endif
+#ifdef PREPARE_TO_PROCEED
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "PREPARE_TO_PROCEED(select_it)",
+                      XSTRING (PREPARE_TO_PROCEED (select_it)));
+#endif
 #ifdef FUNCTION_START_OFFSET
   fprintf_unfiltered (file,
                       "gdbarch_dump: FUNCTION_START_OFFSET # %s\n",
@@ -1432,6 +1445,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "CONVERT_FROM_FUNC_PTR_ADDR(addr)",
                       XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr)));
 #endif
+#if defined (SOFTWARE_SINGLE_STEP) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
+                      XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
+#endif
 #ifdef TARGET_ARCHITECTURE
   if (TARGET_ARCHITECTURE != NULL)
     fprintf_unfiltered (file,
@@ -2024,6 +2044,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n",
                       (long) DECR_PC_AFTER_BREAK);
 #endif
+#ifdef PREPARE_TO_PROCEED
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: PREPARE_TO_PROCEED = 0x%08lx\n",
+                        (long) current_gdbarch->prepare_to_proceed
+                        /*PREPARE_TO_PROCEED ()*/);
+#endif
 #ifdef FUNCTION_START_OFFSET
   fprintf_unfiltered (file,
                       "gdbarch_dump: FUNCTION_START_OFFSET = %ld\n",
@@ -2149,6 +2176,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *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
+#ifdef SOFTWARE_SINGLE_STEP
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: SOFTWARE_SINGLE_STEP = 0x%08lx\n",
+                        (long) current_gdbarch->software_single_step
+                        /*SOFTWARE_SINGLE_STEP ()*/);
 #endif
   if (current_gdbarch->dump_tdep != NULL)
     current_gdbarch->dump_tdep (current_gdbarch, file);
@@ -2358,14 +2392,14 @@ set_gdbarch_ieee_float (struct gdbarch *gdbarch,
 }
 
 CORE_ADDR
-gdbarch_read_pc (struct gdbarch *gdbarch, int pid)
+gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid)
 {
   if (gdbarch->read_pc == 0)
     internal_error (__FILE__, __LINE__,
                     "gdbarch: gdbarch_read_pc invalid");
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
-  return gdbarch->read_pc (pid);
+  return gdbarch->read_pc (ptid);
 }
 
 void
@@ -2376,14 +2410,14 @@ set_gdbarch_read_pc (struct gdbarch *gdbarch,
 }
 
 void
-gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, int pid)
+gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid)
 {
   if (gdbarch->write_pc == 0)
     internal_error (__FILE__, __LINE__,
                     "gdbarch: gdbarch_write_pc invalid");
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
-  gdbarch->write_pc (val, pid);
+  gdbarch->write_pc (val, ptid);
 }
 
 void
@@ -3851,6 +3885,24 @@ set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
   gdbarch->decr_pc_after_break = decr_pc_after_break;
 }
 
+int
+gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, int select_it)
+{
+  if (gdbarch->prepare_to_proceed == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_prepare_to_proceed invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_prepare_to_proceed called\n");
+  return gdbarch->prepare_to_proceed (select_it);
+}
+
+void
+set_gdbarch_prepare_to_proceed (struct gdbarch *gdbarch,
+                                gdbarch_prepare_to_proceed_ftype prepare_to_proceed)
+{
+  gdbarch->prepare_to_proceed = prepare_to_proceed;
+}
+
 CORE_ADDR
 gdbarch_function_start_offset (struct gdbarch *gdbarch)
 {
@@ -4215,6 +4267,30 @@ set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
 }
 
+int
+gdbarch_software_single_step_p (struct gdbarch *gdbarch)
+{
+  return gdbarch->software_single_step != 0;
+}
+
+void
+gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p)
+{
+  if (gdbarch->software_single_step == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_software_single_step invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
+  gdbarch->software_single_step (sig, insert_breakpoints_p);
+}
+
+void
+set_gdbarch_software_single_step (struct gdbarch *gdbarch,
+                                  gdbarch_software_single_step_ftype software_single_step)
+{
+  gdbarch->software_single_step = software_single_step;
+}
+
 
 /* Keep a registry of per-architecture data-pointers required by GDB
    modules. */
@@ -4568,56 +4644,40 @@ gdbarch_update_p (struct gdbarch_info info)
   struct gdbarch_list **list;
   struct gdbarch_registration *rego;
 
-  /* Fill in any missing bits. Most important is the bfd_architecture
-     which is used to select the target architecture. */
-  if (info.bfd_architecture == bfd_arch_unknown)
-    {
-      if (info.bfd_arch_info != NULL)
-       info.bfd_architecture = info.bfd_arch_info->arch;
-      else if (info.abfd != NULL)
-       info.bfd_architecture = bfd_get_arch (info.abfd);
-      /* FIXME - should query BFD for its default architecture. */
-      else
-       info.bfd_architecture = current_gdbarch->bfd_arch_info->arch;
-    }
+  /* Fill in missing parts of the INFO struct using a number of
+     sources: ``set ...''; INFOabfd supplied; existing target.  */
+
+  /* ``(gdb) set architecture ...'' */
+  if (info.bfd_arch_info == NULL
+      && !TARGET_ARCHITECTURE_AUTO)
+    info.bfd_arch_info = TARGET_ARCHITECTURE;
+  if (info.bfd_arch_info == NULL
+      && info.abfd != NULL
+      && bfd_get_arch (info.abfd) != bfd_arch_unknown
+      && bfd_get_arch (info.abfd) != bfd_arch_obscure)
+    info.bfd_arch_info = bfd_get_arch_info (info.abfd);
   if (info.bfd_arch_info == NULL)
-    {
-      if (target_architecture_auto && info.abfd != NULL)
-       info.bfd_arch_info = bfd_get_arch_info (info.abfd);
-      else
-       info.bfd_arch_info = current_gdbarch->bfd_arch_info;
-    }
+    info.bfd_arch_info = TARGET_ARCHITECTURE;
+
+  /* ``(gdb) set byte-order ...'' */
+  if (info.byte_order == 0
+      && !TARGET_BYTE_ORDER_AUTO)
+    info.byte_order = TARGET_BYTE_ORDER;
+  /* From the INFO struct. */
+  if (info.byte_order == 0
+      && info.abfd != NULL)
+    info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
+                      : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN
+                      : 0);
+  /* From the current target. */
   if (info.byte_order == 0)
-    {
-      if (target_byte_order_auto && info.abfd != NULL)
-       info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
-                          : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN
-                          : 0);
-      else
-       info.byte_order = current_gdbarch->byte_order;
-      /* FIXME - should query BFD for its default byte-order. */
-    }
-  /* A default for abfd? */
+    info.byte_order = TARGET_BYTE_ORDER;
 
-  /* Find the target that knows about this architecture. */
-  for (rego = gdbarch_registry;
-       rego != NULL;
-       rego = rego->next)
-    if (rego->bfd_architecture == info.bfd_architecture)
-      break;
-  if (rego == NULL)
-    {
-      if (gdbarch_debug)
-       fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
-      return 0;
-    }
+  /* Must have found some sort of architecture. */
+  gdb_assert (info.bfd_arch_info != NULL);
 
   if (gdbarch_debug)
     {
-      fprintf_unfiltered (gdb_stdlog,
-                         "gdbarch_update: info.bfd_architecture %d (%s)\n",
-                         info.bfd_architecture,
-                         bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
       fprintf_unfiltered (gdb_stdlog,
                          "gdbarch_update: info.bfd_arch_info %s\n",
                          (info.bfd_arch_info != NULL
@@ -4637,6 +4697,19 @@ gdbarch_update_p (struct gdbarch_info info)
                          (long) info.tdep_info);
     }
 
+  /* Find the target that knows about this architecture. */
+  for (rego = gdbarch_registry;
+       rego != NULL;
+       rego = rego->next)
+    if (rego->bfd_architecture == info.bfd_arch_info->arch)
+      break;
+  if (rego == NULL)
+    {
+      if (gdbarch_debug)
+       fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
+      return 0;
+    }
+
   /* Ask the target for a replacement architecture. */
   new_gdbarch = rego->init (info, rego->arches);
 
This page took 0.02981 seconds and 4 git commands to generate.