]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Simplify {supply,fill}_{g,fp}regset
authorYao Qi <yao.qi@linaro.org>
Mon, 2 Oct 2017 14:09:14 +0000 (15:09 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 13 Oct 2017 10:52:11 +0000 (11:52 +0100)
{supply,fill}_{g,fp}regset methods need only to access reg_buffer, instead
of regcache, so this patch change parameter type to reg_buffer.

Only works for aarch64 native

gdb:

2017-10-02  Yao Qi  <yao.qi@linaro.org>
:
* aarch64-linux-nat.c (aarch64_linux_store_inferior_registers):
(fill_gregset): -
(fill_gregset): +
(supply_gregset): -
(supply_gregset): +
(supply_gregset):
(fill_fpregset): -
(fill_fpregset): +
(supply_fpregset): -
(supply_fpregset): +
* gregset.h (struct regcache;):

gdb/aarch64-linux-nat.c
gdb/gregset.h

index 6ad6f663bfeaac2b38425a8a5791e0c312cf8aac..2ddf85f6704ac7e9c4614456cab17911548f52c4 100644 (file)
@@ -383,23 +383,23 @@ aarch64_linux_store_inferior_registers (struct target_ops *ops,
    do this for all registers.  */
 
 void
-fill_gregset (const struct regcache *regcache,
+fill_gregset (const reg_buffer *regcache,
              gdb_gregset_t *gregsetp, int regno)
 {
-  regcache_collect_regset (&aarch64_linux_gregset, regcache,
-                          regno, (gdb_byte *) gregsetp,
-                          AARCH64_LINUX_SIZEOF_GREGSET);
+  regcache->collect_regset (&aarch64_linux_gregset, regno,
+                           (gdb_byte *) gregsetp,
+                           AARCH64_LINUX_SIZEOF_GREGSET);
 }
 
 /* Fill GDB's register array with the general-purpose register values
    in *GREGSETP.  */
 
 void
-supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
+supply_gregset (reg_buffer *regcache, const gdb_gregset_t *gregsetp)
 {
-  regcache_supply_regset (&aarch64_linux_gregset, regcache, -1,
-                         (const gdb_byte *) gregsetp,
-                         AARCH64_LINUX_SIZEOF_GREGSET);
+  regcache->supply_regset (&aarch64_linux_gregset, -1,
+                          (const gdb_byte *) gregsetp,
+                          AARCH64_LINUX_SIZEOF_GREGSET);
 }
 
 /* Fill register REGNO (if it is a floating-point register) in
@@ -407,23 +407,23 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
    do this for all registers.  */
 
 void
-fill_fpregset (const struct regcache *regcache,
+fill_fpregset (const reg_buffer *regcache,
               gdb_fpregset_t *fpregsetp, int regno)
 {
-  regcache_collect_regset (&aarch64_linux_fpregset, regcache,
-                          regno, (gdb_byte *) fpregsetp,
-                          AARCH64_LINUX_SIZEOF_FPREGSET);
+  regcache->collect_regset (&aarch64_linux_fpregset, regno,
+                           (gdb_byte *) fpregsetp,
+                           AARCH64_LINUX_SIZEOF_FPREGSET);
 }
 
 /* Fill GDB's register array with the floating-point register values
    in *FPREGSETP.  */
 
 void
-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
+supply_fpregset (reg_buffer *regcache, const gdb_fpregset_t *fpregsetp)
 {
-  regcache_supply_regset (&aarch64_linux_fpregset, regcache, -1,
-                         (const gdb_byte *) fpregsetp,
-                         AARCH64_LINUX_SIZEOF_FPREGSET);
+  regcache->supply_regset (&aarch64_linux_fpregset, -1,
+                          (const gdb_byte *) fpregsetp,
+                          AARCH64_LINUX_SIZEOF_FPREGSET);
 }
 
 /* linux_nat_new_fork hook.   */
index 3101edcdf7356ca1f331caa8d0bb13e87fbe1d89..7c70550f29ced6c5c2cd0e7610c8b7e00c63a781 100644 (file)
@@ -34,7 +34,7 @@
 typedef GDB_GREGSET_T gdb_gregset_t;
 typedef GDB_FPREGSET_T gdb_fpregset_t;
 
-struct regcache;
+class reg_buffer;
 
 /* A gregset is a data structure supplied by the native OS containing
    the general register values of the debugged process.  Usually this
@@ -46,18 +46,18 @@ struct regcache;
 /* Copy register values from the native target gregset/fpregset
    into GDB's internal register cache.  */
 
-extern void supply_gregset (struct regcache *regcache,
+extern void supply_gregset (reg_buffer *regcache,
                            const gdb_gregset_t *gregs);
-extern void supply_fpregset (struct regcache *regcache,
+extern void supply_fpregset (reg_buffer *regcache,
                             const gdb_fpregset_t *fpregs);
 
 /* Copy register values from GDB's register cache into
    the native target gregset/fpregset.  If regno is -1, 
    copy all the registers.  */
 
-extern void fill_gregset (const struct regcache *regcache,
+extern void fill_gregset (const reg_buffer *regcache,
                          gdb_gregset_t *gregs, int regno);
-extern void fill_fpregset (const struct regcache *regcache,
+extern void fill_fpregset (const reg_buffer *regcache,
                           gdb_fpregset_t *fpregs, int regno);
 
 #endif