* ltconfig, ltmain.sh: Upgrade to libtool 1.4a 1.641.2.256.
[deliverable/binutils-gdb.git] / gdb / gdbarch.c
index 5735315c2fd7d900e9a143e5ed65881fdc98b928..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;
@@ -380,6 +381,7 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
+  0,
   /* startup_gdbarch() */
 };
 
@@ -457,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;
@@ -710,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__,
@@ -845,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,
@@ -1320,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",
@@ -2034,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",
@@ -2375,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
@@ -2393,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
@@ -3868,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)
 {
@@ -4609,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
@@ -4678,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.026332 seconds and 4 git commands to generate.