This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Replace regbuf with regcache in record-full.c
Alan Hayward <Alan.Hayward@arm.com> writes:
> Resulting in:
> void raw_supply (int regnum, const void *buf);
> void raw_supply (int regnum, const struct regcache *src_regcache);
^^^^^^^^^^^^^^^^^^^^^^^^
We should use reference instead of pointer, otherwise, raw_supply (0, NULL)
is ambiguous.
>>
>> http://people.linaro.org/~yao.qi/gdb/doxy/regcache-split/gdb-xref/classregcache.html
>>
>> Do you like this design? One more thing is that the new class
>> regcache_collect_supply can be used in target_ops hooks
>> to_fetch_registers, to_store_registers, to_prepare_to_store,
>>
>> void (*to_fetch_registers) (struct target_ops *, regcache_collect_supply *, int)
>> TARGET_DEFAULT_IGNORE ();
>> void (*to_store_registers) (struct target_ops *, regcache_collect_supply *, int)
>> TARGET_DEFAULT_NORETURN (noprocess ());
>> void (*to_prepare_to_store) (struct target_ops *, regcache_collect_supply *)
>> TARGET_DEFAULT_NORETURN (noprocess ());
>>
>> so that all the implementations of these methods above can only access
>> raw_{collect,supply}XX methods, and they can't access
>> {raw,cooked}_{read,write}XXX methods, which in turn may call target_ops
>> to_fetch_registers and to_store_registers again.
>>
>
> Following this through, regcache_dup and regcache_cpy should create a
> detached_regcache ?
>
Yes, it can be.
> Code would be free to write to the detached_regcache and there would
> be no need to mark
> it as “read-only”.
No.
>
> Would there be any requirement to still have a read-only regcache ?
The detached_regcache can be read-write and read-only. regcache_dup and
regcache_cpy create the read-only one, but record-full still uses the
read-write one.
--
Yao (齐尧)