Remove regcache_register_status

Remove regcache_register_status, change callers to use
reg_buffer::get_register_status directly.

gdb/ChangeLog:

	* regcache.h (regcache_register_status): Remove, update callers
	to use reg_buffer::get_register_status directly instead.
	* regcache.c (regcache_register_status): Remove.
This commit is contained in:
Simon Marchi 2018-05-30 14:54:35 -04:00
parent 222312d359
commit 0ec9f11447
12 changed files with 58 additions and 72 deletions

View File

@ -1,3 +1,9 @@
2018-05-30 Simon Marchi <simon.marchi@ericsson.com>
* regcache.h (regcache_register_status): Remove, update callers
to use reg_buffer::get_register_status directly instead.
* regcache.c (regcache_register_status): Remove.
2018-05-30 Simon Marchi <simon.marchi@ericsson.com> 2018-05-30 Simon Marchi <simon.marchi@ericsson.com>
* regcache.h (regcache_get_ptid): Remove, update all callers to * regcache.h (regcache_get_ptid): Remove, update all callers to

View File

@ -61,12 +61,12 @@ aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs,
for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++) for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
{ {
if (REG_VALID == regcache_register_status (regcache, regno)) if (REG_VALID == regcache->get_register_status (regno))
regcache_raw_collect (regcache, regno, &regs[regno]); regcache_raw_collect (regcache, regno, &regs[regno]);
} }
if (arm_apcs_32 if (arm_apcs_32
&& REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM)) && REG_VALID == regcache->get_register_status (ARM_PS_REGNUM))
{ {
uint32_t cpsr = regs[ARM_CPSR_GREGNUM]; uint32_t cpsr = regs[ARM_CPSR_GREGNUM];

View File

@ -264,7 +264,7 @@ store_gregs_to_thread (const struct regcache *regcache)
int regno; int regno;
for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_CPSR_REGNUM; regno++) for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_CPSR_REGNUM; regno++)
if (REG_VALID == regcache_register_status (regcache, regno)) if (REG_VALID == regcache->get_register_status (regno))
regcache_raw_collect (regcache, regno, regcache_raw_collect (regcache, regno,
&regs[regno - AARCH64_X0_REGNUM]); &regs[regno - AARCH64_X0_REGNUM]);
} }
@ -361,14 +361,14 @@ store_fpregs_to_thread (const struct regcache *regcache)
perror_with_name (_("Unable to fetch FP/SIMD registers.")); perror_with_name (_("Unable to fetch FP/SIMD registers."));
for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++) for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
if (REG_VALID == regcache_register_status (regcache, regno)) if (REG_VALID == regcache->get_register_status (regno))
regcache_raw_collect (regcache, regno, regcache_raw_collect (regcache, regno,
(char *) &regs.vregs[regno - AARCH64_V0_REGNUM]); (char *) &regs.vregs[regno - AARCH64_V0_REGNUM]);
if (REG_VALID == regcache_register_status (regcache, AARCH64_FPSR_REGNUM)) if (REG_VALID == regcache->get_register_status (AARCH64_FPSR_REGNUM))
regcache_raw_collect (regcache, AARCH64_FPSR_REGNUM, regcache_raw_collect (regcache, AARCH64_FPSR_REGNUM,
(char *) &regs.fpsr); (char *) &regs.fpsr);
if (REG_VALID == regcache_register_status (regcache, AARCH64_FPCR_REGNUM)) if (REG_VALID == regcache->get_register_status (AARCH64_FPCR_REGNUM))
regcache_raw_collect (regcache, AARCH64_FPCR_REGNUM, regcache_raw_collect (regcache, AARCH64_FPCR_REGNUM,
(char *) &regs.fpcr); (char *) &regs.fpcr);
} }

View File

@ -1389,8 +1389,8 @@ fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
int regno; int regno;
for (regno = 0; regno < ppc_num_gprs; regno++) for (regno = 0; regno < ppc_num_gprs; regno++)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status
tdep->ppc_gp0_regnum + regno)) (tdep->ppc_gp0_regnum + regno))
regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno, regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno,
vals + regno); vals + regno);
} }
@ -1402,8 +1402,8 @@ fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
int regno; int regno;
for (regno = 0; regno < ppc_num_gprs; regno++) for (regno = 0; regno < ppc_num_gprs; regno++)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status
tdep->ppc_gp0_regnum + regno)) (tdep->ppc_gp0_regnum + regno))
regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno, regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno,
vals + regno); vals + regno);
} }
@ -1423,7 +1423,7 @@ fill_fprs (const struct regcache *regcache, double *vals)
for (regno = tdep->ppc_fp0_regnum; for (regno = tdep->ppc_fp0_regnum;
regno < tdep->ppc_fp0_regnum + ppc_num_fprs; regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
regno++) regno++)
if (REG_VALID == regcache_register_status (regcache, regno)) if (REG_VALID == regcache->get_register_status (regno))
regcache_raw_collect (regcache, regno, regcache_raw_collect (regcache, regno,
vals + regno - tdep->ppc_fp0_regnum); vals + regno - tdep->ppc_fp0_regnum);
} }
@ -1448,22 +1448,20 @@ fill_sprs64 (const struct regcache *regcache,
gdb_assert (sizeof (*iar) == register_size gdb_assert (sizeof (*iar) == register_size
(gdbarch, gdbarch_pc_regnum (gdbarch))); (gdbarch, gdbarch_pc_regnum (gdbarch)));
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (gdbarch_pc_regnum (gdbarch)))
gdbarch_pc_regnum (gdbarch)))
regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar); regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_ps_regnum))
regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr); regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_cr_regnum))
regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr); regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_lr_regnum))
regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr); regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ctr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_ctr_regnum))
regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr); regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_xer_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum))
regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer); regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer);
if (tdep->ppc_fpscr_regnum >= 0 if (tdep->ppc_fpscr_regnum >= 0
&& REG_VALID == regcache_register_status (regcache, && REG_VALID == regcache->get_register_status (tdep->ppc_fpscr_regnum))
tdep->ppc_fpscr_regnum))
regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr); regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr);
} }
@ -1484,21 +1482,20 @@ fill_sprs32 (const struct regcache *regcache,
gdb_assert (sizeof (*iar) == register_size (gdbarch, gdb_assert (sizeof (*iar) == register_size (gdbarch,
gdbarch_pc_regnum (gdbarch))); gdbarch_pc_regnum (gdbarch)));
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (gdbarch_pc_regnum (gdbarch)))
gdbarch_pc_regnum (gdbarch)))
regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar); regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_ps_regnum))
regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr); regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_cr_regnum))
regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr); regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_lr_regnum))
regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr); regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ctr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_ctr_regnum))
regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr); regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr);
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_xer_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum))
regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer); regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer);
if (tdep->ppc_fpscr_regnum >= 0 if (tdep->ppc_fpscr_regnum >= 0
&& REG_VALID == regcache_register_status (regcache, tdep->ppc_fpscr_regnum)) && REG_VALID == regcache->get_register_status (tdep->ppc_fpscr_regnum))
regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr); regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr);
} }
@ -1533,8 +1530,7 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
/* Collect general-purpose register values from the regcache. */ /* Collect general-purpose register values from the regcache. */
for (i = 0; i < ppc_num_gprs; i++) for (i = 0; i < ppc_num_gprs; i++)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (tdep->ppc_gp0_regnum + i))
tdep->ppc_gp0_regnum + i))
{ {
if (arch64) if (arch64)
{ {
@ -1569,23 +1565,20 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr,
&tmp_xer, &tmp_fpscr); &tmp_xer, &tmp_fpscr);
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status
gdbarch_pc_regnum (gdbarch))) (gdbarch_pc_regnum (gdbarch)))
ctx.iar = tmp_iar; ctx.iar = tmp_iar;
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_ps_regnum))
ctx.msr = tmp_msr; ctx.msr = tmp_msr;
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_cr_regnum))
ctx.cr = tmp_cr; ctx.cr = tmp_cr;
if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum)) if (REG_VALID == regcache->get_register_status (tdep->ppc_lr_regnum))
ctx.lr = tmp_lr; ctx.lr = tmp_lr;
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (tdep->ppc_ctr_regnum))
tdep->ppc_ctr_regnum))
ctx.ctr = tmp_ctr; ctx.ctr = tmp_ctr;
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum))
tdep->ppc_xer_regnum))
ctx.xer = tmp_xer; ctx.xer = tmp_xer;
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum))
tdep->ppc_xer_regnum))
ctx.fpscr = tmp_fpscr; ctx.fpscr = tmp_fpscr;
} }
@ -1699,8 +1692,8 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
sprs32.pt_fpscr = tmp_fpscr; sprs32.pt_fpscr = tmp_fpscr;
if (tdep->ppc_mq_regnum >= 0) if (tdep->ppc_mq_regnum >= 0)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status
tdep->ppc_mq_regnum)) (tdep->ppc_mq_regnum))
regcache_raw_collect (regcache, tdep->ppc_mq_regnum, regcache_raw_collect (regcache, tdep->ppc_mq_regnum,
&sprs32.pt_mq); &sprs32.pt_mq);

View File

@ -176,12 +176,12 @@ store_fpregs (const struct regcache *regcache)
perror_with_name (_("Unable to fetch the floating point registers.")); perror_with_name (_("Unable to fetch the floating point registers."));
/* Store fpsr. */ /* Store fpsr. */
if (REG_VALID == regcache_register_status (regcache, ARM_FPS_REGNUM)) if (REG_VALID == regcache->get_register_status (ARM_FPS_REGNUM))
regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET); regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
/* Store the floating point registers. */ /* Store the floating point registers. */
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++) for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
if (REG_VALID == regcache_register_status (regcache, regno)) if (REG_VALID == regcache->get_register_status (regno))
collect_nwfpe_register (regcache, regno, fp); collect_nwfpe_register (regcache, regno, fp);
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
@ -318,20 +318,17 @@ store_wmmx_regs (const struct regcache *regcache)
perror_with_name (_("Unable to fetch WMMX registers.")); perror_with_name (_("Unable to fetch WMMX registers."));
for (regno = 0; regno < 16; regno++) for (regno = 0; regno < 16; regno++)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (regno + ARM_WR0_REGNUM))
regno + ARM_WR0_REGNUM))
regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM, regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM,
&regbuf[regno * 8]); &regbuf[regno * 8]);
for (regno = 0; regno < 2; regno++) for (regno = 0; regno < 2; regno++)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (regno + ARM_WCSSF_REGNUM))
regno + ARM_WCSSF_REGNUM))
regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM, regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM,
&regbuf[16 * 8 + regno * 4]); &regbuf[16 * 8 + regno * 4]);
for (regno = 0; regno < 4; regno++) for (regno = 0; regno < 4; regno++)
if (REG_VALID == regcache_register_status (regcache, if (REG_VALID == regcache->get_register_status (regno + ARM_WCGR0_REGNUM))
regno + ARM_WCGR0_REGNUM))
regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM, regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM,
&regbuf[16 * 8 + 2 * 4 + regno * 4]); &regbuf[16 * 8 + 2 * 4 + regno * 4]);

View File

@ -704,7 +704,7 @@ core_target::fetch_registers (struct regcache *regcache, int regno)
/* Mark all registers not found in the core as unavailable. */ /* Mark all registers not found in the core as unavailable. */
for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++) for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
if (regcache_register_status (regcache, i) == REG_UNKNOWN) if (regcache->get_register_status (i) == REG_UNKNOWN)
regcache_raw_supply (regcache, i, NULL); regcache_raw_supply (regcache, i, NULL);
} }

View File

@ -1262,7 +1262,7 @@ ctf_target::fetch_registers (struct regcache *regcache, int regno)
/* Make sure we stay within block bounds. */ /* Make sure we stay within block bounds. */
if (offset + regsize >= trace_regblock_size) if (offset + regsize >= trace_regblock_size)
break; break;
if (regcache_register_status (regcache, regn) == REG_UNKNOWN) if (regcache->get_register_status (regn) == REG_UNKNOWN)
{ {
if (regno == regn) if (regno == regn)
{ {

View File

@ -265,7 +265,7 @@ gnu_store_registers (struct target_ops *ops,
proc_debug (thread, "storing all registers"); proc_debug (thread, "storing all registers");
for (i = 0; i < I386_NUM_GREGS; i++) for (i = 0; i < I386_NUM_GREGS; i++)
if (REG_VALID == regcache_register_status (regcache, i)) if (REG_VALID == regcache->get_register_status (i))
regcache_raw_collect (regcache, i, REG_ADDR (state, i)); regcache_raw_collect (regcache, i, REG_ADDR (state, i));
} }
else else
@ -273,7 +273,7 @@ gnu_store_registers (struct target_ops *ops,
proc_debug (thread, "storing register %s", proc_debug (thread, "storing register %s",
gdbarch_register_name (gdbarch, regno)); gdbarch_register_name (gdbarch, regno));
gdb_assert (REG_VALID == regcache_register_status (regcache, regno)); gdb_assert (REG_VALID == regcache->get_register_status (regno));
regcache_raw_collect (regcache, regno, REG_ADDR (state, regno)); regcache_raw_collect (regcache, regno, REG_ADDR (state, regno));
} }

View File

@ -320,13 +320,6 @@ regcache::restore (readonly_detached_regcache *src)
} }
} }
enum register_status
regcache_register_status (const struct regcache *regcache, int regnum)
{
gdb_assert (regcache != NULL);
return regcache->get_register_status (regnum);
}
enum register_status enum register_status
reg_buffer::get_register_status (int regnum) const reg_buffer::get_register_status (int regnum) const
{ {

View File

@ -35,9 +35,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t,
struct gdbarch *, struct gdbarch *,
struct address_space *); struct address_space *);
enum register_status regcache_register_status (const struct regcache *regcache,
int regnum);
/* Make certain that the register REGNUM in REGCACHE is up-to-date. */ /* Make certain that the register REGNUM in REGCACHE is up-to-date. */
void regcache_raw_update (struct regcache *regcache, int regnum); void regcache_raw_update (struct regcache *regcache, int regnum);
@ -210,6 +207,8 @@ public:
/* Return regcache's architecture. */ /* Return regcache's architecture. */
gdbarch *arch () const; gdbarch *arch () const;
/* Get the availability status of the value of register REGNUM in this
buffer. */
enum register_status get_register_status (int regnum) const; enum register_status get_register_status (int regnum) const;
virtual ~reg_buffer () virtual ~reg_buffer ()

View File

@ -295,8 +295,8 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
available. */ available. */
if (tdep->have_tdb if (tdep->have_tdb
&& (regcache == NULL && (regcache == NULL
|| REG_VALID == regcache_register_status (regcache, || (REG_VALID
S390_TDB_DWORD0_REGNUM))) == regcache->get_register_status (S390_TDB_DWORD0_REGNUM))))
cb (".reg-s390-tdb", s390_sizeof_tdbregset, &s390_tdb_regset, cb (".reg-s390-tdb", s390_sizeof_tdbregset, &s390_tdb_regset,
"s390 TDB", cb_data); "s390 TDB", cb_data);
@ -313,14 +313,12 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (tdep->have_gs) if (tdep->have_gs)
{ {
if (regcache == NULL if (regcache == NULL
|| REG_VALID == regcache_register_status (regcache, || REG_VALID == regcache->get_register_status (S390_GSD_REGNUM))
S390_GSD_REGNUM))
cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset, cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset,
"s390 guarded-storage registers", cb_data); "s390 guarded-storage registers", cb_data);
if (regcache == NULL if (regcache == NULL
|| REG_VALID == regcache_register_status (regcache, || REG_VALID == regcache->get_register_status (S390_BC_GSD_REGNUM))
S390_BC_GSD_REGNUM))
cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset, cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset,
"s390 guarded-storage broadcast control", cb_data); "s390 guarded-storage broadcast control", cb_data);
} }

View File

@ -894,7 +894,7 @@ tfile_target::fetch_registers (struct regcache *regcache, int regno)
/* Make sure we stay within block bounds. */ /* Make sure we stay within block bounds. */
if (offset + regsize > trace_regblock_size) if (offset + regsize > trace_regblock_size)
break; break;
if (regcache_register_status (regcache, regn) == REG_UNKNOWN) if (regcache->get_register_status (regn) == REG_UNKNOWN)
{ {
if (regno == regn) if (regno == regn)
{ {