This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC][PATCH v2][PR remote/16896] Invalidate a register in cache when a remote target failed to write it.
- From: Pedro Alves <palves at redhat dot com>
- To: Pierre Langlois <pierre dot langlois at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Thu, 12 Jun 2014 14:23:26 +0100
- Subject: Re: [RFC][PATCH v2][PR remote/16896] Invalidate a register in cache when a remote target failed to write it.
- Authentication-results: sourceware.org; auth=none
- References: <537E086A dot 9030803 at embecosm dot com>
Hi Pierre,
On 05/22/2014 03:23 PM, Pierre Langlois wrote:
> Hello all,
>
> This patch addresses the issue in patch [1] generically as pointed out by
> a comment [2].
>
> As opposed to invalidating a register in cache in the remote target before
> throwing an error, we can do this using a cleanup in regcache_raw_write. This
> patch adds routines to add a regcache_invalidate cleanup to the current chain.
> We can use this before target_store_registers and discard it after if an error
> was not thrown.
>
> [1] https://sourceware.org/ml/gdb-patches/2014-05/msg00083.html
> [2] https://sourceware.org/ml/gdb-patches/2014-05/msg00357.html
Based on the commit log / description of the change in v1, could
you propose a commit log for this version of the patch, please?
> 2014-05-20 Pierre Langlois <pierre.langlois@embecosm.com>
>
> PR remote/16896
> * regcache.c (register_to_invalidate): New structure. Combines a pointer
Double space after periods. "structure. Combines".
But just "New structure" is enough. The structure's description should be
in the code. We usually spell out "struct" in the context part as well. So:
* regcache.c (struct register_to_invalidate): New structure.
> to a struct regcache and a register number.
> (do_register_invalidate): New function. Call regcache_invalidate.
> (make_cleanup_regcache_invalidate): New function. Construct a cleanup
> for invalidating a register.
> (regcache_raw_write): Call make_cleanup_regcache_invalidate
Missing period.
Also, please make sure ChangeLog entries are indented with a tab instead
of spaces.
I suggest:
* regcache.c (struct register_to_invalidate): New structure.
(do_register_invalidate, make_cleanup_regcache_invalidate): New
functions.
(regcache_raw_write): Call make_cleanup_regcache_invalidate.
* regcache.h (make_cleanup_regcache_invalidate): New prototype.
> +
> +static void
> +do_regcache_invalidate (void *data)
> +{
> + struct register_to_invalidate *reg = data;
> + regcache_invalidate (reg->regcache, reg->regnum);
Empty line after declaration.
> +}
> +
> +struct cleanup *
> +make_cleanup_regcache_invalidate (struct regcache *regcache, int regnum)
As nothing is calling this outside regcache.c, please make it static.
> +{
> + struct register_to_invalidate* reg = XNEW (struct register_to_invalidate);
> + reg->regcache = regcache;
Empty line after declaration.
Thanks!
--
Pedro Alves