diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2012-04-20 23:31:39 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@linux-mips.org> | 2012-04-20 23:31:39 +0000 |
commit | 004159a2dc81629eb8f4ed7c4e7197df6a6960e8 (patch) | |
tree | 005f5898484f579956e8d9d80413cb5cc6ae5c36 /gdb | |
parent | 7f0e6aaed2df0d5d8a16ad4eda2c9f47abfaf76e (diff) | |
download | gdb-004159a2dc81629eb8f4ed7c4e7197df6a6960e8.zip gdb-004159a2dc81629eb8f4ed7c4e7197df6a6960e8.tar.gz gdb-004159a2dc81629eb8f4ed7c4e7197df6a6960e8.tar.bz2 |
* mips-tdep.c (mips_float_register_p): New function.
(mips_convert_register_float_case_p): Use mips_float_register_p.
(mips_register_type): Likewise.
(mips_print_register): Likewise.
(print_gp_register_row): Likewise.
(mips_print_registers_info): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 32 |
2 files changed, 28 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f7afb07..b5e94db 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2012-04-20 Nigel Stephens <nigel@mips.com> + Maciej W. Rozycki <macro@codesourcery.com> + + * mips-tdep.c (mips_float_register_p): New function. + (mips_convert_register_float_case_p): Use mips_float_register_p. + (mips_register_type): Likewise. + (mips_print_register): Likewise. + (print_gp_register_row): Likewise. + (mips_print_registers_info): Likewise. + 2012-04-20 Shun-Yen Lu <dark.asparagus@gmail.com> * mips-tdep.c (mips_elf_make_msymbol_special): Fix identification diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index fa10abe..bd344b5 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -179,6 +179,18 @@ mips_fpa0_regnum (struct gdbarch *gdbarch) return mips_regnum (gdbarch)->fp0 + 12; } +/* Return 1 if REGNUM refers to a floating-point general register, raw + or cooked. Otherwise return 0. */ + +static int +mips_float_register_p (struct gdbarch *gdbarch, int regnum) +{ + int rawnum = regnum % gdbarch_num_regs (gdbarch); + + return (rawnum >= mips_regnum (gdbarch)->fp0 + && rawnum < mips_regnum (gdbarch)->fp0 + 32); +} + #define MIPS_EABI(gdbarch) (gdbarch_tdep (gdbarch)->mips_abi \ == MIPS_ABI_EABI32 \ || gdbarch_tdep (gdbarch)->mips_abi == MIPS_ABI_EABI64) @@ -717,10 +729,7 @@ mips_convert_register_float_case_p (struct gdbarch *gdbarch, int regnum, { return (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG && register_size (gdbarch, regnum) == 4 - && (regnum % gdbarch_num_regs (gdbarch)) - >= mips_regnum (gdbarch)->fp0 - && (regnum % gdbarch_num_regs (gdbarch)) - < mips_regnum (gdbarch)->fp0 + 32 + && mips_float_register_p (gdbarch, regnum) && TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8); } @@ -843,9 +852,7 @@ static struct type * mips_register_type (struct gdbarch *gdbarch, int regnum) { gdb_assert (regnum >= 0 && regnum < 2 * gdbarch_num_regs (gdbarch)); - if ((regnum % gdbarch_num_regs (gdbarch)) >= mips_regnum (gdbarch)->fp0 - && (regnum % gdbarch_num_regs (gdbarch)) - < mips_regnum (gdbarch)->fp0 + 32) + if (mips_float_register_p (gdbarch, regnum)) { /* The floating-point registers raw, or cooked, always match mips_isa_regsize(), and also map 1:1, byte for byte. */ @@ -4761,7 +4768,7 @@ mips_print_register (struct ui_file *file, struct frame_info *frame, struct value_print_options opts; struct value *val; - if (TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT) + if (mips_float_register_p (gdbarch, regnum)) { mips_print_fp_register (file, frame, regnum); return; @@ -4830,8 +4837,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, { if (*gdbarch_register_name (gdbarch, regnum) == '\0') continue; /* unused register */ - if (TYPE_CODE (register_type (gdbarch, regnum)) == - TYPE_CODE_FLT) + if (mips_float_register_p (gdbarch, regnum)) break; /* End the row: reached FP register. */ /* Large registers are handled separately. */ if (register_size (gdbarch, regnum) > mips_abi_regsize (gdbarch)) @@ -4870,8 +4876,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, { if (*gdbarch_register_name (gdbarch, regnum) == '\0') continue; /* unused register */ - if (TYPE_CODE (register_type (gdbarch, regnum)) == - TYPE_CODE_FLT) + if (mips_float_register_p (gdbarch, regnum)) break; /* End row: reached FP register. */ if (register_size (gdbarch, regnum) > mips_abi_regsize (gdbarch)) break; /* End row: large register. */ @@ -4926,8 +4931,7 @@ mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, while (regnum < gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch)) { - if (TYPE_CODE (register_type (gdbarch, regnum)) == - TYPE_CODE_FLT) + if (mips_float_register_p (gdbarch, regnum)) { if (all) /* True for "INFO ALL-REGISTERS" command. */ regnum = print_fp_register_row (file, frame, regnum); |