Replace CONST with const
[deliverable/binutils-gdb.git] / gdb / arch-utils.c
index 004d3aeb10d46b50f0c4cc31e1e634fd20cad43d..f395c3e18ad4c2b9ac2de2648c446347bad0c2e9 100644 (file)
@@ -37,6 +37,8 @@
 #include "target.h"
 #include "annotate.h"
 #endif
+#include "regcache.h"
+#include "gdb_assert.h"
 
 #include "version.h"
 
@@ -97,6 +99,12 @@ generic_return_value_on_stack_not (struct type *type)
   return 0;
 }
 
+CORE_ADDR
+generic_skip_trampoline_code (CORE_ADDR pc)
+{
+  return 0;
+}
+
 char *
 legacy_register_name (int i)
 {
@@ -138,6 +146,13 @@ generic_prologue_frameless_p (CORE_ADDR ip)
 #endif
 }
 
+/* New/multi-arched targets should use the correct gdbarch field
+   instead of using this global pointer. */
+int
+legacy_print_insn (bfd_vma vma, disassemble_info *info)
+{
+  return (*tm_print_insn) (vma, info);
+}
 
 /* Helper functions for INNER_THAN */
 
@@ -221,7 +236,7 @@ default_register_sim_regno (int num)
 
 
 CORE_ADDR
-default_convert_from_func_ptr_addr (CORE_ADDR addr)
+core_addr_identity (CORE_ADDR addr)
 {
   return addr;
 }
@@ -239,6 +254,102 @@ default_frame_address (struct frame_info *fi)
   return fi->frame;
 }
 
+/* Default prepare_to_procced().  */
+int
+default_prepare_to_proceed (int select_it)
+{
+  return 0;
+}
+
+/* Generic prepare_to_proceed().  This one should be suitable for most
+   targets that support threads. */
+int
+generic_prepare_to_proceed (int select_it)
+{
+  ptid_t wait_ptid;
+  struct target_waitstatus wait_status;
+
+  /* Get the last target status returned by target_wait().  */
+  get_last_target_status (&wait_ptid, &wait_status);
+
+  /* Make sure we were stopped either at a breakpoint, or because
+     of a Ctrl-C.  */
+  if (wait_status.kind != TARGET_WAITKIND_STOPPED
+      || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
+          wait_status.value.sig != TARGET_SIGNAL_INT))
+    {
+      return 0;
+    }
+
+  if (!ptid_equal (wait_ptid, minus_one_ptid)
+      && !ptid_equal (inferior_ptid, wait_ptid))
+    {
+      /* Switched over from WAIT_PID.  */
+      CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
+
+      if (wait_pc != read_pc ())
+       {
+         if (select_it)
+           {
+             /* Switch back to WAIT_PID thread.  */
+             inferior_ptid = wait_ptid;
+
+             /* FIXME: This stuff came from switch_to_thread() in
+                thread.c (which should probably be a public function).  */
+             flush_cached_frames ();
+             registers_changed ();
+             stop_pc = wait_pc;
+             select_frame (get_current_frame (), 0);
+           }
+          /* We return 1 to indicate that there is a breakpoint here,
+             so we need to step over it before continuing to avoid
+             hitting it straight away. */
+          if (breakpoint_here_p (wait_pc))
+            {
+             return 1;
+            }
+       }
+    }
+  return 0;
+  
+}
+
+void
+init_frame_pc_noop (int fromleaf, struct frame_info *prev)
+{
+  return;
+}
+
+void
+init_frame_pc_default (int fromleaf, struct frame_info *prev)
+{
+  if (fromleaf)
+    prev->pc = SAVED_PC_AFTER_CALL (prev->next);
+  else if (prev->next != NULL)
+    prev->pc = FRAME_SAVED_PC (prev->next);
+  else
+    prev->pc = read_pc ();
+}
+
+int
+cannot_register_not (int regnum)
+{
+  return 0;
+}
+
+/* Legacy version of target_virtual_frame_pointer().  Assumes that
+   there is an FP_REGNUM and that it is the same, cooked or raw.  */
+
+void
+legacy_virtual_frame_pointer (CORE_ADDR pc,
+                             int *frame_regnum,
+                             LONGEST *frame_offset)
+{
+  gdb_assert (FP_REGNUM >= 0);
+  *frame_regnum = FP_REGNUM;
+  *frame_offset = 0;
+}
+\f
 /* Functions to manipulate the endianness of the target.  */
 
 #ifdef TARGET_BYTE_ORDER_SELECTABLE
@@ -529,40 +640,6 @@ set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
   show_architecture (NULL, from_tty);
 }
 
-/* Called if the user enters ``info architecture'' without an argument. */
-
-static void
-info_architecture (char *args, int from_tty)
-{
-  printf_filtered ("Available architectures are:\n");
-  if (GDB_MULTI_ARCH)
-    {
-      const char **arches = gdbarch_printable_names ();
-      const char **arch;
-      for (arch = arches; *arch != NULL; arch++)
-       {
-         printf_filtered (" %s", *arch);
-       }
-      xfree (arches);
-    }
-  else
-    {
-      enum bfd_architecture a;
-      for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++)
-       {
-         const struct bfd_arch_info *ap;
-         for (ap = bfd_lookup_arch (a, 0);
-              ap != NULL;
-              ap = ap->next)
-           {
-             printf_filtered (" %s", ap->printable_name);
-             ap = ap->next;
-           }
-       }
-    }
-  printf_filtered ("\n");
-}
-
 /* Set the dynamic target-system-dependent parameters (architecture,
    byte-order) using information found in the BFD */
 
@@ -678,6 +755,8 @@ initialize_current_architecture (void)
                          "initialize_current_architecture: Selection of initial architecture failed");
        }
     }
+  else
+    initialize_non_multiarch ();
 
   /* Create the ``set architecture'' command appending ``auto'' to the
      list of architectures. */
@@ -702,9 +781,6 @@ initialize_current_architecture (void)
        current setting. */
     add_cmd ("architecture", class_support, show_architecture,
             "Show the current target architecture", &showlist);
-    c = add_cmd ("architecture", class_support, info_architecture,
-                "List supported target architectures", &infolist);
-    deprecate_cmd (c, "set architecture");
   }
 }
 
This page took 0.027254 seconds and 4 git commands to generate.