This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa/c] Signed read_register()
- To: Michael Snyder <msnyder at cygnus dot com>
- Subject: Re: [rfa/c] Signed read_register()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 11 Jul 2000 13:52:14 +1000
- CC: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- References: <396A9331.EBB745B6@cygnus.com> <396A9430.7AB5@cygnus.com>
Michael Snyder wrote:
>
> Andrew Cagney wrote:
> >
> > Hello,
> >
> > The attatched patch adds a signed version of the read_register{,_pid}()
> > functions (read_signed_register{,_pid}()). MIPS uses this when reading
> > registers such as the PC/SP (well it will when I check in a few other
> > changes :-).
> >
> > I think the existing read_register*() functions should be explicitly
> > re-named to read_unsigned_register() but that is another story :-)
> >
> > Ok? MichaelS, regcache.c is yours.
>
> Attachment missing. The idea is OK.
> Is it possible that read_signed_register could be implemented
> using read_register, or vice versa, to avoid code duplication?
>
> Side issue #1: Shall we change the return type of
> read_register from CORE_ADDR to LONGEST? Or better
> still, define a new INTREG_TYPE?
To do this it would need to return a ``struct type *'' - the register
size can change at runtime.
Actually, as one of those long term objectives, I think having a
read_register() that returned a ``struct type *'' would be a good thing,
it would break the requirement that a register could fit in a LONGEST.
> Side issue #2: Why can't the caller simply sign-extend?
> Esp. if the return type is of the correct size?
FYI, it started out as a function burried in mips-tdep.c. By moving it
to findvar.c (... ;-) to keep the reg code in one place.
As for merging read_{signed,}_register(), again yep, a second pass.
Andrew