From: Yao Qi Date: Mon, 2 Oct 2017 14:09:14 +0000 (+0100) Subject: Simplify {supply,fill}_{g,fp}regset X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee085f442ba373132a5c10557022bc7025dae270;p=thirdparty%2Fbinutils-gdb.git Simplify {supply,fill}_{g,fp}regset {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 : * 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;): --- diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 6ad6f663bfe..2ddf85f6704 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -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. */ diff --git a/gdb/gregset.h b/gdb/gregset.h index 3101edcdf73..7c70550f29c 100644 --- a/gdb/gregset.h +++ b/gdb/gregset.h @@ -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