Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Richard Henderson <rth@twiddle.net>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] cleanup alpha convert_to_{raw,virtual}
Date: Mon, 02 Jun 2003 18:36:00 -0000	[thread overview]
Message-ID: <3EDB9904.6090001@redhat.com> (raw)
In-Reply-To: <20030602050453.GA7460@twiddle.net>

> Ok?
> 
> 
> r~
> 
> 
> 	* alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of
> 	deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch
> 	macros where appropriate.
> 	(alpha_register_convert_to_raw): Similarly.  Use unpack_long.
> 	(alpha_convert_flt_dbl, alpha_convert_dbl_flt): New.

Richard, see:
http://sources.redhat.com/ml/gdb-patches/2003-06/msg00034.html

Instead of setting register_convertible et.al., the alpha should set:
	convert_register_p
	register_to_value
	value_to_register
and then make certain that the type returned by register_[virtual]_type 
is correct for all $register variables.

The new methods are only used when doing register to/from value 
conversions (as done by the alpha) where as the old methods were also 
used to type cast simple register values.

If it works after that switch, commit it.

Andrew


> *** alpha-tdep.c.1	Sun Jun  1 21:40:43 2003
> --- alpha-tdep.c	Sun Jun  1 21:51:35 2003
> *************** alpha_register_virtual_size (int regno)
> *** 160,183 ****
>      registers is different. */
>   
>   static void
>   alpha_register_convert_to_virtual (int regnum, struct type *valtype,
>   				   char *raw_buffer, char *virtual_buffer)
>   {
> !   if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
>       {
> !       memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum));
>         return;
>       }
>   
>     if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
> !     {
> !       double d = deprecated_extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
> !       deprecated_store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
> !     }
> !   else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
>       {
>         ULONGEST l;
> !       l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum));
>         l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff);
>         store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l);
>       }
> --- 160,196 ----
>      registers is different. */
>   
>   static void
> + alpha_convert_flt_dbl (void *out, const void *in)
> + {
> +   DOUBLEST d = extract_typed_floating (in, builtin_type_ieee_single_little);
> +   store_typed_floating (out, builtin_type_ieee_double_little, d);
> + }
> + 
> + static void
> + alpha_convert_dbl_flt (void *out, const void *in)
> + {
> +   DOUBLEST d = extract_typed_floating (in, builtin_type_ieee_double_little);
> +   store_typed_floating (out, builtin_type_ieee_single_little, d);
> + }
> + 
> + static void
>   alpha_register_convert_to_virtual (int regnum, struct type *valtype,
>   				   char *raw_buffer, char *virtual_buffer)
>   {
> !   if (TYPE_LENGTH (valtype) >= ALPHA_REGISTER_SIZE)
>       {
> !       memcpy (virtual_buffer, raw_buffer, ALPHA_REGISTER_SIZE);
>         return;
>       }
>   
> +   /* Note that everything below is less than 8 bytes long.  */
> + 
>     if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
> !     alpha_convert_dbl_flt (virtual_buffer, raw_buffer);
> !   else if (TYPE_CODE (valtype) == TYPE_CODE_INT)
>       {
>         ULONGEST l;
> !       l = extract_unsigned_integer (raw_buffer, ALPHA_REGISTER_SIZE);
>         l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff);
>         store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l);
>       }
> *************** static void
> *** 189,214 ****
>   alpha_register_convert_to_raw (struct type *valtype, int regnum,
>   			       char *virtual_buffer, char *raw_buffer)
>   {
> !   if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
>       {
> !       memcpy (raw_buffer, virtual_buffer, REGISTER_RAW_SIZE (regnum));
>         return;
>       }
>   
>     if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
>       {
> !       double d = deprecated_extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
> !       deprecated_store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
> !     }
> !   else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
> !     {
> !       ULONGEST l;
> !       if (TYPE_UNSIGNED (valtype))
> ! 	l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype));
> !       else
> ! 	l = extract_signed_integer (virtual_buffer, TYPE_LENGTH (valtype));
>         l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29);
> !       store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), l);
>       }
>     else
>       error ("Cannot store value in floating point register");
> --- 202,222 ----
>   alpha_register_convert_to_raw (struct type *valtype, int regnum,
>   			       char *virtual_buffer, char *raw_buffer)
>   {
> !   if (TYPE_LENGTH (valtype) >= ALPHA_REGISTER_SIZE)
>       {
> !       memcpy (raw_buffer, virtual_buffer, ALPHA_REGISTER_SIZE);
>         return;
>       }
>   
> +   /* Note that everything below is less than 8 bytes long.  */
> + 
>     if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
> +     alpha_convert_flt_dbl (raw_buffer, virtual_buffer);
> +   else if (TYPE_CODE (valtype) == TYPE_CODE_INT)
>       {
> !       ULONGEST l = unpack_long (valtype, virtual_buffer);
>         l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29);
> !       store_unsigned_integer (raw_buffer, ALPHA_REGISTER_SIZE, l);
>       }
>     else
>       error ("Cannot store value in floating point register");
> 



  reply	other threads:[~2003-06-02 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-02  5:04 Richard Henderson
2003-06-02 18:36 ` Andrew Cagney [this message]
     [not found] ` <863cisa1ps.fsf@elgar.kettenis.dyndns.org>
2003-06-02 22:36   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EDB9904.6090001@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox