diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-05-30 14:54:35 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-05-30 14:54:35 -0400 |
commit | 0ec9f11447514a797ae13760825fa45f9deedd8c (patch) | |
tree | 05e2712efd767dd5d0c8a08b9391f16f83124de1 | |
parent | 222312d359fe0a68f8583ba315583ee8cc94f252 (diff) | |
download | binutils-0ec9f11447514a797ae13760825fa45f9deedd8c.zip binutils-0ec9f11447514a797ae13760825fa45f9deedd8c.tar.gz binutils-0ec9f11447514a797ae13760825fa45f9deedd8c.tar.bz2 |
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.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/aarch32-linux-nat.c | 4 | ||||
-rw-r--r-- | gdb/aarch64-linux-nat.c | 8 | ||||
-rw-r--r-- | gdb/aix-thread.c | 67 | ||||
-rw-r--r-- | gdb/arm-linux-nat.c | 13 | ||||
-rw-r--r-- | gdb/corelow.c | 2 | ||||
-rw-r--r-- | gdb/ctf.c | 2 | ||||
-rw-r--r-- | gdb/i386-gnu-nat.c | 4 | ||||
-rw-r--r-- | gdb/regcache.c | 7 | ||||
-rw-r--r-- | gdb/regcache.h | 5 | ||||
-rw-r--r-- | gdb/s390-linux-tdep.c | 10 | ||||
-rw-r--r-- | gdb/tracefile-tfile.c | 2 |
12 files changed, 58 insertions, 72 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1c09d21..ef6d921 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 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> + * regcache.h (regcache_get_ptid): Remove, update all callers to call regcache::ptid instead. * regcache.c (regcache_get_ptid): Remove. diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c index 71f5cfa..d1c1314 100644 --- a/gdb/aarch32-linux-nat.c +++ b/gdb/aarch32-linux-nat.c @@ -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++) { - if (REG_VALID == regcache_register_status (regcache, regno)) + if (REG_VALID == regcache->get_register_status (regno)) regcache_raw_collect (regcache, regno, ®s[regno]); } 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]; diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 3672a2f..c1fb7ac 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -264,7 +264,7 @@ store_gregs_to_thread (const struct regcache *regcache) int 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, ®s[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.")); 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, (char *) ®s.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, (char *) ®s.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, (char *) ®s.fpcr); } diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 6f4135b..749065c 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1389,8 +1389,8 @@ fill_gprs64 (const struct regcache *regcache, uint64_t *vals) int regno; for (regno = 0; regno < ppc_num_gprs; regno++) - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_gp0_regnum + regno)) + if (REG_VALID == regcache->get_register_status + (tdep->ppc_gp0_regnum + regno)) regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno, vals + regno); } @@ -1402,8 +1402,8 @@ fill_gprs32 (const struct regcache *regcache, uint32_t *vals) int regno; for (regno = 0; regno < ppc_num_gprs; regno++) - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_gp0_regnum + regno)) + if (REG_VALID == regcache->get_register_status + (tdep->ppc_gp0_regnum + regno)) regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno, vals + regno); } @@ -1423,7 +1423,7 @@ fill_fprs (const struct regcache *regcache, double *vals) for (regno = tdep->ppc_fp0_regnum; regno < tdep->ppc_fp0_regnum + ppc_num_fprs; regno++) - if (REG_VALID == regcache_register_status (regcache, regno)) + if (REG_VALID == regcache->get_register_status (regno)) regcache_raw_collect (regcache, regno, vals + regno - tdep->ppc_fp0_regnum); } @@ -1448,22 +1448,20 @@ fill_sprs64 (const struct regcache *regcache, gdb_assert (sizeof (*iar) == register_size (gdbarch, gdbarch_pc_regnum (gdbarch))); - if (REG_VALID == regcache_register_status (regcache, - gdbarch_pc_regnum (gdbarch))) + if (REG_VALID == regcache->get_register_status (gdbarch_pc_regnum (gdbarch))) 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); - 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); - 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); - 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); - 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); 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); } @@ -1484,21 +1482,20 @@ fill_sprs32 (const struct regcache *regcache, gdb_assert (sizeof (*iar) == register_size (gdbarch, gdbarch_pc_regnum (gdbarch))); - if (REG_VALID == regcache_register_status (regcache, - gdbarch_pc_regnum (gdbarch))) + if (REG_VALID == regcache->get_register_status (gdbarch_pc_regnum (gdbarch))) 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); - 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); - 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); - 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); - 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); 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); } @@ -1533,8 +1530,7 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid) /* Collect general-purpose register values from the regcache. */ for (i = 0; i < ppc_num_gprs; i++) - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_gp0_regnum + i)) + if (REG_VALID == regcache->get_register_status (tdep->ppc_gp0_regnum + i)) { 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, &tmp_xer, &tmp_fpscr); - if (REG_VALID == regcache_register_status (regcache, - gdbarch_pc_regnum (gdbarch))) + if (REG_VALID == regcache->get_register_status + (gdbarch_pc_regnum (gdbarch))) 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; - 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; - 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; - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_ctr_regnum)) + if (REG_VALID == regcache->get_register_status (tdep->ppc_ctr_regnum)) ctx.ctr = tmp_ctr; - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_xer_regnum)) + if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum)) ctx.xer = tmp_xer; - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_xer_regnum)) + if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum)) ctx.fpscr = tmp_fpscr; } @@ -1699,8 +1692,8 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, sprs32.pt_fpscr = tmp_fpscr; if (tdep->ppc_mq_regnum >= 0) - if (REG_VALID == regcache_register_status (regcache, - tdep->ppc_mq_regnum)) + if (REG_VALID == regcache->get_register_status + (tdep->ppc_mq_regnum)) regcache_raw_collect (regcache, tdep->ppc_mq_regnum, &sprs32.pt_mq); diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index ccf812b..a1bef7a 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -176,12 +176,12 @@ store_fpregs (const struct regcache *regcache) perror_with_name (_("Unable to fetch the floating point registers.")); /* 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); /* Store the floating point registers. */ 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); 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.")); for (regno = 0; regno < 16; regno++) - if (REG_VALID == regcache_register_status (regcache, - regno + ARM_WR0_REGNUM)) + if (REG_VALID == regcache->get_register_status (regno + ARM_WR0_REGNUM)) regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM, ®buf[regno * 8]); for (regno = 0; regno < 2; regno++) - if (REG_VALID == regcache_register_status (regcache, - regno + ARM_WCSSF_REGNUM)) + if (REG_VALID == regcache->get_register_status (regno + ARM_WCSSF_REGNUM)) regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM, ®buf[16 * 8 + regno * 4]); for (regno = 0; regno < 4; regno++) - if (REG_VALID == regcache_register_status (regcache, - regno + ARM_WCGR0_REGNUM)) + if (REG_VALID == regcache->get_register_status (regno + ARM_WCGR0_REGNUM)) regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM, ®buf[16 * 8 + 2 * 4 + regno * 4]); diff --git a/gdb/corelow.c b/gdb/corelow.c index c617527..0a7d742 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -704,7 +704,7 @@ core_target::fetch_registers (struct regcache *regcache, int regno) /* Mark all registers not found in the core as unavailable. */ 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); } @@ -1262,7 +1262,7 @@ ctf_target::fetch_registers (struct regcache *regcache, int regno) /* Make sure we stay within block bounds. */ if (offset + regsize >= trace_regblock_size) break; - if (regcache_register_status (regcache, regn) == REG_UNKNOWN) + if (regcache->get_register_status (regn) == REG_UNKNOWN) { if (regno == regn) { diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c index e5195f3..a738308 100644 --- a/gdb/i386-gnu-nat.c +++ b/gdb/i386-gnu-nat.c @@ -265,7 +265,7 @@ gnu_store_registers (struct target_ops *ops, proc_debug (thread, "storing all registers"); 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)); } else @@ -273,7 +273,7 @@ gnu_store_registers (struct target_ops *ops, proc_debug (thread, "storing register %s", 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)); } diff --git a/gdb/regcache.c b/gdb/regcache.c index 9881e92..dd1dde2 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -321,13 +321,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 reg_buffer::get_register_status (int regnum) const { assert_regnum (regnum); diff --git a/gdb/regcache.h b/gdb/regcache.h index 7fcc43a..fa177b5 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -35,9 +35,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t, struct gdbarch *, 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. */ void regcache_raw_update (struct regcache *regcache, int regnum); @@ -210,6 +207,8 @@ public: /* Return regcache's architecture. */ 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; virtual ~reg_buffer () diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 0e85e71..cd840c8 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -295,8 +295,8 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch, available. */ if (tdep->have_tdb && (regcache == NULL - || REG_VALID == regcache_register_status (regcache, - S390_TDB_DWORD0_REGNUM))) + || (REG_VALID + == regcache->get_register_status (S390_TDB_DWORD0_REGNUM)))) cb (".reg-s390-tdb", s390_sizeof_tdbregset, &s390_tdb_regset, "s390 TDB", cb_data); @@ -313,14 +313,12 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch, if (tdep->have_gs) { if (regcache == NULL - || REG_VALID == regcache_register_status (regcache, - S390_GSD_REGNUM)) + || REG_VALID == regcache->get_register_status (S390_GSD_REGNUM)) cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset, "s390 guarded-storage registers", cb_data); if (regcache == NULL - || REG_VALID == regcache_register_status (regcache, - S390_BC_GSD_REGNUM)) + || REG_VALID == regcache->get_register_status (S390_BC_GSD_REGNUM)) cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset, "s390 guarded-storage broadcast control", cb_data); } diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index f4fdd36..32f5722 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -894,7 +894,7 @@ tfile_target::fetch_registers (struct regcache *regcache, int regno) /* Make sure we stay within block bounds. */ if (offset + regsize > trace_regblock_size) break; - if (regcache_register_status (regcache, regn) == REG_UNKNOWN) + if (regcache->get_register_status (regn) == REG_UNKNOWN) { if (regno == regn) { |