This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Replace regcache readonly flag with detached flag
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: Alan Hayward <Alan dot Hayward at arm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Tue, 18 Jul 2017 13:41:06 +0100
- Subject: Re: [RFC] Replace regcache readonly flag with detached flag
- Authentication-results: sourceware.org; auth=none
- References: <B209EACB-8FC0-4702-9C4A-2BD54D393925@arm.com> <8637a0r9mq.fsf@gmail.com>
On Thu, 13 Jul 2017, Yao Qi wrote:
> > Therefore I'd like to propose removing m_readonly_p and replacing it with:
> >
> > /* Is this a detached cache? A detached cache is not attached to a target.
> > It is used for saving the target's register state (e.g, across an inferior
> > function call or just before forcing a function return). A detached cache
> > can be written to and read from, however the values will not be passed
> > through to a target.
> > Using the copy constructor or regcache_dup on a regcache will always
> > create a detached regcache. */
> > bool m_detached_p;
> >
> > In most cases this is a 1:1 substitution of m_readonly_p for m_detached_p,
> > except it for the write functions, where we now allow writing to the
> > regcache buffers.
>
> I am not sure this replacement is reasonable. The regcache can be
> detached from target, and read-only or read-write. The regcache can be
> attached to target, and read-write. I can't think of a case that
> regcache is attached to target and read-only.
As a matter of interest: what if the target is `core'?
Maciej