]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove regcache_register_status
authorSimon Marchi <simon.marchi@ericsson.com>
Wed, 30 May 2018 18:54:35 +0000 (14:54 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Wed, 30 May 2018 18:54:35 +0000 (14:54 -0400)
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.

12 files changed:
gdb/ChangeLog
gdb/aarch32-linux-nat.c
gdb/aarch64-linux-nat.c
gdb/aix-thread.c
gdb/arm-linux-nat.c
gdb/corelow.c
gdb/ctf.c
gdb/i386-gnu-nat.c
gdb/regcache.c
gdb/regcache.h
gdb/s390-linux-tdep.c
gdb/tracefile-tfile.c

index 1c09d21729dbeaed33e9d0463a232824de28db2b..ef6d92118ed75136caab2a9a35ae2f46675a98fb 100644 (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>
 
        * regcache.h (regcache_get_ptid): Remove, update all callers to
index 71f5cfa397ad0b0f6e22255eb893111b6fa50a64..d1c13141c5cf65f81388f5cbf3991a60620f6a65 100644 (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++)
     {
-      if (REG_VALID == regcache_register_status (regcache, regno))
+      if (REG_VALID == regcache->get_register_status (regno))
        regcache_raw_collect (regcache, regno, &regs[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];
 
index 3672a2f5ce5cceebbf1c5aa40822a71df5d8909a..c1fb7ac785a1a551355fc096fd0dafd3832855fc 100644 (file)
@@ -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,
                                &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."));
 
       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 *) &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,
                              (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,
                              (char *) &regs.fpcr);
     }
index 6f4135b8466c7aba99e7aaf691d0845caeef2b95..749065c5e56bf542aa7ebdc8629836808790809c 100644 (file)
@@ -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);
 
index ccf812b21b116d8baf7e9c4810bd1e693ed322cf..a1bef7a4e235c6b4196ef9333ca940d4a7fa5f53 100644 (file)
@@ -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,
                            &regbuf[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,
                            &regbuf[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,
                            &regbuf[16 * 8 + 2 * 4 + regno * 4]);
 
index c6175279da9b5df4a006adff63b2251c240cf885..0a7d742aad9aaca4c8db22ca220ab5221b184a78 100644 (file)
@@ -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);
 }
 
index cae5d221cb1c3f4a8143df60ea12b0df75101ccd..1ab095d9da3cca2ba90bcb1a52072b041d922d6c 100644 (file)
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -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)
                {
index e5195f3eb6e09c744ebd033fe66a29bad3a492d6..a738308e51b96f66410574f384d7eba52f8402bd 100644 (file)
@@ -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));
        }
 
index 9881e92468ddce3c3ca5eea97872df26cda4bd93..dd1dde234c93d47dd42a71e08fc6e3fb68713b12 100644 (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
 reg_buffer::get_register_status (int regnum) const
 {
index 7fcc43a83c56c05d95eec55c029a5b4504ac3477..fa177b58aa3a2a23aa185bf5a8d27a88f0cc5337 100644 (file)
@@ -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 ()
index 0e85e7108985109e78305fdd09e4ea290dfdb5b6..cd840c86d65a459afa380b04a1a20d0548222c28 100644 (file)
@@ -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);
     }
index f4fdd3674da2047e6e8192f71118a1aadeaf341b..32f57220a0d23c651dc125481a2b4a67a1747b33 100644 (file)
@@ -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)
                {