From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Daniel Jacobowitz Cc: Jakub Jelinek , gdb-patches@sources.redhat.com Subject: Re: [PATCH] Fix sparc-*-linux register fetching/storing Date: Mon, 26 Nov 2001 09:18:00 -0000 Message-ID: <3C02795A.9000104@cygnus.com> References: <20011123154220.A562@sunsite.ms.mff.cuni.cz> <20011125020147.A32180@nevyn.them.org> <20011125113201.C4087@devserv.devel.redhat.com> <20011125115446.A15038@nevyn.them.org> X-SW-Source: 2001-11/msg00444.html Message-ID: <20011126091800.SaKyIjlppcj3K_CfeWibz7Fz5VERhAhwYVoza1Zjj30@z> > > Well, regcache_collect is the only approved interface to the contents > of registers[] for one thing. 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? That sounds like overkill. If you need to be doing sign/zero extension stuff then I'd be looking at explicit calls to extract_signed_integer() and/or extract_unsigned_integer() in the nat code. A sequence like: void *buf = alloca (MAX_REGISTER_RAW_SIZE); regcache_collect (my reg, buf); LONGEST val = extract_unsigned_integer (buf, REGISTER_RAW_SIZE(my reg)); store_unsigned_integer (dest, dest size, val); should insulate it from the current problems. Andrew