[PATCH] Fix sparc-*-linux register fetching/storing

Jakub Jelinek jakub@redhat.com
Sat Nov 10 16:41:00 GMT 2001


On Sun, Nov 25, 2001 at 11:54:46AM -0500, Daniel Jacobowitz wrote:
> Well, regcache_collect is the only approved interface to the contents
> of registers[] for one thing.

Even in the routine where half of it is direct registers[] setting?
If that is rewritten, surely it makes sense to access sp that way too.

> It would also prevent the need for the
> cast (although you'd have to clear the upper half of the variable
> first and make sure to stuff it into the low bytes since we're
> big-endian.  Ew.).
> 
> Andrew?  Do we need to have a regcache_collect_core_addr, to sign
> extend and shift appropriately for each architecture?

Without such routine the code would be very ugly:
CORE_ADDR sp = 0;
regcache_collect (SP_REGNUM, ((char *)&sp) + sizeof(CORE_ADDR) - REGISTER_RAW_SIZE(SP_REGNUM));

	Jakub



More information about the Gdb-patches mailing list