This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH v2][PR remote/16896] Invalidate a register in cache when a remote target failed to write it.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]