*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / mips-tdep.c
index 619021ba3f8172a79a11c734bd87bd8e1c0cb8b1..bc364ebad50849d79b1b5f85b9cff372a57025c2 100644 (file)
@@ -245,7 +245,7 @@ mips_xfer_register (struct regcache *regcache, int reg_num, int length,
                    enum bfd_endian endian, bfd_byte *in, const bfd_byte *out,
                    int buf_offset)
 {
-  bfd_byte *reg = alloca (MAX_REGISTER_RAW_SIZE);
+  bfd_byte reg[MAX_REGISTER_SIZE];
   int reg_offset = 0;
   /* Need to transfer the left or right part of the register, based on
      the targets byte order.  */
@@ -350,8 +350,6 @@ mips_stack_argsize (void)
 
 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);
 
@@ -372,9 +370,6 @@ static mips_extra_func_info_t find_proc_desc (CORE_ADDR pc,
 static CORE_ADDR after_prologue (CORE_ADDR pc,
                                 mips_extra_func_info_t proc_desc);
 
-static void mips_read_fp_register_single (int regno, char *rare_buffer);
-static void mips_read_fp_register_double (int regno, char *rare_buffer);
-
 static struct type *mips_float_register_type (void);
 static struct type *mips_double_register_type (void);
 
@@ -1642,7 +1637,7 @@ read_next_frame_reg (struct frame_info *fi, int regno)
   CORE_ADDR addr;
   int realnum;
   enum lval_type lval;
-  void *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+  char raw_buffer[MAX_REGISTER_SIZE];
 
   if (fi == NULL)
     {
@@ -2389,7 +2384,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
       return NULL;
     }
 
-  sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, 0, NULL);
+  sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0, NULL);
 
   /* If we never found a PDR for this function in symbol reading, then
      examine prologues to find the information.  */
@@ -2697,11 +2692,10 @@ mips_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
 }
 
 static CORE_ADDR
-mips_eabi_push_arguments (int nargs,
-                         struct value **args,
-                         CORE_ADDR sp,
-                         int struct_return,
-                         CORE_ADDR struct_addr)
+mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+                          struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+                          struct value **args, CORE_ADDR sp, int struct_return,
+                          CORE_ADDR struct_addr)
 {
   int argreg;
   int float_argreg;
@@ -2709,6 +2703,14 @@ mips_eabi_push_arguments (int nargs,
   int len = 0;
   int stack_offset = 0;
 
+  /* For shared libraries, "t9" needs to point at the function
+     address.  */
+  regcache_cooked_write_signed (regcache, T9_REGNUM, func_addr);
+
+  /* Set the return address register to point to the entry point of
+     the program, where a breakpoint lies in wait.  */
+  regcache_cooked_write_signed (regcache, RA_REGNUM, bp_addr);
+
   /* First ensure that the stack and structure return address (if any)
      are properly aligned.  The stack has to be at least 64-bit
      aligned even on 32-bit machines, because doubles must be 64-bit
@@ -2728,7 +2730,7 @@ mips_eabi_push_arguments (int nargs,
 
   if (mips_debug)
     fprintf_unfiltered (gdb_stdlog, 
-                       "mips_eabi_push_arguments: sp=0x%s allocated %d\n",
+                       "mips_eabi_push_dummy_call: sp=0x%s allocated %d\n",
                        paddr_nz (sp), ROUND_UP (len, 16));
 
   /* Initialize the integer and float register pointers.  */
@@ -2740,7 +2742,7 @@ mips_eabi_push_arguments (int nargs,
     {
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_eabi_push_arguments: struct_return reg=%d 0x%s\n",
+                           "mips_eabi_push_dummy_call: struct_return reg=%d 0x%s\n",
                            argreg, paddr_nz (struct_addr));
       write_register (argreg++, struct_addr);
     }
@@ -2751,7 +2753,7 @@ mips_eabi_push_arguments (int nargs,
   for (argnum = 0; argnum < nargs; argnum++)
     {
       char *val;
-      char *valbuf = alloca (MAX_REGISTER_RAW_SIZE);
+      char valbuf[MAX_REGISTER_SIZE];
       struct value *arg = args[argnum];
       struct type *arg_type = check_typedef (VALUE_TYPE (arg));
       int len = TYPE_LENGTH (arg_type);
@@ -2759,7 +2761,7 @@ mips_eabi_push_arguments (int nargs,
 
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_eabi_push_arguments: %d len=%d type=%d",
+                           "mips_eabi_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
       /* The EABI passes structures that do not fit in a register by
@@ -2767,7 +2769,7 @@ mips_eabi_push_arguments (int nargs,
       if (len > MIPS_SAVED_REGSIZE
          && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
        {
-         store_address (valbuf, MIPS_SAVED_REGSIZE, VALUE_ADDRESS (arg));
+         store_unsigned_integer (valbuf, MIPS_SAVED_REGSIZE, VALUE_ADDRESS (arg));
          typecode = TYPE_CODE_PTR;
          len = MIPS_SAVED_REGSIZE;
          val = valbuf;
@@ -2947,14 +2949,13 @@ mips_eabi_push_arguments (int nargs,
   return sp;
 }
 
-/* N32/N64 version of push_arguments.  */
+/* N32/N64 version of push_dummy_call.  */
 
 static CORE_ADDR
-mips_n32n64_push_arguments (int nargs,
-                           struct value **args,
-                           CORE_ADDR sp,
-                           int struct_return,
-                           CORE_ADDR struct_addr)
+mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+                            struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+                            struct value **args, CORE_ADDR sp, int struct_return,
+                            CORE_ADDR struct_addr)
 {
   int argreg;
   int float_argreg;
@@ -2962,6 +2963,14 @@ mips_n32n64_push_arguments (int nargs,
   int len = 0;
   int stack_offset = 0;
 
+  /* For shared libraries, "t9" needs to point at the function
+     address.  */
+  regcache_cooked_write_signed (regcache, T9_REGNUM, func_addr);
+
+  /* Set the return address register to point to the entry point of
+     the program, where a breakpoint lies in wait.  */
+  regcache_cooked_write_signed (regcache, RA_REGNUM, bp_addr);
+
   /* First ensure that the stack and structure return address (if any)
      are properly aligned.  The stack has to be at least 64-bit
      aligned even on 32-bit machines, because doubles must be 64-bit
@@ -2979,7 +2988,7 @@ mips_n32n64_push_arguments (int nargs,
 
   if (mips_debug)
     fprintf_unfiltered (gdb_stdlog, 
-                       "mips_n32n64_push_arguments: sp=0x%s allocated %d\n",
+                       "mips_n32n64_push_dummy_call: sp=0x%s allocated %d\n",
                        paddr_nz (sp), ROUND_UP (len, 16));
 
   /* Initialize the integer and float register pointers.  */
@@ -2991,7 +3000,7 @@ mips_n32n64_push_arguments (int nargs,
     {
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_n32n64_push_arguments: struct_return reg=%d 0x%s\n",
+                           "mips_n32n64_push_dummy_call: struct_return reg=%d 0x%s\n",
                            argreg, paddr_nz (struct_addr));
       write_register (argreg++, struct_addr);
     }
@@ -3002,7 +3011,7 @@ mips_n32n64_push_arguments (int nargs,
   for (argnum = 0; argnum < nargs; argnum++)
     {
       char *val;
-      char *valbuf = alloca (MAX_REGISTER_RAW_SIZE);
+      char valbuf[MAX_REGISTER_SIZE];
       struct value *arg = args[argnum];
       struct type *arg_type = check_typedef (VALUE_TYPE (arg));
       int len = TYPE_LENGTH (arg_type);
@@ -3010,7 +3019,7 @@ mips_n32n64_push_arguments (int nargs,
 
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_n32n64_push_arguments: %d len=%d type=%d",
+                           "mips_n32n64_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
       val = (char *) VALUE_CONTENTS (arg);
@@ -3169,14 +3178,13 @@ mips_n32n64_push_arguments (int nargs,
   return sp;
 }
 
-/* O32 version of push_arguments.  */
+/* O32 version of push_dummy_call.  */
 
 static CORE_ADDR
-mips_o32_push_arguments (int nargs,
-                        struct value **args,
-                        CORE_ADDR sp,
-                        int struct_return,
-                        CORE_ADDR struct_addr)
+mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+                         struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+                         struct value **args, CORE_ADDR sp, int struct_return,
+                         CORE_ADDR struct_addr)
 {
   int argreg;
   int float_argreg;
@@ -3184,6 +3192,14 @@ mips_o32_push_arguments (int nargs,
   int len = 0;
   int stack_offset = 0;
 
+  /* For shared libraries, "t9" needs to point at the function
+     address.  */
+  regcache_cooked_write_signed (regcache, T9_REGNUM, func_addr);
+
+  /* Set the return address register to point to the entry point of
+     the program, where a breakpoint lies in wait.  */
+  regcache_cooked_write_signed (regcache, RA_REGNUM, bp_addr);
+
   /* First ensure that the stack and structure return address (if any)
      are properly aligned.  The stack has to be at least 64-bit
      aligned even on 32-bit machines, because doubles must be 64-bit
@@ -3201,7 +3217,7 @@ mips_o32_push_arguments (int nargs,
 
   if (mips_debug)
     fprintf_unfiltered (gdb_stdlog, 
-                       "mips_o32_push_arguments: sp=0x%s allocated %d\n",
+                       "mips_o32_push_dummy_call: sp=0x%s allocated %d\n",
                        paddr_nz (sp), ROUND_UP (len, 16));
 
   /* Initialize the integer and float register pointers.  */
@@ -3213,7 +3229,7 @@ mips_o32_push_arguments (int nargs,
     {
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_o32_push_arguments: struct_return reg=%d 0x%s\n",
+                           "mips_o32_push_dummy_call: struct_return reg=%d 0x%s\n",
                            argreg, paddr_nz (struct_addr));
       write_register (argreg++, struct_addr);
       stack_offset += MIPS_STACK_ARGSIZE;
@@ -3225,7 +3241,7 @@ mips_o32_push_arguments (int nargs,
   for (argnum = 0; argnum < nargs; argnum++)
     {
       char *val;
-      char *valbuf = alloca (MAX_REGISTER_RAW_SIZE);
+      char valbuf[MAX_REGISTER_SIZE];
       struct value *arg = args[argnum];
       struct type *arg_type = check_typedef (VALUE_TYPE (arg));
       int len = TYPE_LENGTH (arg_type);
@@ -3233,7 +3249,7 @@ mips_o32_push_arguments (int nargs,
 
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_o32_push_arguments: %d len=%d type=%d",
+                           "mips_o32_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
       val = (char *) VALUE_CONTENTS (arg);
@@ -3468,14 +3484,13 @@ mips_o32_push_arguments (int nargs,
   return sp;
 }
 
-/* O64 version of push_arguments.  */
+/* O64 version of push_dummy_call.  */
 
 static CORE_ADDR
-mips_o64_push_arguments (int nargs,
-                        struct value **args,
-                        CORE_ADDR sp,
-                        int struct_return,
-                        CORE_ADDR struct_addr)
+mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+                         struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+                         struct value **args, CORE_ADDR sp, int struct_return,
+                         CORE_ADDR struct_addr)
 {
   int argreg;
   int float_argreg;
@@ -3483,6 +3498,14 @@ mips_o64_push_arguments (int nargs,
   int len = 0;
   int stack_offset = 0;
 
+  /* For shared libraries, "t9" needs to point at the function
+     address.  */
+  regcache_cooked_write_signed (regcache, T9_REGNUM, func_addr);
+
+  /* Set the return address register to point to the entry point of
+     the program, where a breakpoint lies in wait.  */
+  regcache_cooked_write_signed (regcache, RA_REGNUM, bp_addr);
+
   /* First ensure that the stack and structure return address (if any)
      are properly aligned.  The stack has to be at least 64-bit
      aligned even on 32-bit machines, because doubles must be 64-bit
@@ -3500,7 +3523,7 @@ mips_o64_push_arguments (int nargs,
 
   if (mips_debug)
     fprintf_unfiltered (gdb_stdlog, 
-                       "mips_o64_push_arguments: sp=0x%s allocated %d\n",
+                       "mips_o64_push_dummy_call: sp=0x%s allocated %d\n",
                        paddr_nz (sp), ROUND_UP (len, 16));
 
   /* Initialize the integer and float register pointers.  */
@@ -3512,7 +3535,7 @@ mips_o64_push_arguments (int nargs,
     {
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_o64_push_arguments: struct_return reg=%d 0x%s\n",
+                           "mips_o64_push_dummy_call: struct_return reg=%d 0x%s\n",
                            argreg, paddr_nz (struct_addr));
       write_register (argreg++, struct_addr);
       stack_offset += MIPS_STACK_ARGSIZE;
@@ -3524,7 +3547,7 @@ mips_o64_push_arguments (int nargs,
   for (argnum = 0; argnum < nargs; argnum++)
     {
       char *val;
-      char *valbuf = alloca (MAX_REGISTER_RAW_SIZE);
+      char valbuf[MAX_REGISTER_SIZE];
       struct value *arg = args[argnum];
       struct type *arg_type = check_typedef (VALUE_TYPE (arg));
       int len = TYPE_LENGTH (arg_type);
@@ -3532,7 +3555,7 @@ mips_o64_push_arguments (int nargs,
 
       if (mips_debug)
        fprintf_unfiltered (gdb_stdlog,
-                           "mips_o64_push_arguments: %d len=%d type=%d",
+                           "mips_o64_push_dummy_call: %d len=%d type=%d",
                            argnum + 1, len, (int) typecode);
 
       val = (char *) VALUE_CONTENTS (arg);
@@ -3767,15 +3790,6 @@ mips_o64_push_arguments (int nargs,
   return sp;
 }
 
-static CORE_ADDR
-mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  /* Set the return address register to point to the entry
-     point of the program, where a breakpoint lies in wait.  */
-  write_register (RA_REGNUM, CALL_DUMMY_ADDRESS ());
-  return sp;
-}
-
 static void
 mips_pop_frame (void)
 {
@@ -3850,13 +3864,6 @@ mips_pop_frame (void)
     }
 }
 
-static void
-mips_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, 
-                    struct value **args, struct type *type, int gcc_p)
-{
-  write_register(T9_REGNUM, fun);
-}
-
 /* Floating point register management.
 
    Background: MIPS1 & 2 fp registers are 32 bits wide.  To support
@@ -3909,12 +3916,13 @@ mips_double_register_type (void)
    into rare_buffer.  */
 
 static void
-mips_read_fp_register_single (int regno, char *rare_buffer)
+mips_read_fp_register_single (struct frame_info *frame, int regno,
+                             char *rare_buffer)
 {
   int raw_size = REGISTER_RAW_SIZE (regno);
   char *raw_buffer = alloca (raw_size);
 
-  if (!frame_register_read (deprecated_selected_frame, regno, raw_buffer))
+  if (!frame_register_read (frame, regno, raw_buffer))
     error ("can't read register %d (%s)", regno, REGISTER_NAME (regno));
   if (raw_size == 8)
     {
@@ -3940,7 +3948,8 @@ mips_read_fp_register_single (int regno, char *rare_buffer)
    register.  */
 
 static void
-mips_read_fp_register_double (int regno, char *rare_buffer)
+mips_read_fp_register_double (struct frame_info *frame, int regno,
+                             char *rare_buffer)
 {
   int raw_size = REGISTER_RAW_SIZE (regno);
 
@@ -3948,7 +3957,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 (deprecated_selected_frame, regno, rare_buffer))
+      if (!frame_register_read (frame, regno, rare_buffer))
        error ("can't read register %d (%s)", regno, REGISTER_NAME (regno));
     }
   else
@@ -3962,19 +3971,20 @@ mips_read_fp_register_double (int regno, char *rare_buffer)
         each register.  */
       if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
        {
-         mips_read_fp_register_single (regno, rare_buffer + 4);
-         mips_read_fp_register_single (regno + 1, rare_buffer);
+         mips_read_fp_register_single (frame, regno, rare_buffer + 4);
+         mips_read_fp_register_single (frame, regno + 1, rare_buffer);
        }
       else
        {
-         mips_read_fp_register_single (regno, rare_buffer);
-         mips_read_fp_register_single (regno + 1, rare_buffer + 4);
+         mips_read_fp_register_single (frame, regno, rare_buffer);
+         mips_read_fp_register_single (frame, regno + 1, rare_buffer + 4);
        }
     }
 }
 
 static void
-mips_print_fp_register (int regnum)
+mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
+                       int regnum)
 {                              /* do values for FP (float) regs */
   char *raw_buffer;
   double doub, flt1, flt2;     /* doubles extracted from raw hex data */
@@ -3982,94 +3992,94 @@ mips_print_fp_register (int regnum)
 
   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
 
-  printf_filtered ("%s:", REGISTER_NAME (regnum));
-  printf_filtered ("%*s", 4 - (int) strlen (REGISTER_NAME (regnum)), "");
+  fprintf_filtered (file, "%s:", REGISTER_NAME (regnum));
+  fprintf_filtered (file, "%*s", 4 - (int) strlen (REGISTER_NAME (regnum)),
+                   "");
 
   if (REGISTER_RAW_SIZE (regnum) == 4 || mips2_fp_compat ())
     {
       /* 4-byte registers: Print hex and floating.  Also print even
          numbered registers as doubles.  */
-      mips_read_fp_register_single (regnum, raw_buffer);
+      mips_read_fp_register_single (frame, regnum, raw_buffer);
       flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
 
-      print_scalar_formatted (raw_buffer, builtin_type_uint32, 'x', 'w',
-                              gdb_stdout);
+      print_scalar_formatted (raw_buffer, builtin_type_uint32, 'x', 'w', file);
 
-      printf_filtered (" flt: ");
+      fprintf_filtered (file, " flt: ");
       if (inv1)
-       printf_filtered (" <invalid float> ");
+       fprintf_filtered (file, " <invalid float> ");
       else
-       printf_filtered ("%-17.9g", flt1);
+       fprintf_filtered (file, "%-17.9g", flt1);
 
       if (regnum % 2 == 0)
        {
-         mips_read_fp_register_double (regnum, raw_buffer);
+         mips_read_fp_register_double (frame, regnum, raw_buffer);
          doub = unpack_double (mips_double_register_type (), raw_buffer,
                                &inv2);
 
-         printf_filtered (" dbl: ");
+         fprintf_filtered (file, " dbl: ");
          if (inv2)
-           printf_filtered ("<invalid double>");
+           fprintf_filtered (file, "<invalid double>");
          else
-           printf_filtered ("%-24.17g", doub);
+           fprintf_filtered (file, "%-24.17g", doub);
        }
     }
   else
     {
       /* Eight byte registers: print each one as hex, float and double.  */
-      mips_read_fp_register_single (regnum, raw_buffer);
+      mips_read_fp_register_single (frame, regnum, raw_buffer);
       flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
 
-      mips_read_fp_register_double (regnum, raw_buffer);
+      mips_read_fp_register_double (frame, regnum, raw_buffer);
       doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
 
 
-      print_scalar_formatted (raw_buffer, builtin_type_uint64, 'x', 'g',
-                              gdb_stdout);
+      print_scalar_formatted (raw_buffer, builtin_type_uint64, 'x', 'g', file);
 
-      printf_filtered (" flt: ");
+      fprintf_filtered (file, " flt: ");
       if (inv1)
-       printf_filtered ("<invalid float>");
+       fprintf_filtered (file, "<invalid float>");
       else
-       printf_filtered ("%-17.9g", flt1);
+       fprintf_filtered (file, "%-17.9g", flt1);
 
-      printf_filtered (" dbl: ");
+      fprintf_filtered (file, " dbl: ");
       if (inv2)
-       printf_filtered ("<invalid double>");
+       fprintf_filtered (file, "<invalid double>");
       else
-       printf_filtered ("%-24.17g", doub);
+       fprintf_filtered (file, "%-24.17g", doub);
     }
 }
 
 static void
-mips_print_register (int regnum, int all)
+mips_print_register (struct ui_file *file, struct frame_info *frame,
+                    int regnum, int all)
 {
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+  char raw_buffer[MAX_REGISTER_SIZE];
   int offset;
 
   if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
     {
-      mips_print_fp_register (regnum);
+      mips_print_fp_register (file, frame, regnum);
       return;
     }
 
   /* Get the data in raw format.  */
-  if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
+  if (!frame_register_read (frame, regnum, raw_buffer))
     {
-      printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum));
+      fprintf_filtered (file, "%s: [Invalid]", REGISTER_NAME (regnum));
       return;
     }
 
-  fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
+  fputs_filtered (REGISTER_NAME (regnum), file);
 
   /* The problem with printing numeric register names (r26, etc.) is that
      the user can't use them on input.  Probably the best solution is to
      fix it so that either the numeric or the funky (a2, etc.) names
      are accepted on input.  */
   if (regnum < MIPS_NUMREGS)
-    printf_filtered ("(r%d): ", regnum);
+    fprintf_filtered (file, "(r%d): ", regnum);
   else
-    printf_filtered (": ");
+    fprintf_filtered (file, ": ");
 
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum);
@@ -4078,18 +4088,19 @@ mips_print_register (int regnum, int all)
 
   print_scalar_formatted (raw_buffer + offset,
                          REGISTER_VIRTUAL_TYPE (regnum),
-                         'x', 0, gdb_stdout);
+                         'x', 0, file);
 }
 
 /* Replacement for generic do_registers_info.
    Print regs in pretty columns.  */
 
 static int
-do_fp_register_row (int regnum)
+print_fp_register_row (struct ui_file *file, struct frame_info *frame,
+                      int regnum)
 {
-  printf_filtered (" ");
-  mips_print_fp_register (regnum);
-  printf_filtered ("\n");
+  fprintf_filtered (file, " ");
+  mips_print_fp_register (file, frame, regnum);
+  fprintf_filtered (file, "\n");
   return regnum + 1;
 }
 
@@ -4097,10 +4108,11 @@ do_fp_register_row (int regnum)
 /* Print a row's worth of GP (int) registers, with name labels above */
 
 static int
-do_gp_register_row (int regnum)
+print_gp_register_row (struct ui_file *file, struct frame_info *frame,
+                      int regnum)
 {
   /* do values for GP (int) regs */
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+  char raw_buffer[MAX_REGISTER_SIZE];
   int ncols = (MIPS_REGSIZE == 8 ? 4 : 8);     /* display cols per row */
   int col, byte;
   int start_regnum = regnum;
@@ -4108,19 +4120,20 @@ do_gp_register_row (int regnum)
 
 
   /* For GP registers, we print a separate row of names above the vals */
-  printf_filtered ("     ");
+  fprintf_filtered (file, "     ");
   for (col = 0; col < ncols && regnum < numregs; regnum++)
     {
       if (*REGISTER_NAME (regnum) == '\0')
        continue;               /* unused register */
       if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
        break;                  /* end the row: reached FP register */
-      printf_filtered (MIPS_REGSIZE == 8 ? "%17s" : "%9s",
-                      REGISTER_NAME (regnum));
+      fprintf_filtered (file, MIPS_REGSIZE == 8 ? "%17s" : "%9s",
+                       REGISTER_NAME (regnum));
       col++;
     }
-  printf_filtered (start_regnum < MIPS_NUMREGS ? "\n R%-4d" : "\n      ",
-                  start_regnum);       /* print the R0 to R31 names */
+  fprintf_filtered (file,
+                   start_regnum < MIPS_NUMREGS ? "\n R%-4d" : "\n      ",
+                   start_regnum);      /* print the R0 to R31 names */
 
   regnum = start_regnum;       /* go back to start of row */
   /* now print the values in hex, 4 or 8 to the row */
@@ -4131,7 +4144,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 (deprecated_selected_frame, regnum, raw_buffer))
+      if (!frame_register_read (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++)
@@ -4141,17 +4154,17 @@ do_gp_register_row (int regnum)
        for (byte = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum);
             byte < REGISTER_RAW_SIZE (regnum);
             byte++)
-         printf_filtered ("%02x", (unsigned char) raw_buffer[byte]);
+         fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[byte]);
       else
        for (byte = REGISTER_VIRTUAL_SIZE (regnum) - 1;
             byte >= 0;
             byte--)
-         printf_filtered ("%02x", (unsigned char) raw_buffer[byte]);
-      printf_filtered (" ");
+         fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[byte]);
+      fprintf_filtered (file, " ");
       col++;
     }
   if (col > 0)                 /* ie. if we actually printed anything... */
-    printf_filtered ("\n");
+    fprintf_filtered (file, "\n");
 
   return regnum;
 }
@@ -4159,15 +4172,16 @@ do_gp_register_row (int regnum)
 /* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
 
 static void
-mips_do_registers_info (int regnum, int fpregs)
+mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+                          struct frame_info *frame, int regnum, int all)
 {
   if (regnum != -1)            /* do one specified register */
     {
       if (*(REGISTER_NAME (regnum)) == '\0')
        error ("Not a valid register for the current processor type");
 
-      mips_print_register (regnum, 0);
-      printf_filtered ("\n");
+      mips_print_register (file, frame, regnum, 0);
+      fprintf_filtered (file, "\n");
     }
   else
     /* do all (or most) registers */
@@ -4176,12 +4190,14 @@ mips_do_registers_info (int regnum, int fpregs)
       while (regnum < NUM_REGS)
        {
          if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
-           if (fpregs)         /* true for "INFO ALL-REGISTERS" command */
-             regnum = do_fp_register_row (regnum);     /* FP regs */
-           else
-             regnum += MIPS_NUMREGS;   /* skip floating point regs */
+           {
+             if (all)          /* true for "INFO ALL-REGISTERS" command */
+               regnum = print_fp_register_row (file, frame, regnum);
+             else
+               regnum += MIPS_NUMREGS; /* skip floating point regs */
+           }
          else
-           regnum = do_gp_register_row (regnum);       /* GP (int) regs */
+           regnum = print_gp_register_row (file, frame, regnum);
        }
     }
 }
@@ -4561,7 +4577,7 @@ return_value_location (struct type *valtype,
 
 static void
 mips_eabi_extract_return_value (struct type *valtype,
-                               char regbuf[REGISTER_BYTES],
+                               char regbuf[],
                                char *valbuf)
 {
   struct return_value_word lo;
@@ -4580,7 +4596,7 @@ mips_eabi_extract_return_value (struct type *valtype,
 
 static void
 mips_o64_extract_return_value (struct type *valtype,
-                              char regbuf[REGISTER_BYTES],
+                              char regbuf[],
                               char *valbuf)
 {
   struct return_value_word lo;
@@ -4603,7 +4619,7 @@ mips_o64_extract_return_value (struct type *valtype,
 static void
 mips_eabi_store_return_value (struct type *valtype, char *valbuf)
 {
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+  char raw_buffer[MAX_REGISTER_SIZE];
   struct return_value_word lo;
   struct return_value_word hi;
   return_value_location (valtype, &hi, &lo);
@@ -4625,7 +4641,7 @@ mips_eabi_store_return_value (struct type *valtype, char *valbuf)
 static void
 mips_o64_store_return_value (struct type *valtype, char *valbuf)
 {
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+  char raw_buffer[MAX_REGISTER_SIZE];
   struct return_value_word lo;
   struct return_value_word hi;
   return_value_location (valtype, &hi, &lo);
@@ -4707,7 +4723,7 @@ mips_o32_xfer_return_value (struct type *type,
       /* A struct that contains one or two floats.  Each value is part
          in the least significant part of their floating point
          register..  */
-      bfd_byte *reg = alloca (MAX_REGISTER_RAW_SIZE);
+      bfd_byte reg[MAX_REGISTER_SIZE];
       int regnum;
       int field;
       for (field = 0, regnum = FP0_REGNUM;
@@ -4819,7 +4835,7 @@ mips_n32n64_xfer_return_value (struct type *type,
       /* A struct that contains one or two floats.  Each value is part
          in the least significant part of their floating point
          register..  */
-      bfd_byte *reg = alloca (MAX_REGISTER_RAW_SIZE);
+      bfd_byte reg[MAX_REGISTER_SIZE];
       int regnum;
       int field;
       for (field = 0, regnum = FP0_REGNUM;
@@ -4893,12 +4909,6 @@ mips_n32n64_store_return_value (struct type *type, char *valbuf)
   mips_n32n64_xfer_return_value (type, current_regcache, NULL, valbuf);
 }
 
-static void
-mips_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
-  /* Nothing to do -- push_arguments does all the work.  */
-}
-
 static CORE_ADDR
 mips_extract_struct_value_address (struct regcache *regcache)
 {
@@ -5119,19 +5129,6 @@ gdb_print_insn_mips (bfd_vma memaddr, disassemble_info *info)
     return print_insn_little_mips (memaddr, info);
 }
 
-/* Old-style breakpoint macros.
-   The IDT board uses an unusual breakpoint value, and sometimes gets
-   confused when it sees the usual MIPS breakpoint instruction.  */
-
-#define BIG_BREAKPOINT {0, 0x5, 0, 0xd}
-#define LITTLE_BREAKPOINT {0xd, 0, 0x5, 0}
-#define PMON_BIG_BREAKPOINT {0, 0, 0, 0xd}
-#define PMON_LITTLE_BREAKPOINT {0xd, 0, 0, 0}
-#define IDT_BIG_BREAKPOINT {0, 0, 0x0a, 0xd}
-#define IDT_LITTLE_BREAKPOINT {0xd, 0x0a, 0, 0}
-#define MIPS16_BIG_BREAKPOINT {0xe8, 0xa5}
-#define MIPS16_LITTLE_BREAKPOINT {0xa5, 0xe8}
-
 /* This function implements the BREAKPOINT_FROM_PC macro.  It uses the program
    counter value to determine whether a 16- or 32-bit breakpoint should be
    used.  It returns a pointer to a string of bytes that encode a breakpoint
@@ -5146,17 +5143,19 @@ mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
     {
       if (pc_is_mips16 (*pcptr))
        {
-         static unsigned char mips16_big_breakpoint[] =
-           MIPS16_BIG_BREAKPOINT;
+         static unsigned char mips16_big_breakpoint[] = {0xe8, 0xa5};
          *pcptr = UNMAKE_MIPS16_ADDR (*pcptr);
          *lenptr = sizeof (mips16_big_breakpoint);
          return mips16_big_breakpoint;
        }
       else
        {
-         static unsigned char big_breakpoint[] = BIG_BREAKPOINT;
-         static unsigned char pmon_big_breakpoint[] = PMON_BIG_BREAKPOINT;
-         static unsigned char idt_big_breakpoint[] = IDT_BIG_BREAKPOINT;
+         /* The IDT board uses an unusual breakpoint value, and
+            sometimes gets confused when it sees the usual MIPS
+            breakpoint instruction.  */
+         static unsigned char big_breakpoint[] = {0, 0x5, 0, 0xd};
+         static unsigned char pmon_big_breakpoint[] = {0, 0, 0, 0xd};
+         static unsigned char idt_big_breakpoint[] = {0, 0, 0x0a, 0xd};
 
          *lenptr = sizeof (big_breakpoint);
 
@@ -5174,19 +5173,16 @@ mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
     {
       if (pc_is_mips16 (*pcptr))
        {
-         static unsigned char mips16_little_breakpoint[] =
-           MIPS16_LITTLE_BREAKPOINT;
+         static unsigned char mips16_little_breakpoint[] = {0xa5, 0xe8};
          *pcptr = UNMAKE_MIPS16_ADDR (*pcptr);
          *lenptr = sizeof (mips16_little_breakpoint);
          return mips16_little_breakpoint;
        }
       else
        {
-         static unsigned char little_breakpoint[] = LITTLE_BREAKPOINT;
-         static unsigned char pmon_little_breakpoint[] =
-           PMON_LITTLE_BREAKPOINT;
-         static unsigned char idt_little_breakpoint[] =
-           IDT_LITTLE_BREAKPOINT;
+         static unsigned char little_breakpoint[] = {0xd, 0, 0x5, 0};
+         static unsigned char pmon_little_breakpoint[] = {0xd, 0, 0, 0};
+         static unsigned char idt_little_breakpoint[] = {0xd, 0x0a, 0, 0};
 
          *lenptr = sizeof (little_breakpoint);
 
@@ -5442,7 +5438,7 @@ mips_get_saved_register (char *raw_buffer,
              /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
                 saved. */
              LONGEST val = read_memory_integer ((*addrp), MIPS_SAVED_REGSIZE);
-             store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), val);
+             store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), val);
            }
        }
     }
@@ -5564,8 +5560,6 @@ static struct gdbarch *
 mips_gdbarch_init (struct gdbarch_info info,
                   struct gdbarch_list *arches)
 {
-  static LONGEST mips_call_dummy_words[] =
-  {0};
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
   int elf_flags;
@@ -5723,8 +5717,6 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_double_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 64);
   set_gdbarch_register_raw_size (gdbarch, mips_register_raw_size);
-  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);
-  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
   tdep->found_abi = found_abi;
   tdep->mips_abi = mips_abi;
 
@@ -5739,7 +5731,7 @@ mips_gdbarch_init (struct gdbarch_info info,
   switch (mips_abi)
     {
     case MIPS_ABI_O32:
-      set_gdbarch_deprecated_push_arguments (gdbarch, mips_o32_push_arguments);
+      set_gdbarch_push_dummy_call (gdbarch, mips_o32_push_dummy_call);
       set_gdbarch_deprecated_store_return_value (gdbarch, mips_o32_store_return_value);
       set_gdbarch_extract_return_value (gdbarch, mips_o32_extract_return_value);
       tdep->mips_default_saved_regsize = 4;
@@ -5758,7 +5750,7 @@ mips_gdbarch_init (struct gdbarch_info info,
                                         mips_o32_use_struct_convention);
       break;
     case MIPS_ABI_O64:
-      set_gdbarch_deprecated_push_arguments (gdbarch, mips_o64_push_arguments);
+      set_gdbarch_push_dummy_call (gdbarch, mips_o64_push_dummy_call);
       set_gdbarch_deprecated_store_return_value (gdbarch, mips_o64_store_return_value);
       set_gdbarch_deprecated_extract_return_value (gdbarch, mips_o64_extract_return_value);
       tdep->mips_default_saved_regsize = 8;
@@ -5777,7 +5769,7 @@ mips_gdbarch_init (struct gdbarch_info info,
                                         mips_o32_use_struct_convention);
       break;
     case MIPS_ABI_EABI32:
-      set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments);
+      set_gdbarch_push_dummy_call (gdbarch, mips_eabi_push_dummy_call);
       set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value);
       set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value);
       tdep->mips_default_saved_regsize = 4;
@@ -5796,7 +5788,7 @@ mips_gdbarch_init (struct gdbarch_info info,
                                         mips_eabi_use_struct_convention);
       break;
     case MIPS_ABI_EABI64:
-      set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments);
+      set_gdbarch_push_dummy_call (gdbarch, mips_eabi_push_dummy_call);
       set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value);
       set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value);
       tdep->mips_default_saved_regsize = 8;
@@ -5815,7 +5807,7 @@ mips_gdbarch_init (struct gdbarch_info info,
                                         mips_eabi_use_struct_convention);
       break;
     case MIPS_ABI_N32:
-      set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments);
+      set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
       set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value);
       set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value);
       tdep->mips_default_saved_regsize = 8;
@@ -5834,7 +5826,7 @@ mips_gdbarch_init (struct gdbarch_info info,
                                       mips_n32n64_reg_struct_has_addr);
       break;
     case MIPS_ABI_N64:
-      set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments);
+      set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
       set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value);
       set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value);
       tdep->mips_default_saved_regsize = 8;
@@ -5936,12 +5928,7 @@ mips_gdbarch_init (struct gdbarch_info info,
   /* MIPS version of CALL_DUMMY */
 
   set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
-  set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address);
   set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame);
-  set_gdbarch_deprecated_fix_call_dummy (gdbarch, mips_fix_call_dummy);
-  set_gdbarch_deprecated_call_dummy_words (gdbarch, mips_call_dummy_words);
-  set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
-  set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address);
   set_gdbarch_frame_align (gdbarch, mips_frame_align);
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_register_convertible (gdbarch, mips_register_convertible);
@@ -5975,15 +5962,13 @@ mips_gdbarch_init (struct gdbarch_info info,
   /* There are MIPS targets which do not yet use this since they still
      define REGISTER_VIRTUAL_TYPE.  */
   set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type);
-  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
 
-  set_gdbarch_deprecated_do_registers_info (gdbarch, mips_do_registers_info);
+  set_gdbarch_print_registers_info (gdbarch, mips_print_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);
 
-  set_gdbarch_deprecated_store_struct_return (gdbarch, mips_store_struct_return);
   set_gdbarch_extract_struct_value_address (gdbarch, 
                                            mips_extract_struct_value_address);
   
@@ -6137,8 +6122,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                      "mips_dump_tdep: BADVADDR_REGNUM = %d\n",
                      BADVADDR_REGNUM);
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: BIG_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: CAUSE_REGNUM = %d\n",
                      CAUSE_REGNUM);
@@ -6169,10 +6152,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                      "mips_dump_tdep:  HI_REGNUM = %d\n",
                      HI_REGNUM);
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: IDT_BIG_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: IDT_LITTLE_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: IGNORE_HELPER_CALL # %s\n",
                      XSTRING (IGNORE_HELPER_CALL (PC)));
@@ -6187,8 +6166,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                      "mips_dump_tdep: LAST_EMBED_REGNUM = %d\n",
                      LAST_EMBED_REGNUM);
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: LITTLE_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: LO_REGNUM = %d\n",
                      LO_REGNUM);
@@ -6209,13 +6186,9 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
 #endif
   fprintf_unfiltered (file,
                      "mips_dump_tdep: MAKE_MIPS16_ADDR = FIXME!\n");
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: MIPS16_BIG_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: MIPS16_INSTLEN = %d\n",
                      MIPS16_INSTLEN);
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: MIPS16_LITTLE_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: MIPS_DEFAULT_ABI = FIXME!\n");
   fprintf_unfiltered (file,
@@ -6239,10 +6212,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
                      "mips_dump_tdep: OP_LDFPR = used?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: OP_LDGPR = used?\n");
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: PMON_BIG_BREAKPOINT = delete?\n");
-  fprintf_unfiltered (file,
-                     "mips_dump_tdep: PMON_LITTLE_BREAKPOINT = delete?\n");
   fprintf_unfiltered (file,
                      "mips_dump_tdep: PRID_REGNUM = %d\n",
                      PRID_REGNUM);
This page took 0.037627 seconds and 4 git commands to generate.