[6/6] Make regcache_cpy_no_passthrough static

Message ID 20150508202159.15830.97494.stgit@host1.jankratochvil.net
State New, archived
Headers

Commit Message

Jan Kratochvil May 8, 2015, 8:21 p.m. UTC
  Hi,

regcache_cpy_no_passthrough is no longer used for a standalone call.


Jan


gdb/ChangeLog
2015-05-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* regcache.c (regcache_cpy_no_passthrough): New declaration.
	(regcache_cpy_no_passthrough): Make it static, add function comment.
	* regcache.h (regcache_dup, regcache_cpy): Reduce/update their comment.
	(regcache_cpy_no_passthrough): Remove declaration.
---
 gdb/regcache.c |   14 +++++++++++++-
 gdb/regcache.h |    9 ++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
  

Comments

Pedro Alves May 13, 2015, 1:16 p.m. UTC | #1
On 05/08/2015 09:21 PM, Jan Kratochvil wrote:
> +/* Copy/duplicate the contents of a register cache.  By default, the
> +   operation is pass-through.  Writes to DST and reads from SRC will
> +   go through to the target.  See also regcache_cpy.
> +
> +   It can not have overlapping SRC and DST buffers.
> +
> +   It does not go through to the target.  It only transfer values
> +   already in the cache.  */

I think this would be clearer:

/* Copy/duplicate the contents of a register cache.  Unlike regcache_cpy,
   which is pass-through, this does not go through to the target.
   Only values values already in the cache are transferred.  The SRC and DST
   buffers must not overlap.  */

static void
regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
{

Otherwise looks fine.

Thanks,
Pedro Alves
  
Jan Kratochvil May 13, 2015, 6:55 p.m. UTC | #2
On Wed, 13 May 2015 15:16:42 +0200, Pedro Alves wrote:
> I think this would be clearer:
> 
> /* Copy/duplicate the contents of a register cache.  Unlike regcache_cpy,
>    which is pass-through, this does not go through to the target.
>    Only values values already in the cache are transferred.  The SRC and DST
>    buffers must not overlap.  */

Done.


> Otherwise looks fine.

Checked in:
	bd49952bd7fbe616e2cb488e8080502f2338aaa2


Jan
  

Patch

diff --git a/gdb/regcache.c b/gdb/regcache.c
index 366eba0..d363a12 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -391,6 +391,9 @@  do_cooked_read (void *src, int regnum, gdb_byte *buf)
   return regcache_cooked_read (regcache, regnum, buf);
 }
 
+static void regcache_cpy_no_passthrough (struct regcache *dst,
+					 struct regcache *src);
+
 void
 regcache_cpy (struct regcache *dst, struct regcache *src)
 {
@@ -407,7 +410,16 @@  regcache_cpy (struct regcache *dst, struct regcache *src)
     regcache_cpy_no_passthrough (dst, src);
 }
 
-void
+/* Copy/duplicate the contents of a register cache.  By default, the
+   operation is pass-through.  Writes to DST and reads from SRC will
+   go through to the target.  See also regcache_cpy.
+
+   It can not have overlapping SRC and DST buffers.
+
+   It does not go through to the target.  It only transfer values
+   already in the cache.  */
+
+static void
 regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
 {
   gdb_assert (src != NULL && dst != NULL);
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 394506a..a9fb44b 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -224,17 +224,12 @@  extern void regcache_save (struct regcache *dst,
 
 /* Copy/duplicate the contents of a register cache.  By default, the
    operation is pass-through.  Writes to DST and reads from SRC will
-   go through to the target.
+   go through to the target.  See also regcache_cpy_no_passthrough.
 
-   The ``cpy'' functions can not have overlapping SRC and DST buffers.
-
-   ``no passthrough'' versions do not go through to the target.  They
-   only transfer values already in the cache.  */
+   regcache_cpy can not have overlapping SRC and DST buffers.  */
 
 extern struct regcache *regcache_dup (struct regcache *regcache);
 extern void regcache_cpy (struct regcache *dest, struct regcache *src);
-extern void regcache_cpy_no_passthrough (struct regcache *dest,
-					 struct regcache *src);
 
 extern void registers_changed (void);
 extern void registers_changed_ptid (ptid_t);