2003-06-23 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / arch-utils.c
index 1202df980ce95783bfb031f54fb55c1fd09231b6..043600e98483ba6b694ad4bd059b98fc16e12025 100644 (file)
 
 #include "floatformat.h"
 
-/* Use the program counter to determine the contents and size
-   of a breakpoint instruction.  If no target-dependent macro
-   BREAKPOINT_FROM_PC has been defined to implement this function,
-   assume that the breakpoint doesn't depend on the PC, and
-   use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
-   Return a pointer to a string of bytes that encode a breakpoint
-   instruction, stores the length of the string to *lenptr,
-   and optionally adjust the pc to point to the correct memory location
-   for inserting the breakpoint.  */
-
-const unsigned char *
-legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
-{
-  /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
-     breakpoint.  On some machines, breakpoints are handled by the
-     target environment and we don't have to worry about them here.  */
-#ifdef BIG_BREAKPOINT
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-    {
-      static unsigned char big_break_insn[] = BIG_BREAKPOINT;
-      *lenptr = sizeof (big_break_insn);
-      return big_break_insn;
-    }
-#endif
-#ifdef LITTLE_BREAKPOINT
-  if (TARGET_BYTE_ORDER != BFD_ENDIAN_BIG)
-    {
-      static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
-      *lenptr = sizeof (little_break_insn);
-      return little_break_insn;
-    }
-#endif
-#ifdef BREAKPOINT
-  {
-    static unsigned char break_insn[] = BREAKPOINT;
-    *lenptr = sizeof (break_insn);
-    return break_insn;
-  }
-#endif
-  *lenptr = 0;
-  return NULL;
-}
-
 /* Implementation of extract return value that grubs around in the
    register cache.  */
 void
@@ -115,6 +72,13 @@ legacy_store_return_value (struct type *type, struct regcache *regcache,
 }
 
 
+int
+always_use_struct_convention (int gcc_p, struct type *value_type)
+{
+  return 1;
+}
+
+
 int
 legacy_register_sim_regno (int regnum)
 {
@@ -191,7 +155,9 @@ LONGEST legacy_call_dummy_words[1];
 int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words);
 
 void
-generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len,
+generic_remote_translate_xfer_address (struct gdbarch *gdbarch,
+                                      struct regcache *regcache,
+                                      CORE_ADDR gdb_addr, int gdb_len,
                                       CORE_ADDR * rem_addr, int *rem_len)
 {
   *rem_addr = gdb_addr;
@@ -209,7 +175,7 @@ generic_prologue_frameless_p (CORE_ADDR ip)
 int
 legacy_print_insn (bfd_vma vma, disassemble_info *info)
 {
-  return (*tm_print_insn) (vma, info);
+  return (*deprecated_tm_print_insn) (vma, info);
 }
 
 /* Helper functions for INNER_THAN */
@@ -273,14 +239,7 @@ default_double_format (struct gdbarch *gdbarch)
 /* Misc helper functions for targets. */
 
 int
-frame_num_args_unknown (struct frame_info *fi)
-{
-  return -1;
-}
-
-
-int
-generic_register_convertible_not (int num)
+deprecated_register_convertible_not (int num)
 {
   return 0;
 }
@@ -313,66 +272,6 @@ no_op_reg_to_regnum (int reg)
   return reg;
 }
 
-/* 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 ());
-           }
-          /* 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;
-  
-}
-
 CORE_ADDR
 init_frame_pc_noop (int fromleaf, struct frame_info *prev)
 {
@@ -383,10 +282,10 @@ init_frame_pc_noop (int fromleaf, struct frame_info *prev)
 CORE_ADDR
 init_frame_pc_default (int fromleaf, struct frame_info *prev)
 {
-  if (fromleaf)
-    return SAVED_PC_AFTER_CALL (get_next_frame (prev));
+  if (fromleaf && DEPRECATED_SAVED_PC_AFTER_CALL_P ())
+    return DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev));
   else if (get_next_frame (prev) != NULL)
-    return FRAME_SAVED_PC (get_next_frame (prev));
+    return DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev));
   else
     return read_pc ();
 }
@@ -410,7 +309,8 @@ cannot_register_not (int regnum)
 }
 
 /* Legacy version of target_virtual_frame_pointer().  Assumes that
-   there is an FP_REGNUM and that it is the same, cooked or raw.  */
+   there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or
+   raw.  */
 
 void
 legacy_virtual_frame_pointer (CORE_ADDR pc,
@@ -422,8 +322,8 @@ legacy_virtual_frame_pointer (CORE_ADDR pc,
      register and an offset can determine this.  I think it should
      instead generate a byte code expression as that would work better
      with things like Dwarf2's CFI.  */
-  if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS)
-    *frame_regnum = FP_REGNUM;
+  if (DEPRECATED_FP_REGNUM >= 0 && DEPRECATED_FP_REGNUM < NUM_REGS)
+    *frame_regnum = DEPRECATED_FP_REGNUM;
   else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS)
     *frame_regnum = SP_REGNUM;
   else
@@ -440,7 +340,13 @@ int
 generic_register_size (int regnum)
 {
   gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
-  return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
+  if (gdbarch_register_type_p (current_gdbarch))
+    return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
+  else
+    /* FIXME: cagney/2003-03-01: Once all architectures implement
+       gdbarch_register_type(), this entire function can go away.  It
+       is made obsolete by register_size().  */
+    return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum)); /* OK */
 }
 
 /* Assume all registers are adjacent.  */
@@ -454,7 +360,7 @@ generic_register_byte (int regnum)
   byte = 0;
   for (i = 0; i < regnum; i++)
     {
-      byte += TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
+      byte += generic_register_size (i);
     }
   return byte;
 }
@@ -474,23 +380,29 @@ legacy_pc_in_sigtramp (CORE_ADDR pc, char *name)
 }
 
 int
-legacy_convert_register_p (int regnum)
+legacy_convert_register_p (int regnum, struct type *type)
 {
-  return REGISTER_CONVERTIBLE (regnum);
+  return DEPRECATED_REGISTER_CONVERTIBLE (regnum);
 }
 
 void
-legacy_register_to_value (int regnum, struct type *type,
-                         char *from, char *to)
+legacy_register_to_value (struct frame_info *frame, int regnum,
+                         struct type *type, void *to)
 {
-  REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to);
+  char from[MAX_REGISTER_SIZE];
+  frame_read_register (frame, regnum, from);
+  DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to);
 }
 
 void
-legacy_value_to_register (struct type *type, int regnum,
-                         char *from, char *to)
+legacy_value_to_register (struct frame_info *frame, int regnum,
+                         struct type *type, const void *tmp)
 {
-  REGISTER_CONVERT_TO_RAW (type, regnum, from, to);
+  char to[MAX_REGISTER_SIZE];
+  char *from = alloca (TYPE_LENGTH (type));
+  memcpy (from, from, TYPE_LENGTH (type));
+  DEPRECATED_REGISTER_CONVERT_TO_RAW (type, regnum, from, to);
+  put_frame_register (frame, regnum, to);
 }
 
 \f
@@ -916,7 +828,7 @@ gdbarch_info_init (struct gdbarch_info *info)
 
 /* */
 
-extern initialize_file_ftype _initialize_gdbarch_utils;
+extern initialize_file_ftype _initialize_gdbarch_utils; /* -Wmissing-prototypes */
 
 void
 _initialize_gdbarch_utils (void)
This page took 0.029395 seconds and 4 git commands to generate.