From 0abe36f50df0f2475fec735f5c907bb7af584ab0 Mon Sep 17 00:00:00 2001 From: Markus Deuling Date: Fri, 9 Nov 2007 05:32:19 +0000 Subject: [PATCH] * gdbarch.sh (convert_register_p): Add gdbarch as parameter. * ia64-tdep.c (ia64_convert_register_p): Likewise. * i387-tdep.c (i387_convert_register_p): Likewise. * i387-tdep.h (i387_convert_register_p): Likewise. * alpha-tdep.c (alpha_convert_register_p): Likewise. * gdbarch.{c,h}: Regenerate. * rs6000-tdep.c (rs6000_convert_register_p): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. * mips-tdep.c (mips_convert_register_p): Likewise. * m68k-tdep.c (m68k_convert_register_p): Likewise. * i386-tdep.c (i386_convert_register_p): Likewise. --- gdb/ChangeLog | 15 +++++++++++++++ gdb/alpha-tdep.c | 2 +- gdb/gdbarch.c | 4 ++-- gdb/gdbarch.h | 2 +- gdb/gdbarch.sh | 2 +- gdb/i386-tdep.c | 4 ++-- gdb/i387-tdep.c | 2 +- gdb/i387-tdep.h | 3 ++- gdb/ia64-tdep.c | 2 +- gdb/m68k-tdep.c | 4 ++-- gdb/mips-tdep.c | 16 ++++++++-------- gdb/rs6000-tdep.c | 5 +++-- 12 files changed, 39 insertions(+), 22 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ebddce75edf..b61a1236f17 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2007-11-09 Markus Deuling + + * gdbarch.sh (convert_register_p): Add gdbarch as parameter. + * ia64-tdep.c (ia64_convert_register_p): Likewise. + * i387-tdep.c (i387_convert_register_p): Likewise. + * i387-tdep.h (i387_convert_register_p): Likewise. + * alpha-tdep.c (alpha_convert_register_p): Likewise. + * gdbarch.{c,h}: Regenerate. + + * rs6000-tdep.c (rs6000_convert_register_p): Add gdbarch as parameter. + Replace current_gdbarch by gdbarch. + * mips-tdep.c (mips_convert_register_p): Likewise. + * m68k-tdep.c (m68k_convert_register_p): Likewise. + * i386-tdep.c (i386_convert_register_p): Likewise. + 2007-11-08 Aleksandar Ristovski * gdb_string.h: Include . diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index a77ad25b49d..d3bc0c840ab 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -198,7 +198,7 @@ alpha_sts (void *out, const void *in) registers is different. */ static int -alpha_convert_register_p (int regno, struct type *type) +alpha_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type) { return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31 && TYPE_LENGTH (type) != 8); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index ea8c4d4a890..11e86705bf6 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -295,7 +295,7 @@ struct gdbarch startup_gdbarch = 0, /* cannot_store_register */ 0, /* get_longjmp_target */ 0, /* believe_pcc_promotion */ - 0, /* convert_register_p */ + generic_convert_register_p, /* convert_register_p */ 0, /* register_to_value */ 0, /* value_to_register */ 0, /* value_from_register */ @@ -1922,7 +1922,7 @@ gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *ty gdb_assert (gdbarch->convert_register_p != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_register_p called\n"); - return gdbarch->convert_register_p (regnum, type); + return gdbarch->convert_register_p (gdbarch, regnum, type); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 8874d3e61c6..355054ae59d 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -319,7 +319,7 @@ extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch); extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion); -typedef int (gdbarch_convert_register_p_ftype) (int regnum, struct type *type); +typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type); extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type); extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 7a0f0358b40..51c6d6b659f 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -452,7 +452,7 @@ F:int:get_longjmp_target:struct frame_info *frame, CORE_ADDR *pc:frame, pc # v:int:believe_pcc_promotion::::::: # -f:int:convert_register_p:int regnum, struct type *type:regnum, type:0:generic_convert_register_p::0 +m:int:convert_register_p:int regnum, struct type *type:regnum, type:0:generic_convert_register_p::0 f:void:register_to_value:struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf:frame, regnum, type, buf:0 f:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf:frame, regnum, type, buf:0 # Construct a value representing the contents of register REGNUM in diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index f385c20982b..710a01b5504 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1857,7 +1857,7 @@ i386_next_regnum (int regnum) needs any special handling. */ static int -i386_convert_register_p (int regnum, struct type *type) +i386_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) { int len = TYPE_LENGTH (type); @@ -1880,7 +1880,7 @@ i386_convert_register_p (int regnum, struct type *type) return 1; } - return i387_convert_register_p (regnum, type); + return i387_convert_register_p (gdbarch, regnum, type); } /* Read a value of type TYPE from register REGNUM in frame FRAME, and diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index e665989e043..a940e88b6a9 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -289,7 +289,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, needs any special handling. */ int -i387_convert_register_p (int regnum, struct type *type) +i387_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) { if (i386_fp_regnum_p (regnum)) { diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h index a94b27ae13f..3ff1c379a38 100644 --- a/gdb/i387-tdep.h +++ b/gdb/i387-tdep.h @@ -58,7 +58,8 @@ extern void i387_print_float_info (struct gdbarch *gdbarch, /* Return nonzero if a value of type TYPE stored in register REGNUM needs any special handling. */ -extern int i387_convert_register_p (int regnum, struct type *type); +extern int i387_convert_register_p (struct gdbarch *gdbarch, int regnum, + struct type *type); /* Read a value of type TYPE from register REGNUM in frame FRAME, and return its contents in TO. */ diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 47f7f549c0f..1d6743a7ae5 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -918,7 +918,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, and the special ia64 floating point register format. */ static int -ia64_convert_register_p (int regno, struct type *type) +ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type) { return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM && type != builtin_type_ia64_ext); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 98f048ef84a..39b70c59347 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -168,9 +168,9 @@ m68k_register_name (struct gdbarch *gdbarch, int regnum) needs any special handling. */ static int -m68k_convert_register_p (int regnum, struct type *type) +m68k_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) { - if (!gdbarch_tdep (current_gdbarch)->fpregs_present) + if (!gdbarch_tdep (gdbarch)->fpregs_present) return 0; return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7 && type != builtin_type_m68881_ext); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 98757c98d73..b9d65d6300f 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -660,14 +660,14 @@ set_mips64_transfers_32bit_regs (char *args, int from_tty, /* Convert to/from a register and the corresponding memory value. */ static int -mips_convert_register_p (int regnum, struct type *type) -{ - return (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG - && register_size (current_gdbarch, regnum) == 4 - && (regnum % gdbarch_num_regs (current_gdbarch)) - >= mips_regnum (current_gdbarch)->fp0 - && (regnum % gdbarch_num_regs (current_gdbarch)) - < mips_regnum (current_gdbarch)->fp0 + 32 +mips_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) +{ + 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 && TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8); } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 9cb560a169e..713dfff70d5 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2424,9 +2424,10 @@ rs6000_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, double, we need a conversion if the memory format is float. */ static int -rs6000_convert_register_p (int regnum, struct type *type) +rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum, + struct type *type) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); return (tdep->ppc_fp0_regnum >= 0 && regnum >= tdep->ppc_fp0_regnum -- 2.30.2