Change embedded documentation to use consistent indentation and to split up
[deliverable/binutils-gdb.git] / gdb / mips-tdep.c
index 39086066332a7b237ead1952b1384421eb92970e..5898e579f1cb8c9fb9a3da8dd5dbc9956a585f37 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
 
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
    and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
@@ -39,6 +39,7 @@
 #include "arch-utils.h"
 #include "regcache.h"
 #include "osabi.h"
+#include "mips-tdep.h"
 
 #include "opcode/mips.h"
 #include "elf/mips.h"
@@ -57,19 +58,6 @@ enum
   MIPS_FPU_DOUBLE_REGSIZE = 8
 };
 
-/* All the possible MIPS ABIs. */
-
-enum mips_abi
-  {
-    MIPS_ABI_UNKNOWN = 0,
-    MIPS_ABI_N32,
-    MIPS_ABI_O32,
-    MIPS_ABI_N64,
-    MIPS_ABI_O64,
-    MIPS_ABI_EABI32,
-    MIPS_ABI_EABI64,
-    MIPS_ABI_LAST
-  };
 
 static const char *mips_abi_string;
 
@@ -141,8 +129,6 @@ struct gdbarch_tdep
     int mips_default_stack_argsize;
     int gdb_target_is_mips64;
     int default_mask_address_p;
-
-    enum gdb_osabi osabi;
   };
 
 #define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \
@@ -162,6 +148,13 @@ static const char *mips_saved_regsize_string = size_auto;
 
 #define MIPS_SAVED_REGSIZE (mips_saved_regsize())
 
+/* Return the MIPS ABI associated with GDBARCH.  */
+enum mips_abi
+mips_abi (struct gdbarch *gdbarch)
+{
+  return gdbarch_tdep (gdbarch)->mips_abi;
+}
+
 static unsigned int
 mips_saved_regsize (void)
 {
@@ -327,8 +320,8 @@ int gdb_print_insn_mips (bfd_vma, disassemble_info *);
 
 static void mips_print_register (int, int);
 
-static mips_extra_func_info_t
-heuristic_proc_desc (CORE_ADDR, CORE_ADDR, struct frame_info *, int);
+static mips_extra_func_info_t heuristic_proc_desc (CORE_ADDR, CORE_ADDR,
+                                                  struct frame_info *, int);
 
 static CORE_ADDR heuristic_proc_start (CORE_ADDR);
 
@@ -340,8 +333,9 @@ static void mips_show_processor_type_command (char *, int);
 
 static void reinit_frame_cache_sfunc (char *, int, struct cmd_list_element *);
 
-static mips_extra_func_info_t
-find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int cur_frame);
+static mips_extra_func_info_t find_proc_desc (CORE_ADDR pc,
+                                             struct frame_info *next_frame,
+                                             int cur_frame);
 
 static CORE_ADDR after_prologue (CORE_ADDR pc,
                                 mips_extra_func_info_t proc_desc);
@@ -499,12 +493,12 @@ void
 mips_print_extra_frame_info (struct frame_info *fi)
 {
   if (fi
-      && fi->extra_info
-      && fi->extra_info->proc_desc
-      && fi->extra_info->proc_desc->pdr.framereg < NUM_REGS)
+      && get_frame_extra_info (fi)
+      && get_frame_extra_info (fi)->proc_desc
+      && get_frame_extra_info (fi)->proc_desc->pdr.framereg < NUM_REGS)
     printf_filtered (" frame pointer is at %s+%s\n",
-                    REGISTER_NAME (fi->extra_info->proc_desc->pdr.framereg),
-                    paddr_d (fi->extra_info->proc_desc->pdr.frameoffset));
+                    REGISTER_NAME (get_frame_extra_info (fi)->proc_desc->pdr.framereg),
+                    paddr_d (get_frame_extra_info (fi)->proc_desc->pdr.frameoffset));
 }
 
 /* Number of bytes of storage in the actual machine representation for
@@ -1423,25 +1417,25 @@ mips_find_saved_regs (struct frame_info *fci)
 /* FIXME!  Is this correct?? */
 #define SIGFRAME_REG_SIZE      MIPS_REGSIZE
 #endif
-  if (fci->signal_handler_caller)
+  if ((get_frame_type (fci) == SIGTRAMP_FRAME))
     {
       for (ireg = 0; ireg < MIPS_NUMREGS; ireg++)
        {
-         reg_position = fci->frame + SIGFRAME_REGSAVE_OFF
+         reg_position = get_frame_base (fci) + SIGFRAME_REGSAVE_OFF
            + ireg * SIGFRAME_REG_SIZE;
-         fci->saved_regs[ireg] = reg_position;
+         get_frame_saved_regs (fci)[ireg] = reg_position;
        }
       for (ireg = 0; ireg < MIPS_NUMREGS; ireg++)
        {
-         reg_position = fci->frame + SIGFRAME_FPREGSAVE_OFF
+         reg_position = get_frame_base (fci) + SIGFRAME_FPREGSAVE_OFF
            + ireg * SIGFRAME_REG_SIZE;
-         fci->saved_regs[FP0_REGNUM + ireg] = reg_position;
+         get_frame_saved_regs (fci)[FP0_REGNUM + ireg] = reg_position;
        }
-      fci->saved_regs[PC_REGNUM] = fci->frame + SIGFRAME_PC_OFF;
+      get_frame_saved_regs (fci)[PC_REGNUM] = get_frame_base (fci) + SIGFRAME_PC_OFF;
       return;
     }
 
-  proc_desc = fci->extra_info->proc_desc;
+  proc_desc = get_frame_extra_info (fci)->proc_desc;
   if (proc_desc == NULL)
     /* I'm not sure how/whether this can happen.  Normally when we can't
        find a proc_desc, we "synthesize" one using heuristic_proc_desc
@@ -1456,7 +1450,8 @@ mips_find_saved_regs (struct frame_info *fci)
                                   a signal, we assume that all registers have been saved.
                                   This assumes that all register saves in a function happen before
                                   the first function call.  */
-       (fci->next == NULL || fci->next->signal_handler_caller)
+       (get_next_frame (fci) == NULL
+       || (get_frame_type (get_next_frame (fci)) == SIGTRAMP_FRAME))
 
   /* In a dummy frame we know exactly where things are saved.  */
        && !PROC_DESC_IS_DUMMY (proc_desc)
@@ -1464,7 +1459,7 @@ mips_find_saved_regs (struct frame_info *fci)
   /* Don't bother unless we are inside a function prologue.  Outside the
      prologue, we know where everything is. */
 
-       && in_prologue (fci->pc, PROC_LOW_ADDR (proc_desc))
+       && in_prologue (get_frame_pc (fci), PROC_LOW_ADDR (proc_desc))
 
   /* Not sure exactly what kernel_trap means, but if it means
      the kernel saves the registers without a prologue doing it,
@@ -1488,7 +1483,7 @@ mips_find_saved_regs (struct frame_info *fci)
 
       /* Scan through this function's instructions preceding the current
          PC, and look for those that save registers.  */
-      while (addr < fci->pc)
+      while (addr < get_frame_pc (fci))
        {
          inst = mips_fetch_instruction (addr);
          if (pc_is_mips16 (addr))
@@ -1503,11 +1498,11 @@ mips_find_saved_regs (struct frame_info *fci)
 
   /* Fill in the offsets for the registers which gen_mask says
      were saved.  */
-  reg_position = fci->frame + PROC_REG_OFFSET (proc_desc);
+  reg_position = get_frame_base (fci) + PROC_REG_OFFSET (proc_desc);
   for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1)
     if (gen_mask & 0x80000000)
       {
-       fci->saved_regs[ireg] = reg_position;
+       get_frame_saved_regs (fci)[ireg] = reg_position;
        reg_position -= MIPS_SAVED_REGSIZE;
       }
 
@@ -1524,14 +1519,14 @@ mips_find_saved_regs (struct frame_info *fci)
          int sreg_count = (inst >> 6) & 3;
 
          /* Check if the ra register was pushed on the stack.  */
-         reg_position = fci->frame + PROC_REG_OFFSET (proc_desc);
+         reg_position = get_frame_base (fci) + PROC_REG_OFFSET (proc_desc);
          if (inst & 0x20)
            reg_position -= MIPS_SAVED_REGSIZE;
 
          /* Check if the s0 and s1 registers were pushed on the stack.  */
          for (reg = 16; reg < sreg_count + 16; reg++)
            {
-             fci->saved_regs[reg] = reg_position;
+             get_frame_saved_regs (fci)[reg] = reg_position;
              reg_position -= MIPS_SAVED_REGSIZE;
            }
        }
@@ -1539,7 +1534,7 @@ mips_find_saved_regs (struct frame_info *fci)
 
   /* Fill in the offsets for the registers which float_mask says
      were saved.  */
-  reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
+  reg_position = get_frame_base (fci) + PROC_FREG_OFFSET (proc_desc);
 
   /* Apparently, the freg_offset gives the offset to the first 64 bit
      saved.
@@ -1562,11 +1557,11 @@ mips_find_saved_regs (struct frame_info *fci)
   for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
     if (float_mask & 0x80000000)
       {
-       fci->saved_regs[FP0_REGNUM + ireg] = reg_position;
+       get_frame_saved_regs (fci)[FP0_REGNUM + ireg] = reg_position;
        reg_position -= MIPS_SAVED_REGSIZE;
       }
 
-  fci->saved_regs[PC_REGNUM] = fci->saved_regs[RA_REGNUM];
+  get_frame_saved_regs (fci)[PC_REGNUM] = get_frame_saved_regs (fci)[RA_REGNUM];
 }
 
 /* Set up the 'saved_regs' array.  This is a data structure containing
@@ -1579,11 +1574,11 @@ mips_find_saved_regs (struct frame_info *fci)
 static void
 mips_frame_init_saved_regs (struct frame_info *frame)
 {
-  if (frame->saved_regs == NULL)
+  if (get_frame_saved_regs (frame) == NULL)
     {
       mips_find_saved_regs (frame);
     }
-  frame->saved_regs[SP_REGNUM] = frame->frame;
+  get_frame_saved_regs (frame)[SP_REGNUM] = get_frame_base (frame);
 }
 
 static CORE_ADDR
@@ -1682,15 +1677,18 @@ mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
     target_remove_breakpoint (next_pc, break_mem);
 }
 
-static void
+static CORE_ADDR
 mips_init_frame_pc_first (int fromleaf, struct frame_info *prev)
 {
   CORE_ADDR pc, tmp;
 
-  pc = ((fromleaf) ? SAVED_PC_AFTER_CALL (prev->next) :
-       prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
+  pc = ((fromleaf)
+       ? SAVED_PC_AFTER_CALL (get_next_frame (prev))
+       : get_next_frame (prev)
+       ? FRAME_SAVED_PC (get_next_frame (prev))
+       : read_pc ());
   tmp = SKIP_TRAMPOLINE_CODE (pc);
-  prev->pc = tmp ? tmp : pc;
+  return tmp ? tmp : pc;
 }
 
 
@@ -1698,21 +1696,20 @@ static CORE_ADDR
 mips_frame_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR saved_pc;
-  mips_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
+  mips_extra_func_info_t proc_desc = get_frame_extra_info (frame)->proc_desc;
   /* We have to get the saved pc from the sigcontext
      if it is a signal handler frame.  */
-  int pcreg = frame->signal_handler_caller ? PC_REGNUM
+  int pcreg = (get_frame_type (frame) == SIGTRAMP_FRAME) ? PC_REGNUM
   : (proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM);
 
-  if (USE_GENERIC_DUMMY_FRAMES
-      && PC_IN_CALL_DUMMY (frame->pc, 0, 0))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0))
     {
       LONGEST tmp;
       frame_unwind_signed_register (frame, PC_REGNUM, &tmp);
       saved_pc = tmp;
     }
   else if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc))
-    saved_pc = read_memory_integer (frame->frame - MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE);
+    saved_pc = read_memory_integer (get_frame_base (frame) - MIPS_SAVED_REGSIZE, MIPS_SAVED_REGSIZE);
   else
     saved_pc = read_next_frame_reg (frame, pcreg);
 
@@ -1720,7 +1717,13 @@ mips_frame_saved_pc (struct frame_info *frame)
 }
 
 static struct mips_extra_func_info temp_proc_desc;
-static CORE_ADDR temp_saved_regs[NUM_REGS];
+
+/* This hack will go away once the get_prev_frame() code has been
+   modified to set the frame's type first.  That is BEFORE init extra
+   frame info et.al.  is called.  This is because it will become
+   possible to skip the init extra info call for sigtramp and dummy
+   frames.  */
+static CORE_ADDR *temp_saved_regs;
 
 /* Set a register's saved stack address in temp_saved_regs.  If an address
    has already been set for this register, do nothing; this way we will
@@ -2032,6 +2035,7 @@ mips32_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
   CORE_ADDR cur_pc;
   CORE_ADDR frame_addr = 0;    /* Value of $r30. Used by gcc for frame-pointer */
 restart:
+  temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
   memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
   PROC_FRAME_OFFSET (&temp_proc_desc) = 0;
   PROC_FRAME_ADJUST (&temp_proc_desc) = 0;     /* offset of FP from SP */
@@ -2140,7 +2144,8 @@ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
   if (start_pc == 0)
     return NULL;
   memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
-  memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
+  temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
+  memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
   PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
   PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM;
   PROC_PC_REG (&temp_proc_desc) = RA_REGNUM;
@@ -2188,7 +2193,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
   struct obj_section *sec;
   struct mips_objfile_private *priv;
 
-  if (PC_IN_CALL_DUMMY (pc, 0, 0))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0))
     return NULL;
 
   find_pc_partial_function (pc, NULL, &startaddr, NULL);
@@ -2428,13 +2433,12 @@ mips_frame_chain (struct frame_info *frame)
   if ((tmp = SKIP_TRAMPOLINE_CODE (saved_pc)) != 0)
     saved_pc = tmp;
 
-  if (USE_GENERIC_DUMMY_FRAMES
-      && PC_IN_CALL_DUMMY (saved_pc, 0, 0))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (saved_pc, 0, 0))
     {
       /* A dummy frame, uses SP not FP.  Get the old SP value.  If all
          is well, frame->frame the bottom of the current frame will
          contain that value.  */
-      return frame->frame;
+      return get_frame_base (frame);
     }
 
   /* Look up the procedure descriptor for this PC.  */
@@ -2451,11 +2455,10 @@ mips_frame_chain (struct frame_info *frame)
       && PROC_FRAME_OFFSET (proc_desc) == 0
       /* The previous frame from a sigtramp frame might be frameless
         and have frame size zero.  */
-      && !frame->signal_handler_caller
+      && !(get_frame_type (frame) == SIGTRAMP_FRAME)
       /* For a generic dummy frame, let get_frame_pointer() unwind a
          register value saved as part of the dummy frame call.  */
-      && !(USE_GENERIC_DUMMY_FRAMES
-          && PC_IN_CALL_DUMMY (frame->pc, 0, 0)))
+      && !(DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0)))
     return 0;
   else
     return get_frame_pointer (frame, proc_desc);
@@ -2465,16 +2468,21 @@ static void
 mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
 {
   int regnum;
+  mips_extra_func_info_t proc_desc;
+
+  if (get_frame_type (fci) == DUMMY_FRAME)
+    return;
 
   /* Use proc_desc calculated in frame_chain */
-  mips_extra_func_info_t proc_desc =
-    fci->next ? cached_proc_desc : find_proc_desc (fci->pc, fci->next, 1);
+  proc_desc =
+    get_next_frame (fci)
+    ? cached_proc_desc
+    : find_proc_desc (get_frame_pc (fci), get_next_frame (fci), 1);
 
-  fci->extra_info = (struct frame_extra_info *)
-    frame_obstack_alloc (sizeof (struct frame_extra_info));
+  frame_extra_info_zalloc (fci, sizeof (struct frame_extra_info));
 
-  fci->saved_regs = NULL;
-  fci->extra_info->proc_desc =
+  deprecated_set_frame_saved_regs_hack (fci, NULL);
+  get_frame_extra_info (fci)->proc_desc =
     proc_desc == &temp_proc_desc ? 0 : proc_desc;
   if (proc_desc)
     {
@@ -2482,11 +2490,10 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
       /* This may not be quite right, if proc has a real frame register.
          Get the value of the frame relative sp, procedure might have been
          interrupted by a signal at it's very start.  */
-      if (fci->pc == PROC_LOW_ADDR (proc_desc)
+      if (get_frame_pc (fci) == PROC_LOW_ADDR (proc_desc)
          && !PROC_DESC_IS_DUMMY (proc_desc))
-       fci->frame = read_next_frame_reg (fci->next, SP_REGNUM);
-      else if (USE_GENERIC_DUMMY_FRAMES
-              && PC_IN_CALL_DUMMY (fci->pc, 0, 0))
+       deprecated_update_frame_base_hack (fci, read_next_frame_reg (get_next_frame (fci), SP_REGNUM));
+      else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fci), 0, 0))
        /* Do not ``fix'' fci->frame.  It will have the value of the
            generic dummy frame's top-of-stack (since the draft
            fci->frame is obtained by returning the unwound stack
@@ -2495,40 +2502,44 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
            part of the dummy frames data.  */
        /* Do nothing.  */;
       else
-       fci->frame = get_frame_pointer (fci->next, proc_desc);
+       deprecated_update_frame_base_hack (fci, get_frame_pointer (get_next_frame (fci), proc_desc));
 
       if (proc_desc == &temp_proc_desc)
        {
          char *name;
 
          /* Do not set the saved registers for a sigtramp frame,
-            mips_find_saved_registers will do that for us.
-            We can't use fci->signal_handler_caller, it is not yet set.  */
-         find_pc_partial_function (fci->pc, &name,
+            mips_find_saved_registers will do that for us.  We can't
+            use (get_frame_type (fci) == SIGTRAMP_FRAME), it is not
+            yet set.  */
+         /* FIXME: cagney/2002-11-18: This problem will go away once
+             frame.c:get_prev_frame() is modified to set the frame's
+             type before calling functions like this.  */
+         find_pc_partial_function (get_frame_pc (fci), &name,
                                    (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
-         if (!PC_IN_SIGTRAMP (fci->pc, name))
+         if (!PC_IN_SIGTRAMP (get_frame_pc (fci), name))
            {
              frame_saved_regs_zalloc (fci);
-             memcpy (fci->saved_regs, temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
-             fci->saved_regs[PC_REGNUM]
-               = fci->saved_regs[RA_REGNUM];
+             memcpy (get_frame_saved_regs (fci), temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
+             get_frame_saved_regs (fci)[PC_REGNUM]
+               = get_frame_saved_regs (fci)[RA_REGNUM];
              /* Set value of previous frame's stack pointer.  Remember that
                 saved_regs[SP_REGNUM] is special in that it contains the
                 value of the stack pointer register.  The other saved_regs
                 values are addresses (in the inferior) at which a given
                 register's value may be found.  */
-             fci->saved_regs[SP_REGNUM] = fci->frame;
+             get_frame_saved_regs (fci)[SP_REGNUM] = get_frame_base (fci);
            }
        }
 
       /* hack: if argument regs are saved, guess these contain args */
       /* assume we can't tell how many args for now */
-      fci->extra_info->num_args = -1;
+      get_frame_extra_info (fci)->num_args = -1;
       for (regnum = MIPS_LAST_ARG_REGNUM; regnum >= A0_REGNUM; regnum--)
        {
          if (PROC_REG_MASK (proc_desc) & (1 << regnum))
            {
-             fci->extra_info->num_args = regnum - A0_REGNUM + 1;
+             get_frame_extra_info (fci)->num_args = regnum - A0_REGNUM + 1;
              break;
            }
        }
@@ -3718,7 +3729,7 @@ mips_push_register (CORE_ADDR * sp, int regno)
       offset = 0;
     }
   *sp -= regsize;
-  read_register_gen (regno, buffer);
+  deprecated_read_register_gen (regno, buffer);
   write_memory (*sp, buffer + offset, regsize);
 }
 
@@ -3809,11 +3820,10 @@ mips_pop_frame (void)
 {
   register int regnum;
   struct frame_info *frame = get_current_frame ();
-  CORE_ADDR new_sp = FRAME_FP (frame);
-  mips_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
+  CORE_ADDR new_sp = get_frame_base (frame);
+  mips_extra_func_info_t proc_desc = get_frame_extra_info (frame)->proc_desc;
 
-  if (USE_GENERIC_DUMMY_FRAMES
-      && PC_IN_CALL_DUMMY (frame->pc, 0, 0))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0))
     {
       generic_pop_dummy_frame ();
       flush_cached_frames ();
@@ -3821,22 +3831,22 @@ mips_pop_frame (void)
     }
 
   write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
-  if (frame->saved_regs == NULL)
+  if (get_frame_saved_regs (frame) == NULL)
     FRAME_INIT_SAVED_REGS (frame);
   for (regnum = 0; regnum < NUM_REGS; regnum++)
     if (regnum != SP_REGNUM && regnum != PC_REGNUM
-       && frame->saved_regs[regnum])
+       && get_frame_saved_regs (frame)[regnum])
       {
        /* Floating point registers must not be sign extended, 
           in case MIPS_SAVED_REGSIZE = 4 but sizeof (FP0_REGNUM) == 8.  */
 
        if (FP0_REGNUM <= regnum && regnum < FP0_REGNUM + 32)
          write_register (regnum,
-                         read_memory_unsigned_integer (frame->saved_regs[regnum],
+                         read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum],
                                                        MIPS_SAVED_REGSIZE));
        else
          write_register (regnum,
-                         read_memory_integer (frame->saved_regs[regnum],
+                         read_memory_integer (get_frame_saved_regs (frame)[regnum],
                                               MIPS_SAVED_REGSIZE));
       }
 
@@ -3942,7 +3952,7 @@ mips_read_fp_register_single (int regno, char *rare_buffer)
   int raw_size = REGISTER_RAW_SIZE (regno);
   char *raw_buffer = alloca (raw_size);
 
-  if (!frame_register_read (selected_frame, regno, raw_buffer))
+  if (!frame_register_read (deprecated_selected_frame, regno, raw_buffer))
     error ("can't read register %d (%s)", regno, REGISTER_NAME (regno));
   if (raw_size == 8)
     {
@@ -3976,7 +3986,7 @@ mips_read_fp_register_double (int regno, char *rare_buffer)
     {
       /* We have a 64-bit value for this register, and we should use
         all 64 bits.  */
-      if (!frame_register_read (selected_frame, regno, rare_buffer))
+      if (!frame_register_read (deprecated_selected_frame, regno, rare_buffer))
        error ("can't read register %d (%s)", regno, REGISTER_NAME (regno));
     }
   else
@@ -4007,7 +4017,7 @@ mips_print_register (int regnum, int all)
   char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
 
   /* Get the data in raw format.  */
-  if (!frame_register_read (selected_frame, regnum, raw_buffer))
+  if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
     {
       printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum));
       return;
@@ -4187,7 +4197,7 @@ do_gp_register_row (int regnum)
       if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
        break;                  /* end row: reached FP register */
       /* OK: get the data in raw format.  */
-      if (!frame_register_read (selected_frame, regnum, raw_buffer))
+      if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
        error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
       /* pad small registers */
       for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++)
@@ -4666,17 +4676,15 @@ mips_eabi_store_return_value (struct type *valtype, char *valbuf)
 
   memset (raw_buffer, 0, sizeof (raw_buffer));
   memcpy (raw_buffer + lo.reg_offset, valbuf + lo.buf_offset, lo.len);
-  write_register_bytes (REGISTER_BYTE (lo.reg),
-                       raw_buffer,
-                       REGISTER_RAW_SIZE (lo.reg));
+  deprecated_write_register_bytes (REGISTER_BYTE (lo.reg), raw_buffer,
+                                  REGISTER_RAW_SIZE (lo.reg));
 
   if (hi.len > 0)
     {
       memset (raw_buffer, 0, sizeof (raw_buffer));
       memcpy (raw_buffer + hi.reg_offset, valbuf + hi.buf_offset, hi.len);
-      write_register_bytes (REGISTER_BYTE (hi.reg),
-                           raw_buffer,
-                           REGISTER_RAW_SIZE (hi.reg));
+      deprecated_write_register_bytes (REGISTER_BYTE (hi.reg), raw_buffer,
+                                      REGISTER_RAW_SIZE (hi.reg));
     }
 }
 
@@ -4690,17 +4698,15 @@ mips_o64_store_return_value (struct type *valtype, char *valbuf)
 
   memset (raw_buffer, 0, sizeof (raw_buffer));
   memcpy (raw_buffer + lo.reg_offset, valbuf + lo.buf_offset, lo.len);
-  write_register_bytes (REGISTER_BYTE (lo.reg),
-                       raw_buffer,
-                       REGISTER_RAW_SIZE (lo.reg));
+  deprecated_write_register_bytes (REGISTER_BYTE (lo.reg), raw_buffer,
+                                  REGISTER_RAW_SIZE (lo.reg));
 
   if (hi.len > 0)
     {
       memset (raw_buffer, 0, sizeof (raw_buffer));
       memcpy (raw_buffer + hi.reg_offset, valbuf + hi.buf_offset, hi.len);
-      write_register_bytes (REGISTER_BYTE (hi.reg),
-                           raw_buffer,
-                           REGISTER_RAW_SIZE (hi.reg));
+      deprecated_write_register_bytes (REGISTER_BYTE (hi.reg), raw_buffer,
+                                      REGISTER_RAW_SIZE (hi.reg));
     }
 }
 
@@ -5455,24 +5461,6 @@ mips_call_dummy_address (void)
 }
 
 
-/* If the current gcc for this target does not produce correct debugging
-   information for float parameters, both prototyped and unprototyped, then
-   define this macro.  This forces gdb to  always assume that floats are
-   passed as doubles and then converted in the callee.
-
-   For the mips chip, it appears that the debug info marks the parameters as
-   floats regardless of whether the function is prototyped, but the actual
-   values are passed as doubles for the non-prototyped case and floats for
-   the prototyped case.  Thus we choose to make the non-prototyped case work
-   for C and break the prototyped case, since the non-prototyped case is
-   probably much more common.  (FIXME). */
-
-static int
-mips_coerce_float_to_double (struct type *formal, struct type *actual)
-{
-  return current_language->la_language == language_c;
-}
-
 /* When debugging a 64 MIPS target running a 32 bit ABI, the size of
    the register stored on the stack (32) is different to its real raw
    size (64).  The below ensures that registers are fetched from the
@@ -5627,7 +5615,6 @@ mips_gdbarch_init (struct gdbarch_info info,
   struct gdbarch_tdep *tdep;
   int elf_flags;
   enum mips_abi mips_abi, found_abi, wanted_abi;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
   /* Reset the disassembly info, in case it was set to something
      non-default.  */
@@ -5642,10 +5629,6 @@ mips_gdbarch_init (struct gdbarch_info info,
       /* First of all, extract the elf_flags, if available.  */
       if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
        elf_flags = elf_elfheader (info.abfd)->e_flags;
-
-      /* Try to determine the OS ABI of the object we are loading.  If
-        we end up with `unknown', just leave it that way.  */
-      osabi = gdbarch_lookup_osabi (info.abfd);
     }
 
   /* Check ELF_FLAGS to see if it specifies the ABI being used.  */
@@ -5742,15 +5725,13 @@ mips_gdbarch_init (struct gdbarch_info info,
        continue;
       if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi)
        continue;
-      if (gdbarch_tdep (arches->gdbarch)->osabi == osabi)
-        return arches->gdbarch;
+      return arches->gdbarch;
     }
 
   /* Need a new architecture.  Fill in a target specific vector.  */
   tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
   tdep->elf_flags = elf_flags;
-  tdep->osabi = osabi;
 
   /* Initially set everything according to the default ABI/ISA.  */
   set_gdbarch_short_bit (gdbarch, 16);
@@ -5767,6 +5748,11 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_elf_make_msymbol_special (gdbarch, 
                                        mips_elf_make_msymbol_special);
 
+  if (info.osabi == GDB_OSABI_IRIX)
+    set_gdbarch_num_regs (gdbarch, 71);
+  else
+    set_gdbarch_num_regs (gdbarch, 90);
+
   switch (mips_abi)
     {
     case MIPS_ABI_O32:
@@ -5974,9 +5960,9 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove);
 
   /* There's a mess in stack frame creation.  See comments in
-     blockframe.c near reference to INIT_FRAME_PC_FIRST.  */
-  set_gdbarch_init_frame_pc_first (gdbarch, mips_init_frame_pc_first);
-  set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop);
+     blockframe.c near reference to DEPRECATED_INIT_FRAME_PC_FIRST.  */
+  set_gdbarch_deprecated_init_frame_pc_first (gdbarch, mips_init_frame_pc_first);
+  set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
 
   /* Map debug register numbers onto internal register numbers.  */
   set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
@@ -5990,53 +5976,30 @@ mips_gdbarch_init (struct gdbarch_info info,
 
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-#if OLD_STYLE_MIPS_DUMMY_FRAMES
-  set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
-#else
-  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
-#endif
-  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
   set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
   set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
-#if OLD_STYLE_MIPS_DUMMY_FRAMES
-  set_gdbarch_push_dummy_frame (gdbarch, mips_push_dummy_frame);
-#else
   set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
-#endif
   set_gdbarch_pop_frame (gdbarch, mips_pop_frame);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
   set_gdbarch_call_dummy_length (gdbarch, 0);
   set_gdbarch_fix_call_dummy (gdbarch, mips_fix_call_dummy);
-#if OLD_STYLE_MIPS_DUMMY_FRAMES
-  set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
-#else
-  set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
-#endif
   set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
   set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
   set_gdbarch_frame_align (gdbarch, mips_frame_align);
-#if OLD_STYLE_MIPS_DUMMY_FRAMES
-#else
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
-#endif
   set_gdbarch_register_convertible (gdbarch, mips_register_convertible);
   set_gdbarch_register_convert_to_virtual (gdbarch, 
                                           mips_register_convert_to_virtual);
   set_gdbarch_register_convert_to_raw (gdbarch, 
                                       mips_register_convert_to_raw);
 
-  set_gdbarch_coerce_float_to_double (gdbarch, mips_coerce_float_to_double);
-
   set_gdbarch_frame_chain (gdbarch, mips_frame_chain);
-  set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
   set_gdbarch_frameless_function_invocation (gdbarch, 
                                             generic_frameless_function_invocation_not);
   set_gdbarch_frame_saved_pc (gdbarch, mips_frame_saved_pc);
-  set_gdbarch_frame_args_address (gdbarch, default_frame_address);
-  set_gdbarch_frame_locals_address (gdbarch, default_frame_address);
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_frame_args_skip (gdbarch, 0);
 
@@ -6060,11 +6023,11 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type);
   set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
 
-  set_gdbarch_do_registers_info (gdbarch, mips_do_registers_info);
+  set_gdbarch_deprecated_do_registers_info (gdbarch, mips_do_registers_info);
   set_gdbarch_pc_in_sigtramp (gdbarch, mips_pc_in_sigtramp);
 
   /* Hook in OS ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   set_gdbarch_store_struct_return (gdbarch, mips_store_struct_return);
   set_gdbarch_extract_struct_value_address (gdbarch, 
@@ -6193,9 +6156,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                      "mips_dump_tdep: CAUSE_REGNUM = %d\n",
                      CAUSE_REGNUM);
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: DO_REGISTERS_INFO # %s\n",
-                     XSTRING (DO_REGISTERS_INFO));
   fprintf_unfiltered (file,
                      "mips_dump_tdep: DWARF_REG_TO_REGNUM # %s\n",
                      XSTRING (DWARF_REG_TO_REGNUM (REGNUM)));
@@ -6217,12 +6177,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                      "mips_dump_tdep: GDB_TARGET_IS_MIPS64 = %d\n",
                      GDB_TARGET_IS_MIPS64);
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: GDB_TARGET_MASK_DISAS_PC # %s\n",
-                     XSTRING (GDB_TARGET_MASK_DISAS_PC (PC)));
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: GDB_TARGET_UNMASK_DISAS_PC # %s\n",
-                     XSTRING (GDB_TARGET_UNMASK_DISAS_PC (PC)));
   fprintf_unfiltered (file,
                      "mips_dump_tdep: GEN_REG_SAVE_MASK = %d\n",
                      GEN_REG_SAVE_MASK);
@@ -6478,10 +6432,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                      "mips_dump_tdep: _PROC_MAGIC_ = %d\n",
                      _PROC_MAGIC_);
-
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: OS ABI = %s\n",
-                     gdbarch_osabi_name (tdep->osabi));
 }
 
 void
This page took 0.035438 seconds and 4 git commands to generate.