From dbf5d61bdad9131d31c3410f123db3e296d91dfc Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 31 Mar 2022 12:36:06 +0100 Subject: [PATCH] gdb: make gdbarch_register_reggroup_p take a const reggroup * Change gdbarch_register_reggroup_p to take a 'const struct reggroup *' argument. This requires a change to the gdb/gdbarch-components.py script, regeneration of gdbarch.{c,h}, and then updates to all the architectures that implement this method. There should be no user visible changes after this commit. --- gdb/aarch64-tdep.c | 2 +- gdb/alpha-tdep.c | 2 +- gdb/amd64-linux-tdep.c | 2 +- gdb/arm-tdep.c | 2 +- gdb/csky-tdep.c | 2 +- gdb/gdbarch-components.py | 2 +- gdb/gdbarch-gen.h | 4 ++-- gdb/gdbarch.c | 2 +- gdb/i386-linux-tdep.c | 2 +- gdb/i386-tdep.c | 2 +- gdb/i386-tdep.h | 2 +- gdb/ia64-tdep.c | 2 +- gdb/lm32-tdep.c | 2 +- gdb/m32c-tdep.c | 2 +- gdb/m68hc11-tdep.c | 2 +- gdb/mep-tdep.c | 2 +- gdb/mips-tdep.c | 4 ++-- gdb/msp430-tdep.c | 2 +- gdb/nds32-tdep.c | 2 +- gdb/reggroups.c | 2 +- gdb/reggroups.h | 2 +- gdb/riscv-tdep.c | 2 +- gdb/rl78-tdep.c | 2 +- gdb/rs6000-tdep.c | 2 +- gdb/s390-tdep.c | 2 +- gdb/sh-tdep.c | 2 +- gdb/target-descriptions.c | 4 ++-- gdb/target-descriptions.h | 2 +- gdb/xtensa-tdep.c | 4 ++-- 29 files changed, 33 insertions(+), 33 deletions(-) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index fb1434c97a3..cdeeece83c0 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2695,7 +2695,7 @@ aarch64_pseudo_register_type (struct gdbarch *gdbarch, int regnum) static int aarch64_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch); diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 7f3af216675..f04bad6bed8 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -139,7 +139,7 @@ alpha_register_type (struct gdbarch *gdbarch, int regno) static int alpha_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { /* Filter out any registers eliminated, but whose regnum is reserved for backward compatibility, e.g. the vfp. */ diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 88a24c176e8..0e5194fbeee 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -279,7 +279,7 @@ static int amd64_linux_sc_reg_offset[] = static int amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM || regnum == AMD64_FSBASE_REGNUM diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 3e91dd707b0..fbc0a38bff3 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9105,7 +9105,7 @@ arm_elf_osabi_sniffer (bfd *abfd) static int arm_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { /* FPS register's type is INT, but belongs to float_reggroup. Beside this, FPS register belongs to save_regroup, restore_reggroup, and diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index 09e8fc57246..f1376730c87 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -2063,7 +2063,7 @@ csky_add_reggroups (struct gdbarch *gdbarch) static int csky_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup) + const struct reggroup *reggroup) { int raw_p; diff --git a/gdb/gdbarch-components.py b/gdb/gdbarch-components.py index c820ddae764..e8f20c83ff0 100644 --- a/gdb/gdbarch-components.py +++ b/gdb/gdbarch-components.py @@ -1460,7 +1460,7 @@ Is a register in a group """, type="int", name="register_reggroup_p", - params=[("int", "regnum"), ("struct reggroup *", "reggroup")], + params=[("int", "regnum"), ("const struct reggroup *", "reggroup")], predefault="default_register_reggroup_p", invalid=False, ) diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 7a8721328ab..882b9057b1a 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -833,8 +833,8 @@ extern void set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarc /* Is a register in a group */ -typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); -extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); +typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup); +extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup); extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p); /* Fetch the pointer to the ith function argument. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index ff404f47727..a588bdef61a 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -3632,7 +3632,7 @@ set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, } int -gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup) +gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->register_reggroup_p != NULL); diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 1f1aaa7d60a..5d7f54194af 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -54,7 +54,7 @@ group. Put the LINUX_ORIG_EAX register in the system group. */ static int i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { if (regnum == I386_LINUX_ORIG_EAX_REGNUM) return (group == system_reggroup diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 870cacaf0d3..400ccd6bebf 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -4557,7 +4557,7 @@ i386_add_reggroups (struct gdbarch *gdbarch) int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { const i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch); int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p, diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index eb58dd68e73..a8067cf6b6c 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -418,7 +418,7 @@ extern int i386_sigtramp_p (struct frame_info *this_frame); /* Return non-zero if REGNUM is a member of the specified group. */ extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group); + const struct reggroup *group); /* Supply register REGNUM from the general-purpose register set REGSET to register cache REGCACHE. If REGNUM is -1, do this for all diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index c2d1a475bab..69a4b4db4fd 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -322,7 +322,7 @@ ia64_ext_type (struct gdbarch *gdbarch) static int ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { int vector_p; int float_p; diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index cb516e846f4..f3f1f87d6bb 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -73,7 +73,7 @@ lm32_add_reggroups (struct gdbarch *gdbarch) static int lm32_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { if (group == general_reggroup) return ((regnum >= SIM_LM32_R0_REGNUM) && (regnum <= SIM_LM32_RA_REGNUM)) diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 5e4844bda0a..94087302892 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -252,7 +252,7 @@ m32c_debug_info_reg_to_regnum (struct gdbarch *gdbarch, int reg_nr) static int m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { m32c_gdbarch_tdep *tdep = (m32c_gdbarch_tdep *) gdbarch_tdep (gdbarch); struct m32c_reg *reg = &tdep->regs[regnum]; diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 070eeb8b3da..f1133fe6780 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1372,7 +1372,7 @@ m68hc11_add_reggroups (struct gdbarch *gdbarch) static int m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { /* We must save the real hard register as well as gcc soft registers including the frame pointer. */ diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index d16c68e6fb6..8f2f0a3b30d 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1028,7 +1028,7 @@ static struct reggroup *mep_ccr_reggroup; /* coprocessor control */ static int mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { /* Filter reserved or unused register numbers. */ { diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 4bdbf0fcdb7..9157e9fa143 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -698,7 +698,7 @@ mips_register_name (struct gdbarch *gdbarch, int regno) static int mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup) + const struct reggroup *reggroup) { int vector_p; int float_p; @@ -738,7 +738,7 @@ mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum, static int mips_tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup) + const struct reggroup *reggroup) { int rawnum = regnum % gdbarch_num_regs (gdbarch); int pseudo = regnum / gdbarch_num_regs (gdbarch); diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index 86277e0b186..28268a95139 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -203,7 +203,7 @@ msp430_register_name (struct gdbarch *gdbarch, int regnr) static int msp430_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { if (group == all_reggroup) return 1; diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index f8548561853..425d7d90d64 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -368,7 +368,7 @@ nds32_add_reggroups (struct gdbarch *gdbarch) static int nds32_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup) + const struct reggroup *reggroup) { const char *reg_name; const char *group_name; diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 169285b7475..d5a263f8109 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -190,7 +190,7 @@ reggroup_prev (struct gdbarch *gdbarch, const struct reggroup *curr) /* Is REGNUM a member of REGGROUP? */ int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { int vector_p; int float_p; diff --git a/gdb/reggroups.h b/gdb/reggroups.h index ef99483f39f..df8e871e365 100644 --- a/gdb/reggroups.h +++ b/gdb/reggroups.h @@ -66,6 +66,6 @@ extern reggroup *reggroup_find (struct gdbarch *gdbarch, const char *name); /* Is REGNUM a member of REGGROUP? */ extern int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup); + const struct reggroup *reggroup); #endif diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 2752937f601..8713652b099 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -1271,7 +1271,7 @@ riscv_is_unknown_csr (struct gdbarch *gdbarch, int regnum) static int riscv_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup) + const struct reggroup *reggroup) { /* Used by 'info registers' and 'info registers '. */ diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index df04939acb1..6ea0473081d 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -586,7 +586,7 @@ rl78_g10_register_name (struct gdbarch *gdbarch, int regnr) static int rl78_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { if (group == all_reggroup) return 1; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 5bf43644a8e..44828bcff6d 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2642,7 +2642,7 @@ rs6000_pseudo_register_type (struct gdbarch *gdbarch, int regnum) static int rs6000_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index e54348be04a..14b03a167d7 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1440,7 +1440,7 @@ s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, static int s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { s390_gdbarch_tdep *tdep = (s390_gdbarch_tdep *) gdbarch_tdep (gdbarch); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index c12d40b604c..2341a9beef6 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1490,7 +1490,7 @@ sh_default_register_type (struct gdbarch *gdbarch, int reg_nr) TODO: sh2a and dsp registers. */ static int sh_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *reggroup) + const struct reggroup *reggroup) { if (gdbarch_register_name (gdbarch, regnum) == NULL || *gdbarch_register_name (gdbarch, regnum) == '\0') diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index ae3b8211167..33277c3d02d 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -1007,7 +1007,7 @@ tdesc_remote_register_number (struct gdbarch *gdbarch, int regno) int tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, - struct reggroup *reggroup) + const struct reggroup *reggroup) { struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno); @@ -1028,7 +1028,7 @@ tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, static int tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno, - struct reggroup *reggroup) + const struct reggroup *reggroup) { int num_regs = gdbarch_num_regs (gdbarch); int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch); diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h index 9d959977062..3b90dedcd80 100644 --- a/gdb/target-descriptions.h +++ b/gdb/target-descriptions.h @@ -229,7 +229,7 @@ struct type *tdesc_find_type (struct gdbarch *gdbarch, const char *id); specify a group. */ int tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, - struct reggroup *reggroup); + const struct reggroup *reggroup); /* Methods for constructing a target description. */ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 203d2e883df..62be13643b2 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -755,7 +755,7 @@ xtensa_add_reggroups (struct gdbarch *gdbarch) } static int -xtensa_coprocessor_register_group (struct reggroup *group) +xtensa_coprocessor_register_group (const struct reggroup *group) { int i; @@ -776,7 +776,7 @@ xtensa_coprocessor_register_group (struct reggroup *group) static int xtensa_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) + const struct reggroup *group) { xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch); xtensa_register_t* reg = &tdep->regmap[regnum]; -- 2.30.2