Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Alan Hayward <Alan.Hayward@arm.com>
Cc: "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>,
	 nd <nd@arm.com>
Subject: Re: [PATCH] Replace regbuf with regcache in record-full.c
Date: Fri, 23 Jun 2017 07:39:00 -0000	[thread overview]
Message-ID: <86efubi24c.fsf@gmail.com> (raw)
In-Reply-To: <84525A76-483C-4200-B7B6-C1F6AD5CC12F@arm.com> (Alan Hayward's	message of "Thu, 22 Jun 2017 16:02:13 +0000")

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 (齐尧)


  reply	other threads:[~2017-06-23  7:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 14:02 Alan Hayward
2017-06-22  8:44 ` Yao Qi
2017-06-22 16:02   ` Alan Hayward
2017-06-23  7:39     ` Yao Qi [this message]
2017-08-10  9:25       ` Alan Hayward

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86efubi24c.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=Alan.Hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox