[patch/rfc] register_offset_hack()

Andrew Cagney ac131313@ges.redhat.com
Sat Aug 17 20:12:00 GMT 2002


Hello,

The attached adds a number of ``hacks'' to the regcache.  The intent is 
for these hacks to replace the far worse and much dreaded 
read_register_bytes() and write_register_bytes().

The struct value and expression evaluator view the register cache as a 
linear byte array.  Hence, to read adjacent registers, a ``memcpy'' of 
the relevant bytes is all that is needed.

The attached provides the following methods:

register_offset_hack(gdbarch,regnum)
   Replaces REGISTER_BYTE().  Returns the ``offset'' of regnum in the 
register buffer.

regcache_cooked read/write using_offset_hack(regcache,offset,len,buf)
   read/write the cooked register cache treating the cache as a big array.

While similar to the read_register_bytes() and write_register_bytes() 
methods they have far simpler interfaces.  Hacks such as reading, or 
even allowing, gaps between registers have been removed.

Other than a couple cases related to the expression evaluator and struct 
value, there should be no reason for using these functions.

I'll look to commit this code in a few days but won't even consider 
changing things over until post 5.3 branch.

enjoy,
Andrew
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20020817/197ccbba/attachment.ksh>


More information about the Gdb-patches mailing list