Re: [PATCH 10/15] Class regcache_readonly

Yao Qi
2018-01-24T09:43:02Z

On Wed, Jan 24, 2018 at 3:05 AM, Simon Marchi <simon.marchi@ericsson.com> wrote:
> On 2017-12-01 05:48 AM, Yao Qi wrote:
>> This patch adds a new class (type) for readonly regcache, which is
>> created via regcache::save. regcache_readonly inherts from
>> regcache_read.
>
> Hi Yao,
>
> Just a note about the naming. IIUC, the important thing about this
> kind of regcache is that it's detached from any target. Did you
> think about naming it detached_regcache or something like that ?
>

This kind of regcache is both detached and readonly. As I said in
https://sourceware.org/ml/gdb-patches/2017-07/msg00031.html,
detached and readonly are orthogonal in design. We have four
different kinds of regcache,

- readony detached regcache, this is what "class regcache_readonly"
about. It has several uses, 1) record infcall state, 2) give a
regcache view to frame,

- read-write detached regcache, this is what "class reg_buffer_rw"
about. It is used jit.c and record-full.c, where GDB keeps a detached
regcache, but can read and write to it.

- read-write attached regcache, that is what "class regcache" about. It
is attached to target, read and write will go through target,

- readonly attached regcache. It can be used for target 'core', but this
piece is not included in this series,

so in this patch series, "readonly" implies "detached".

The major motivation of this patch series is to differentiate these kinds
of regcache by different types, instead of by fields "m_readonly_p" or
"m_detached_p" in "class regcache".

--
Yao (齐尧)