This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 08/15] class regcache_read and Pass regcache_read to gdbarch methods
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, <gdb-patches at sourceware dot org>
- Date: Tue, 23 Jan 2018 16:51:23 -0500
- Subject: Re: [PATCH 08/15] class regcache_read and Pass regcache_read to gdbarch methods
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <1512125286-29788-1-git-send-email-yao.qi@linaro.org> <1512125286-29788-9-git-send-email-yao.qi@linaro.org>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hi Yao,
On 2017-12-01 05:47 AM, Yao Qi wrote:
> pseudo registers are either from raw registers or memory, so
> gdbarch methods pseudo_register_read and pseudo_register_read_value
> should have regcache object which only have read methods. In other
> words, we should disallow writing to regcache in these two gdbarch
> methods. In order to apply this restriction, this patch adds a new
> class regcache_read, derived from reg_buffer, and it only has
> raw_read and cooked_read methods. regcache is derived from
> regcache_read. This patch also passes regcache_read instead of
> regcache to gdbarch methods pseudo_register_read and
> pseudo_register_read_value.
Did you consider changing other gdbarch methods that only need to read the
registers? read_pc comes to mind, but there are perhaps others.
> This patch moves raw_read* and cooked_read* methods to regcache_read,
> which is straightforward. One thing not straightforward is that I split
> regcache::xfer_part to regcache_read::read_part and regcache::write_part,
> because regcache_read can only have methods to read.
That is fine with me.
> regcache_read is an abstract base class, and it has a pure virtual
> function raw_update, because I don't want regcache_read know where these
> raw registers are from. They can be from either the target (readwrite
> regcache) or the regcache itself (readonly regcache).
About the naming, I think that readcache_read sounds like a function (it
sounds like an action). Instinctively, I would call it readable_regcache.
Simon