]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/mips-tdep.c
gdb: pass frames as `const frame_info_ptr &`
[thirdparty/binutils-gdb.git] / gdb / mips-tdep.c
index bf0b66c4b0024bfa21cb99dcd1d5ef7c01dc449a..8339d2f1d4c6bbfeaaec595b391824b9f95ac189 100644 (file)
@@ -74,7 +74,7 @@ static int mips16_insn_at_pc_has_delay_slot (struct gdbarch *gdbarch,
                                             CORE_ADDR addr, int mustbe32);
 
 static void mips_print_float_info (struct gdbarch *, struct ui_file *,
-                                  frame_info_ptr, const char *);
+                                  const frame_info_ptr &, const char *);
 
 /* A useful bit in the CP0 status register (MIPS_PS_REGNUM).  */
 /* This bit is set if we are emulating 32-bit FPRs on a 64-bit chip.  */
@@ -562,7 +562,7 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
    physical 64-bit registers, but should treat them as 32-bit registers.  */
 
 static int
-mips2_fp_compat (frame_info_ptr frame)
+mips2_fp_compat (const frame_info_ptr &frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   /* MIPS1 and MIPS2 have only 32 bit FPRs, and the FR bit is not
@@ -942,7 +942,7 @@ mips_convert_register_p (struct gdbarch *gdbarch,
 }
 
 static int
-mips_register_to_value (frame_info_ptr frame, int regnum,
+mips_register_to_value (const frame_info_ptr &frame, int regnum,
                        struct type *type, gdb_byte *to,
                        int *optimizedp, int *unavailablep)
 {
@@ -984,7 +984,7 @@ mips_register_to_value (frame_info_ptr frame, int regnum,
 }
 
 static void
-mips_value_to_register (frame_info_ptr frame, int regnum,
+mips_value_to_register (const frame_info_ptr &frame, int regnum,
                        struct type *type, const gdb_byte *from)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1409,7 +1409,7 @@ mips_read_pc (readable_regcache *regcache)
 }
 
 static CORE_ADDR
-mips_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
+mips_unwind_pc (struct gdbarch *gdbarch, const frame_info_ptr &next_frame)
 {
   CORE_ADDR pc;
 
@@ -1431,7 +1431,7 @@ mips_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
 }
 
 static CORE_ADDR
-mips_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
+mips_unwind_sp (struct gdbarch *gdbarch, const frame_info_ptr &next_frame)
 {
   return frame_unwind_register_signed
           (next_frame, gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM);
@@ -1443,7 +1443,7 @@ mips_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
    breakpoint.  */
 
 static struct frame_id
-mips_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
+mips_dummy_id (struct gdbarch *gdbarch, const frame_info_ptr &this_frame)
 {
   return frame_id_build
           (get_frame_register_signed (this_frame,
@@ -2526,7 +2526,7 @@ mips16_get_imm (unsigned short prev_inst, /* previous instruction */
 static CORE_ADDR
 mips16_scan_prologue (struct gdbarch *gdbarch,
                      CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                     frame_info_ptr this_frame,
+                     const frame_info_ptr &this_frame,
                      struct mips_frame_cache *this_cache)
 {
   int prev_non_prologue_insn = 0;
@@ -2862,7 +2862,7 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
    mips_insn32 unwinder.  */
 
 static struct mips_frame_cache *
-mips_insn16_frame_cache (frame_info_ptr this_frame, void **this_cache)
+mips_insn16_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct mips_frame_cache *cache;
@@ -2898,7 +2898,7 @@ mips_insn16_frame_cache (frame_info_ptr this_frame, void **this_cache)
 }
 
 static void
-mips_insn16_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+mips_insn16_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
                           struct frame_id *this_id)
 {
   struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
@@ -2910,7 +2910,7 @@ mips_insn16_frame_this_id (frame_info_ptr this_frame, void **this_cache,
 }
 
 static struct value *
-mips_insn16_frame_prev_register (frame_info_ptr this_frame,
+mips_insn16_frame_prev_register (const frame_info_ptr &this_frame,
                                 void **this_cache, int regnum)
 {
   struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
@@ -2920,7 +2920,7 @@ mips_insn16_frame_prev_register (frame_info_ptr this_frame,
 
 static int
 mips_insn16_frame_sniffer (const struct frame_unwind *self,
-                          frame_info_ptr this_frame, void **this_cache)
+                          const frame_info_ptr &this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR pc = get_frame_pc (this_frame);
@@ -2941,7 +2941,7 @@ static const struct frame_unwind mips_insn16_frame_unwind =
 };
 
 static CORE_ADDR
-mips_insn16_frame_base_address (frame_info_ptr this_frame,
+mips_insn16_frame_base_address (const frame_info_ptr &this_frame,
                                void **this_cache)
 {
   struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
@@ -2958,7 +2958,7 @@ static const struct frame_base mips_insn16_frame_base =
 };
 
 static const struct frame_base *
-mips_insn16_frame_base_sniffer (frame_info_ptr this_frame)
+mips_insn16_frame_base_sniffer (const frame_info_ptr &this_frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR pc = get_frame_pc (this_frame);
@@ -2987,7 +2987,7 @@ micromips_decode_imm9 (int imm)
 static CORE_ADDR
 micromips_scan_prologue (struct gdbarch *gdbarch,
                         CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                        frame_info_ptr this_frame,
+                        const frame_info_ptr &this_frame,
                         struct mips_frame_cache *this_cache)
 {
   CORE_ADDR end_prologue_addr;
@@ -3296,7 +3296,7 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
    mips_insn32 unwinder.  Likewise MIPS16 and the mips_insn16 unwinder. */
 
 static struct mips_frame_cache *
-mips_micro_frame_cache (frame_info_ptr this_frame, void **this_cache)
+mips_micro_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct mips_frame_cache *cache;
@@ -3333,7 +3333,7 @@ mips_micro_frame_cache (frame_info_ptr this_frame, void **this_cache)
 }
 
 static void
-mips_micro_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+mips_micro_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
                          struct frame_id *this_id)
 {
   struct mips_frame_cache *info = mips_micro_frame_cache (this_frame,
@@ -3345,7 +3345,7 @@ mips_micro_frame_this_id (frame_info_ptr this_frame, void **this_cache,
 }
 
 static struct value *
-mips_micro_frame_prev_register (frame_info_ptr this_frame,
+mips_micro_frame_prev_register (const frame_info_ptr &this_frame,
                                void **this_cache, int regnum)
 {
   struct mips_frame_cache *info = mips_micro_frame_cache (this_frame,
@@ -3355,7 +3355,7 @@ mips_micro_frame_prev_register (frame_info_ptr this_frame,
 
 static int
 mips_micro_frame_sniffer (const struct frame_unwind *self,
-                         frame_info_ptr this_frame, void **this_cache)
+                         const frame_info_ptr &this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR pc = get_frame_pc (this_frame);
@@ -3377,7 +3377,7 @@ static const struct frame_unwind mips_micro_frame_unwind =
 };
 
 static CORE_ADDR
-mips_micro_frame_base_address (frame_info_ptr this_frame,
+mips_micro_frame_base_address (const frame_info_ptr &this_frame,
                               void **this_cache)
 {
   struct mips_frame_cache *info = mips_micro_frame_cache (this_frame,
@@ -3394,7 +3394,7 @@ static const struct frame_base mips_micro_frame_base =
 };
 
 static const struct frame_base *
-mips_micro_frame_base_sniffer (frame_info_ptr this_frame)
+mips_micro_frame_base_sniffer (const frame_info_ptr &this_frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR pc = get_frame_pc (this_frame);
@@ -3432,7 +3432,7 @@ reset_saved_regs (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache)
 static CORE_ADDR
 mips32_scan_prologue (struct gdbarch *gdbarch,
                      CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                     frame_info_ptr this_frame,
+                     const frame_info_ptr &this_frame,
                      struct mips_frame_cache *this_cache)
 {
   int prev_non_prologue_insn;
@@ -3677,7 +3677,7 @@ restart:
    unwinder.  Likewise microMIPS and the mips_micro unwinder. */
 
 static struct mips_frame_cache *
-mips_insn32_frame_cache (frame_info_ptr this_frame, void **this_cache)
+mips_insn32_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
   struct mips_frame_cache *cache;
@@ -3714,7 +3714,7 @@ mips_insn32_frame_cache (frame_info_ptr this_frame, void **this_cache)
 }
 
 static void
-mips_insn32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+mips_insn32_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
                           struct frame_id *this_id)
 {
   struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
@@ -3726,7 +3726,7 @@ mips_insn32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
 }
 
 static struct value *
-mips_insn32_frame_prev_register (frame_info_ptr this_frame,
+mips_insn32_frame_prev_register (const frame_info_ptr &this_frame,
                                 void **this_cache, int regnum)
 {
   struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
@@ -3736,7 +3736,7 @@ mips_insn32_frame_prev_register (frame_info_ptr this_frame,
 
 static int
 mips_insn32_frame_sniffer (const struct frame_unwind *self,
-                          frame_info_ptr this_frame, void **this_cache)
+                          const frame_info_ptr &this_frame, void **this_cache)
 {
   CORE_ADDR pc = get_frame_pc (this_frame);
   if (mips_pc_is_mips (pc))
@@ -3756,7 +3756,7 @@ static const struct frame_unwind mips_insn32_frame_unwind =
 };
 
 static CORE_ADDR
-mips_insn32_frame_base_address (frame_info_ptr this_frame,
+mips_insn32_frame_base_address (const frame_info_ptr &this_frame,
                                void **this_cache)
 {
   struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
@@ -3773,7 +3773,7 @@ static const struct frame_base mips_insn32_frame_base =
 };
 
 static const struct frame_base *
-mips_insn32_frame_base_sniffer (frame_info_ptr this_frame)
+mips_insn32_frame_base_sniffer (const frame_info_ptr &this_frame)
 {
   CORE_ADDR pc = get_frame_pc (this_frame);
   if (mips_pc_is_mips (pc))
@@ -3783,7 +3783,7 @@ mips_insn32_frame_base_sniffer (frame_info_ptr this_frame)
 }
 
 static struct trad_frame_cache *
-mips_stub_frame_cache (frame_info_ptr this_frame, void **this_cache)
+mips_stub_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
 {
   CORE_ADDR pc;
   CORE_ADDR start_addr;
@@ -3818,7 +3818,7 @@ mips_stub_frame_cache (frame_info_ptr this_frame, void **this_cache)
 }
 
 static void
-mips_stub_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+mips_stub_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
                         struct frame_id *this_id)
 {
   struct trad_frame_cache *this_trad_cache
@@ -3827,7 +3827,7 @@ mips_stub_frame_this_id (frame_info_ptr this_frame, void **this_cache,
 }
 
 static struct value *
-mips_stub_frame_prev_register (frame_info_ptr this_frame,
+mips_stub_frame_prev_register (const frame_info_ptr &this_frame,
                               void **this_cache, int regnum)
 {
   struct trad_frame_cache *this_trad_cache
@@ -3837,7 +3837,7 @@ mips_stub_frame_prev_register (frame_info_ptr this_frame,
 
 static int
 mips_stub_frame_sniffer (const struct frame_unwind *self,
-                        frame_info_ptr this_frame, void **this_cache)
+                        const frame_info_ptr &this_frame, void **this_cache)
 {
   gdb_byte dummy[4];
   CORE_ADDR pc = get_frame_address_in_block (this_frame);
@@ -3873,7 +3873,7 @@ static const struct frame_unwind mips_stub_frame_unwind =
 };
 
 static CORE_ADDR
-mips_stub_frame_base_address (frame_info_ptr this_frame,
+mips_stub_frame_base_address (const frame_info_ptr &this_frame,
                              void **this_cache)
 {
   struct trad_frame_cache *this_trad_cache
@@ -3890,7 +3890,7 @@ static const struct frame_base mips_stub_frame_base =
 };
 
 static const struct frame_base *
-mips_stub_frame_base_sniffer (frame_info_ptr this_frame)
+mips_stub_frame_base_sniffer (const frame_info_ptr &this_frame)
 {
   if (mips_stub_frame_sniffer (&mips_stub_frame_unwind, this_frame, NULL))
     return &mips_stub_frame_base;
@@ -6256,7 +6256,7 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
    into rare_buffer.  */
 
 static void
-mips_read_fp_register_single (frame_info_ptr frame, int regno,
+mips_read_fp_register_single (const frame_info_ptr &frame, int regno,
                              gdb_byte *rare_buffer)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -6290,7 +6290,7 @@ mips_read_fp_register_single (frame_info_ptr frame, int regno,
    register.  */
 
 static void
-mips_read_fp_register_double (frame_info_ptr frame, int regno,
+mips_read_fp_register_double (const frame_info_ptr &frame, int regno,
                              gdb_byte *rare_buffer)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -6328,7 +6328,7 @@ mips_read_fp_register_double (frame_info_ptr frame, int regno,
 }
 
 static void
-mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
+mips_print_fp_register (struct ui_file *file, const frame_info_ptr &frame,
                        int regnum)
 {                              /* Do values for FP (float) regs.  */
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -6393,7 +6393,7 @@ mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
 }
 
 static void
-mips_print_register (struct ui_file *file, frame_info_ptr frame,
+mips_print_register (struct ui_file *file, const frame_info_ptr &frame,
                     int regnum)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -6448,7 +6448,7 @@ print_fpu_flags (struct ui_file *file, int flags)
 
 static void
 mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
-                     frame_info_ptr frame, const char *args)
+                     const frame_info_ptr &frame, const char *args)
 {
   int fcsr = mips_regnum (gdbarch)->fp_control_status;
   enum mips_fpu_type type = mips_get_fpu_type (gdbarch);
@@ -6515,7 +6515,7 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
    Print regs in pretty columns.  */
 
 static int
-print_fp_register_row (struct ui_file *file, frame_info_ptr frame,
+print_fp_register_row (struct ui_file *file, const frame_info_ptr &frame,
                       int regnum)
 {
   gdb_printf (file, " ");
@@ -6528,7 +6528,7 @@ print_fp_register_row (struct ui_file *file, frame_info_ptr frame,
 /* Print a row's worth of GP (int) registers, with name labels above.  */
 
 static int
-print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
+print_gp_register_row (struct ui_file *file, const frame_info_ptr &frame,
                       int start_regnum)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -6631,7 +6631,7 @@ print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
 
 static void
 mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
-                          frame_info_ptr frame, int regnum, int all)
+                          const frame_info_ptr &frame, int regnum, int all)
 {
   if (regnum != -1)            /* Do one specified register.  */
     {
@@ -6663,7 +6663,7 @@ mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
 
 static int
 mips_single_step_through_delay (struct gdbarch *gdbarch,
-                               frame_info_ptr frame)
+                               const frame_info_ptr &frame)
 {
   CORE_ADDR pc = get_frame_pc (frame);
   enum mips_isa isa;
@@ -7569,7 +7569,7 @@ mips_is_stub_mode (const char *mode)
    The limit on the search is arbitrarily set to 20 instructions.  FIXME.  */
 
 static CORE_ADDR
-mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
+mips_get_mips16_fn_stub_pc (const frame_info_ptr &frame, CORE_ADDR pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -7692,7 +7692,7 @@ mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
    gory details.  */
 
 static CORE_ADDR
-mips_skip_mips16_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
+mips_skip_mips16_trampoline_code (const frame_info_ptr &frame, CORE_ADDR pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   CORE_ADDR start_addr;
@@ -7820,7 +7820,7 @@ mips_in_return_stub (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
    so that $t9 has the correct value at function entry.  */
 
 static CORE_ADDR
-mips_skip_pic_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
+mips_skip_pic_trampoline_code (const frame_info_ptr &frame, CORE_ADDR pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -7873,7 +7873,7 @@ mips_skip_pic_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
 }
 
 static CORE_ADDR
-mips_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
+mips_skip_trampoline_code (const frame_info_ptr &frame, CORE_ADDR pc)
 {
   CORE_ADDR requested_pc = pc;
   CORE_ADDR target_pc;
@@ -8074,7 +8074,7 @@ mips_register_g_packet_guesses (struct gdbarch *gdbarch)
 }
 
 static struct value *
-value_of_mips_user_reg (frame_info_ptr frame, const void *baton)
+value_of_mips_user_reg (const frame_info_ptr &frame, const void *baton)
 {
   const int *reg_p = (const int *) baton;
   return value_of_register (*reg_p, get_next_frame_sentinel_okay (frame));