Re: [PATCH 3/5] set/show code-cache

Yao Qi
2013-10-25T14:35:43Z

On 10/25/2013 03:47 PM, Doug Evans wrote:
> While perhaps it usually won't be a problem (*1), it's odd to have two caches.

At the very beginning, I use single dcache for both stack access and
code access. However, it is odd that command "set stack-cache off"
invalidates code caches, so I decide to add a new cache dedicated to
code access.

> If I do x/10x $addr and then x/10i $addr will both caches get populated?

No, "x/10i $addr" gets code cache populated, while "x/10x $addr" doesn't
get "general" or "stack" cache populated, unless I set memory attribute
cache for this area.

> [Will there be latent bugs due to "storing the same thing twice"?
> (which has been a source of bugs in gdb) Plus there's the extra
> complexity of keeping both in sync.]

"Storing the same thing twice" may introduce bugs, but "store two things
together" is not good either :).

The code keeping caches in sync is localized, and probably we can move
them into a new file target-cache.c. I don't see too much complexity
here and the disassembly is sped up, so it is worth doing it, IMO.

--
Yao (é½å°§)