This is the mail archive of the 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]

Re: Register Cache.

Just FYI,

I'm letting this e-mail slip off my desk and onto the floor.  Someone
will eventually re-visit the idea (since it is very real).?


GDB caches it's register reads. ie, it will only read a register once, and
will only write a register if it thinks the value has changed.

For Example:

set $myreg=0x12345678     <-- Results in GDB Actually changing the register.
set $myreg=0x12345678     <-- Filtered by GDB and doesnt set register.

Now this seems fine on the surface, but there are many registers that
the act of writing is sometimes more important than the data (like say a
watchdog reset register). You may need to write the same value multiple times.

I Can find no way of forcing GDB to not cache its register accesses (dcache
also has this problem, but it also has a solution) does anyone know of a way to
force GDB to either always update registers and read registers and not cache
them, or of a way to force GDB to set it's status of these registers as unknown
(and hence making it update from the register).

Ive spent all day hunting through the code ("Using the source" as some would
say) but i'm damned if I can find anything. So I am attempting to introduce my
own solution. But obviously I may have missed something. 

Steven Johnson

I Want to change the way GDB Caches Registers by doing the following:

1. Add a Cache Type entry so that each register can be set (via a gdb command)
to be read cached, write cached or no cache. By default it would be read/write
cache enabled as is the case now.

2. Add a command to flush GDB's knowledge of the cache.

My Questions are:

1. Does anyone have any input they would like to add to this?
2. What sort of command should they be maintenance, data or set commands.

I Would like to have commands like this:
set register-cache $r5 read
set register-cache $r5 write
set register-cache $r5 rw
set register-cache $r5 disabled

and another command

maintenance register-cache flush

This raises another question:

3. How do i look up the $r5 in the command and turn it into a register number?

I tried finding the code the interprets:
set $r5=0

to see how it did it, but it's obscure and I couldn't find it.

Steven Johnson.

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