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: [PATCH 8/8] Construct readonly regcache without address space


On Tue, Oct 31, 2017 at 2:35 PM, Simon Marchi <simon.marchi@ericsson.com> wrote:
> On 2017-10-27 05:31 AM, Yao Qi wrote:
>> The address space is useless to readonly regcache, so this patch removes
>> the parameter to construct readonly regcache.
>
> Can you expand on why the aspace is useless for readonly regcaches?  The
> comment of m_aspace says:
>
>   /* The address space of this register cache (for registers where it
>      makes sense, like PC or SP).  */
>

This comment was there because address_space was added for read-write
regcache.  Nowadays, address_space in regcache is used for various
breakpoint/watchpoint checkings, and these regcache are not read-only
regcache.

Additionally, regcache itself doesn't use address_space at all, so various
breakpoint/watchpoint checking code should get address_space from thread
ptid rather than regcache.

> Registers like PC or SP are present even in a readonly regcache, so I
> would think that it makes sense to have the address space there as well.
> So, is it that it's really useless (as in it doesn't make sense to have
> it there) or that we just don't happen to use the address space right now
> with readonly regcaches?

It doesn't make sense to have address_space in read-only regcache, at
least.  Since we don't have a type/class for read-only regcache, we still
have to keep address_space in regcache.  However, I don't see how
address_space can be used by regcache, we can remove it from regcache
completely, but that is a separate thing.

-- 
Yao (齐尧)


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